google/web-serial-polyfill

Implement support for CDC composite gadget

Chapnik13 opened this issue · 3 comments

Device info:
cdc composite gadget
cdc composite gadget configuration

I could not use the polyfill to communicate with the device, It stated that there was no in endpoint, and then I changed the alternates and the interfaces that it communicate with but then I got error when I tried to send the control bits.

Maybe it is just some configuration that needed to change?
Thanks for your help

When picking the interfaces manually are you sure you picked interfaces 2 and 3? Interfaces 0 and 1 form a USB CDC Ethernet device while 2 and 3 form a USB CDC ACM device. The existing code for interface selection probably can't quite tell the difference and needs to learn to interpret the subclass code. The device probably also has interface association descriptors which aren't currently exposed through WebUSB which would help with this detection.

I probably made a mistake and didn't claim interfaces 2 and 3.

I changed the code again and verified that these are the interfaces that are claimed and it works now.

Changing the code to depend on the subclass and class alone is not enough because there are two interfaces with class 10 and subclass 0, I added a check for the alternates

Is it enough to be an all purpose general solution?
If it is I can make a pr

Create a PR and we can discuss the particular detection logic. Without parsing interface association descriptors we probably just want to use the heuristic that the class 10 interface must follow the class 2, subclass 2 interface.