On Fri, 29 Jun 2007, jidong xiao wrote:

> Sorry I cannot find this in usb 2.0 spec.

It isn't in the USB 2.0 spec.  That's why you can't find it.  :-)

> But inside the code,drivers/usb/core/hub.c:
>     103 /* USB 2.0 spec Section 11.24.4.5 */
>     104 static int get_hub_descriptor(struct usb_device *hdev, void
> *data, int size)
>     105 {
>     106         int i, ret;
>     107
>     108         for (i = 0; i < 3; i++) {
>     109                 ret = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
>     110                         USB_REQ_GET_DESCRIPTOR, USB_DIR_IN | 
> USB_RT_HUB,
>     111                         USB_DT_HUB << 8, 0, data, size,
>     112                         HZ * USB_CTRL_GET_TIMEOUT);
>     113                 if (ret >= (USB_DT_HUB_NONVAR_SIZE + 2))
>     114                         return ret;
>     115         }
>     116         return -EINVAL;
>     117 }
> what does this macro mean? And why here we loop three times?

The macro is defined in drivers/usb/core/hub.h.  It refers to the 
length of the non-variable part of the hub descriptor.  The parts of 
the descriptor following the first 7 bytes will vary according to the 
number of ports.

We loop 3 times in case a communication occurs.  Lots of code in the 
hub driver does this; many devices have problems sending their 
descriptors.

Alan Stern


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to