From: Antonio Ospite Date: Wed, 10 Jun 2015 10:09:31 +0000 (+0200) Subject: am7xxx-modeswitch: use libusb_set_auto_detach_kernel_driver() X-Git-Tag: v0.1.6~22 X-Git-Url: https://git.ao2.it/libam7xxx.git/commitdiff_plain/9e24b798ba1376655756c55fd157661148799422?ds=inline am7xxx-modeswitch: use libusb_set_auto_detach_kernel_driver() --- diff --git a/examples/am7xxx-modeswitch.c b/examples/am7xxx-modeswitch.c index bba3f3c..fd2be6d 100644 --- a/examples/am7xxx-modeswitch.c +++ b/examples/am7xxx-modeswitch.c @@ -53,21 +53,14 @@ int main(void) goto out; } - if (libusb_kernel_driver_active(usb_device, AM7XXX_STORAGE_INTERFACE)) { - ret = libusb_detach_kernel_driver(usb_device, - AM7XXX_STORAGE_INTERFACE); - if (ret < 0) - fprintf(stderr, "Warning: cannot detach kernel driver.\n"); - } else { - fprintf(stderr, "kernel driver not active.\n"); - } - ret = libusb_set_configuration(usb_device, AM7XXX_STORAGE_CONFIGURATION); if (ret < 0) { fprintf(stderr, "cannot set configuration.\n"); goto out_libusb_close; } + libusb_set_auto_detach_kernel_driver(usb_device, 1); + ret = libusb_claim_interface(usb_device, AM7XXX_STORAGE_INTERFACE); if (ret < 0) { fprintf(stderr, "cannot claim interface.\n");