Closed eworm-de closed 10 years ago
I am chasing another issue (that is probably related to usbhid module) and found this to be a theoretical problem.
libusb_detach_kernel_driver() may return LIBUSB_ERROR_NOT_FOUND in case no kernel drivers was active. So the alternative would be to check for (ykl_errno != 0 && ykl_errno != LIBUSB_ERROR_NOT_FOUND) in error condition, no? Or is it expected to goto done and not call libusb_set_configuration() in this case?
I'd say that noone considered the case properly.. Never seen it happen though, but I guess we should try to handle it correctly, question is what correctly means here.
My personal feeling is to avoid LIBUSB_ERROR_NOT_FOUND and check for kernel driver before. Probably anybody had the same in mind when implementing libusb_kernel_driver_active(). ;)
I'd be fine to declare LIBUSB_ERROR_NOT_FOUND a good return value, though. But IMHO the actualy code - although it works well in most cases as having usbhid around is pretty common - is not correct.
about to merge this, thanks for the contribution!
/klas
under what circumstances do you hit this? if the driver is already detached manually? should we do something similar for the libusb 0.1 backend?