c++ - `libusb_attach_kernel_driver` not working -


i have problem shutting down cleanly linux application uses libusb (the kernel not reclaim interface):

int rc;  rc = libusb_reset_device(handle_); if (rc < 0) {     cerr << "error resetting device: " << libusb_error_name(rc); }  (int ifnum = 0; ifnum < 2; ifnum++) {     rc = libusb_release_interface(handle_, ifnum);     if (rc < 0) {         cerr << "error releasing interface: " << libusb_error_name(rc);     }     if (libusb_kernel_driver_active(handle_, ifnum)) {         cerr << "reattaching cdc acm kernel driver.";         rc = libusb_attach_kernel_driver(handle_, ifnum);         if (rc < 0) {             cerr << "error reattaching cdc acm kernel driver: " << libusb_error_name(rc);         }     } }  libusb_close(handle_); libusb_exit(null); 

the problem reattaching kernel driver not work. libusb_kernel_driver_active not return 1 if comment out , call libusb_attach_kernel_driver, never /dev/ttyacm0 device. in case libusb_error_not_found.

i have debugged linux cdc-acm driver attach code , have figured out root-cause of problem. reason reattach not work claiming both control , data interfaces of cdc acm device. if detach/attach control interface (ifnum == 0), works expected. should documented somewhere.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -