Hi,

When usb_new_device() is called, the maxpacketsize for the
default control pipe is not known, so it's not safe to read more
than 8 bytes of the device descriptor.  Since bMaxPacketSize0
(max packet size for the default control pipe) is in this first
8 bytes, the code can read this byte and use it for future
reads of the control pipe.  You can follow the code and see
that a few lines later it calls usb_get_device_descriptor().
This reads the entire descriptor.

This shouldn't cause any problem(s) with the device you
are working with if it's built properly.  If you see problems,
it could be a USB device silicon or firmware problem.

For future linux-usb discussions, please use the
[EMAIL PROTECTED] mailing list.

~Randy

> -----Original Message-----
> From: Karel Srsen [mailto:[EMAIL PROTECTED]]
> 
> Hello,
> is there somebody who understands linux USB driver ?
> I have one question:
> there is following piece of code in drivers/usb/usb.c (2.3.50 kernel):
> 
> int usb_new_device(struct usb_device *dev)
> {
> ...
> ...
>         err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
> &dev->descriptor, 8);
>         if (err < 8) {
> ...
> ...
> }
> 
> that's nice but in fact USB device descriptor's length is not 8 bytes
> but 18 (0x12). Does it means that driver reads only leading 8 bytes
> instead of whole descriptor ? I thing it's wrong, isn't ? Can it cause
> any error ?
> 
> I haven't subscribed this mailing list. If you decide to answer, send
> reply to [EMAIL PROTECTED] please.
> 
>   Karel


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to