Apropos of the change to usb_epnum_to_ep_desc(), what about the function
usb_ifnum_to_if()? It includes a comment saying (in a slightly misleading
fashion) that devices are not required to transmit interface descriptors
in order by interface number, and it performs a search for the requested
interface.
I'm not so sure that comment is right. For that matter, it seems likely
that devices _are_ required to transmit different altsetting descriptors
for an interface in numerical order. At least, that's how I interpret
this paragraph from section 9.6.5 of the USB 2.0 spec:
---------------
If a device configuration supported a single interface with two alternate
settings, the configuration descriptor would be followed by an interface
descriptor with the bInterfaceNumber and bAlternateSetting fields set to
zero and then the endpoint descriptors for that setting, followed by
another interface descriptor and its associated endpoint descriptors. The
second interface descriptor's bInterfaceNumber field would also be set to
zero, but the bAlternateSetting field of the second interface descriptor
would be set to one.
---------------
Now I admit that's not as definitive as it could be. However, there are
also comments in include/linux/usb.h that are quite clear. Under the
definition of struct usb_interface it says (ungrammatically and with an
off-by-one error):
* @altsetting: array of interface descriptors, one for each alternate
* setting that may be selected. Each one includes a set of
* endpoint configurations and will be in numberic order,
* 0..num_altsetting.
And under the definition of struct usb_host_config it says:
/* the interfaces associated with this configuration
* these will be in numeric order, 0..desc.bNumInterfaces
*/
struct usb_interface *interface[USB_MAXINTERFACES];
Assuming these comments are correct, there's no need for usb_ifnum_to_if()
to perform its search. In fact, there's no real need for the function at
all; it could easily be inlined or eliminated entirely. However, there
doesn't appear to be any code in core/config.c that verifies the
descriptors are in numerical order or sorts them if they aren't. Maybe
_that_ needs to be fixed.
Alan Stern
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel