Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If there is an interface association descriptor (IAD), bNumInterfaces should be corrected. #1532

Open
rhoog-ine opened this issue Mar 5, 2024 · 0 comments

Comments

@rhoog-ine
Copy link

When there is an interface association descriptor IAD, where multiple interface descriptors belonging to a single function are added to the configuration descriptor bundle using one stuct usb_interface element, the bNumInterfaces is incorrect.

In the current usb_standard.c code, it is assumed that each struct usb_interface adds just one logical interface (one interface having multiple altsettings still counts as one). This assumption is incorrect for the above situation.

An example of such a device class is cdc_acm, which has a 'COMM' interface and a 'DATA' interface, which are bundled using IAD. It still makes sense to have bNumInterfaces act as a nr_elements (array_size) for the interface member of the usb_config_descriptor, but the value needs to be adjusted on output (in build_config_descriptor, just like is done with wTotalLength) when such IAD is encountered.

A workaround is currently to add the COMM and the DATA interface in separate struct usb_interface's, where the first one has the IAD and the second one doesn't. This seems counter-intuitive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant