On 26.06.24 20:37, Alan Stern wrote: Hi,
There are three obvious ways of dealing with this: Reject invalid descriptors in which the reserved bits are nonzero. This might run into problems if later specifications decide to store real information in those bits. Accept the invalid descriptors, but clear the reserved bits in bEndpointAddress while parsing the descriptors. This could also run into problems if those bits get used for something in the future.
This would seem to be the right approach. Reserved means reserved. We should not try to interpret them, which we would if we went for the first solution. However:
Accept the invalid descriptors, but mask out the reserved bits when comparing the addresses in endpoint_is_duplicate(). This
We should perhaps do the very opposite. That is only in this case discard an endpoint if the lower bits match.
might run into problems if any other routines assume that the reserved bits are zero -- there's some questionable code in devio.c's findintfep() and quirk.c's usb_endpoint_is_ignored(), for example. I'm inclined to go with the first approach. If a later version of the USB spec uses those bits for something, we can adapt to it.
Deployed systems cannot adapt and reserved means that they should be ignored unless we have a good reason not to. Regards Oliver