* Felipe Balbi | 2011-03-18 15:33:42 [+0200]: >diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c >index 5fe5b88..04d3e1f 100644 >--- a/drivers/usb/gadget/composite.c >+++ b/drivers/usb/gadget/composite.c >@@ -617,6 +617,34 @@ static int lookup_string( > return -EINVAL; > } > >+static int get_bos_descriptor(struct usb_composite_dev *cdev, >+ void *buf) >+{ >+ struct usb_bos_descriptor *bos = cdev->bos; >+ const struct usb_dev_cap_header *cap; >+ int len = USB_BUFSIZ; >+ void *next = buf; >+ >+ if (!cdev->bos) >+ return -EINVAL; >+ >+ if (!cdev->capabilities) >+ return -EINVAL; The upper layer returns -EOPNOTSUPP but we miss ->capabilities okay. But for bcdVersion being 0x300 we "shall" return something. We could return an "USB 2.0 Extension", couldn't we? >+ >+ memcpy(next, bos, bos->bLength); Why do we take usb_bos_descriptor from somewhere? Its content is more or less static: bLength & bDescriptorType is contant. wTotalLength and bNumDeviceCaps are known after the loop. So I would rather set bos to buf instead of this memcpy. >+ next += bos->bLength; >+ len -= bos->bLength; >+ >+ for (cap = *cdev->capabilities; cap; cap++) { if (len < cap->bLength) break; >+ bos->bNumDeviceCaps++; >+ memcpy(next, cap, cap->bLength); >+ next += cap->bLength; >+ len -= cap->bLength; >+ } ch 9.6.2.1 says: |A SuperSpeed device shall include the USB 2.0 Extension descriptor and |shall support LPM when operating in USB 2.0 High-Speed mode. Currently there is only one type of bmAttributes defined which is LPM. So you could set it here since it is static atleast for now. >+ >+ return len; >+} >+ >@@ -870,6 +898,9 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) > if (value >= 0) > value = min(w_length, (u16) value); > break; >+ case USB_DT_BOS: >+ value = get_bos_descriptor(cdev, req->buf); if (value >= 0) value = min(w_length, (u16) value); ? >+ break; > } > break; > Sebastian -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html