Commit 9d30ca8e authored by Henrik Nordstrom's avatar Henrik Nordstrom
Browse files

fel: Detach (and reattach on exit) the awusb kernel driver if loaded

parent 6829404a
......@@ -278,6 +278,7 @@ int main(int argc, char **argv)
{
int rc;
libusb_device_handle *handle = NULL;
int iface_detached = -1;
rc = libusb_init(NULL);
assert(rc == 0);
......@@ -301,6 +302,13 @@ int main(int argc, char **argv)
exit(1);
}
rc = libusb_claim_interface(handle, 0);
#if defined(__linux__)
if (rc != LIBUSB_SUCCESS) {
libusb_detach_kernel_driver(handle, 0);
iface_detached = 0;
rc = libusb_claim_interface(handle, 0);
}
#endif
assert(rc == 0);
while (argc > 1 ) {
......@@ -345,5 +353,10 @@ int main(int argc, char **argv)
argv+=skip;
}
#if defined(__linux__)
if (iface_detached >= 0)
libusb_attach_kernel_driver(handle, iface_detached);
#endif
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment