Post by Pete BatardI just ran a test on my end to see what happened when issuing a
set_configuration before claim_interface, and I got the
LIBUSB_ERROR_NOT_FOUND code.
Now, independently of your issue, I believe we have an actual problem in
the Windows backend, so the following is addressed to the libusb
The libusb doc states "It is up to your application to ensure the
correct configuration is selected before you attempt to claim interfaces
and perform other operations" which conflicts with the current Windows
backend expectation (with autoclaim disabled) of having an interface
claimed to attempt to send a LIBUSB_REQUEST_SET_CONFIGURATION request.
This seems like this is the actual issue behind the set_configuration
problem we had with brltty earlier.
1. re-enabling autoclaim, and leaving the option set as default.
2. dropping the control request for set_configuration and returning
LIBUSB_ERROR_NOT_SUPPORTED.
Remember that the Windows USB API does not offer the possibility to send
a SET_CONFIGURATION request unless an interface has been initialized.
Now 1. has the advantage of enabling easy porting of Linux/OS-X libusb
code to Windows, with no or little modification of the libusb related
sections. It also allows devices that expect an actual set_configuration
request to actually receive it, even if Windows is unable to switch
configurations on the fly.
The drawback is that, when porting libusb code from Windows back to
other platforms, autoclaim would be missing, and the missing
claim_interface calls would need to be added.
2. has the advantage of not breaking the upcoming Windows->Linux libusb
code porting compatibility, and if we expect most of the existing code
ported to Windows to handle set_configuration error messages, things
should be OK. On the other hand, it means set_configuration messages
will never be seen by the device on Windows (at least the ones expected
to be sent by the application), and if those are used to
reset/reinitialize some device properties, this could mean trouble.
Do you guys have a view on this?
Regards,
/Pete
------------------------------------------------------------------------------