I have a problem completely shutting down my Linux application that uses libusb (the kernel does not return an interface):
int rc; rc = libusb_reset_device(handle_); if (rc < 0) { cerr << "Error resetting the device: " << libusb_error_name(rc); } for (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 is that rebooting the kernel driver does not work. In fact, libusb_kernel_driver_active does not return 1, but even if I comment on it and always call libusb_attach_kernel_driver , I will never return to my device /dev/ttyACM0 . In this case, I get LIBUSB_ERROR_NOT_FOUND .
source share