Stefan Reinauer has submitted this change. ( https://review.coreboot.org/c/em100/+/47778 )
Change subject: Use libusb_auto_detach_kernel_driver ......................................................................
Use libusb_auto_detach_kernel_driver
Because it also does automatic reattachment after we're done. This seems irrelevant on Linux.
Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org Change-Id: Id88d1138e2e2726d44f106740c8332be4ca90cb7 Reviewed-on: https://review.coreboot.org/c/em100/+/47778 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Angel Pons th3fanbus@gmail.com --- M em100.c 1 file changed, 3 insertions(+), 5 deletions(-)
Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved
diff --git a/em100.c b/em100.c index ae6d18f..d12e4aa 100644 --- a/em100.c +++ b/em100.c @@ -336,11 +336,9 @@ static int em100_init(struct em100 *em100, libusb_context *ctx, libusb_device_handle *dev) { - if (libusb_kernel_driver_active(dev, 0) == 1) { - if (libusb_detach_kernel_driver(dev, 0) != 0) { - printf("Could not detach kernel driver.\n"); - return 0; - } + if (libusb_set_auto_detach_kernel_driver(dev, 1) != LIBUSB_SUCCESS) { + printf("Can't detach kernel driver.\n"); + return 0; }
if (libusb_claim_interface(dev, 0) < 0) {