int main(int argc, char* argv[]) { printf("CTS USB Accessory Tester\n"); struct usb_host_context* context = usb_host_init(); if (!context) { fprintf(stderr, "usb_host_init failed"); return 1; } // this will never return so it is safe to pass thiz directly usb_host_run(context, usb_device_added, usb_device_removed, NULL, NULL); return 0; }
int lsusb_main(int argc, char **argv) { struct usb_host_context *ctx; if (argc == 2 && !strcmp(argv[1], "-v")) verbose = 1; ctx = usb_host_init(); if (!ctx) { perror("usb_host_init:"); return 1; } usb_host_run(ctx, lsusb_device_added, lsusb_device_removed, lsusb_discovery_done, NULL); usb_host_cleanup(ctx); return 0; }
int hu_usb_run () { // Android specific C level libusbhost API requires thread for it's processing, and calling of the added/removed/disc-done callbacks struct usb_host_context * context = usb_host_init (); usb_host_run (context, usb_device_added, usb_device_removed, usb_discovery_done, (void * ) 0); usb_host_cleanup (context); return (0); }