On Mon, Aug 22, 2011 at 10:18:23AM -0400, Alan Stern wrote: > On Mon, 22 Aug 2011, Felipe Balbi wrote: > > > this patch adds superspeed descriptors for the > > storage gadgets. > > ... > > > --- a/drivers/usb/gadget/file_storage.c > > +++ b/drivers/usb/gadget/file_storage.c > > @@ -589,10 +589,15 @@ static int populate_config_buf(struct usb_gadget *gadget, > > return -EINVAL; > > > > if (gadget_is_dualspeed(gadget) && type == USB_DT_OTHER_SPEED_CONFIG) > > - speed = (USB_SPEED_FULL + USB_SPEED_HIGH) - speed; > > - function = gadget_is_dualspeed(gadget) && speed == USB_SPEED_HIGH > > - ? (const struct usb_descriptor_header **)fsg_hs_function > > - : (const struct usb_descriptor_header **)fsg_fs_function; > > + speed = (USB_SPEED_FULL + USB_SPEED_HIGH + > > + USB_SPEED_SUPER) - speed; > > What on Earth happened here? This line shouldn't be changed. It's > supposed to set speed to USB_SPEED_FULL if we're currently running at > high speed and vice versa -- that is, it computes the _other_ speed. > > Which reminds me... Something got left out of the patch. In > standard_setup_req(), the USB_DT_DEVICE_QUALIFIER and > USB_DT_OTHER_SPEED_CONFIG cases need to return an error if we are > currently running at SuperSpeed. Those two descriptors aren't > supported in USB-3. And that reminds me that the SuperSpeed gadget needs to have a couple of BOS descriptors added. :) You need a USB 2.0 Extension BOS descriptor that indicates you can do the USB 2.1 LPM (see section 9.6.2.1 of the USB 3.0 spec). That technically means that your USB 3.0 device has to do LPM when attached at USB 2.0 speeds. In practice it turns out a lot of USB 3.0 devices don't actually do USB 2.0 LPM correctly, as Andiry Xu found out when he started testing some USB 2.0 LPM patches for the xHCI host. You'll also need the SuperSpeed USB Device Capability BOS descriptor that defines which "other speeds" the device can run at, and the USB 3.0 LPM U1/U2 timeouts. The timeouts will probably be specific to the particular board the gadget is running on. You could add a Container ID BOS descriptor, but it's optional (except for USB 3.0 hubs), Linux doesn't use it for anything, and most device vendors don't follow the rule to generate a random UUID per USB device. Usually the UUID is all zeros for USB 3.0 hubs, at least VIA hubs. Sarah Sharp -- 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