FreeCalypso > hg > fc-usbser-tools
diff libuwrap/prelim_init.c @ 9:ab506f6aa57c
libuwrap started
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 07 Sep 2023 04:00:56 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libuwrap/prelim_init.c Thu Sep 07 04:00:56 2023 +0000 @@ -0,0 +1,23 @@ +/* + * libftdi-0.20 performs these preliminary steps just before it goes + * looking for the device of interest via usb_get_busses() followed + * by traversal of the returned tree - hence we do likewise. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <usb.h> +#include "prelim_init.h" + +void libusb_prelim_init(void) +{ + usb_init(); + if (usb_find_busses() < 0) { + fprintf(stderr, "error: usb_find_busses() failed\n"); + exit(1); + } + if (usb_find_devices() < 0) { + fprintf(stderr, "error: usb_find_devices() failed\n"); + exit(1); + } +}