Closed colabi closed 3 years ago
You need to overload the onSetup
method to handle the SET_INTERFACE
request, keep track of the latest selected one and alter the behaviour of the endpoints based on that value. You will probably want to keep calling super(YourClass, self).onSetup(...)
when your code does not recognises the request, to avoid having to reimplement everything from Function.onSetup
. If I remember the USB spec correctly, you also need to reset the selected alternate setting to the default one when onEnable
is called (which IIRC happens when hosts issues a SET_CONFIGURATION
request).
And of course, you should populate the descriptors accordingly, so the host driver knows the alternate setting exists.
Fantastic. Thank you for the guidance. I'll attempt the modifications and post any success!
Great Project. I've brought up the interface to simulate a medical device in development. However, I'm having trouble understanding if creating a configuration with multiple interfaces (and alternate interfaces) is supported. Is this something that can be made to work?