RE: [RFC] USB 3.0 Hub Changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Sarah Sharp [mailto:sarah.a.sharp@xxxxxxxxxxxxxxx]
> Sent: Tuesday, August 17, 2010 2:39 PM
> To: John Youn
> Cc: linux-usb@xxxxxxxxxxxxxxx; Alan Stern; Daniel Drake; libusb-
> devel@xxxxxxxxxxxxxxxxxxxxx; Greg KH
> Subject: Re: [RFC] USB 3.0 Hub Changes
> 
> Hi John,
> 
> I've been testing your patch with a VIA USB 3.0 hub prototype.
> 
> I've tested with a mouse, USB 3.0 hard drive, and high speed webcam.
> All devices seem to work fine under the hub with your patch.  The only
> slightly concerning thing is that I see a bunch of stalls when I try to
> run `lsusb -v` for the USB 3.0 hub portion.  The lsusb output says:
> 
> can't get hub descriptor: Broken pipe
> Device Status:     0x0001
>   Self Powered
> 
> The USB 3.0 hub descriptor is a different descriptor code (and format)
> than USB 1.1 or 2.0 hubs.  It looks like your patch changed the kernel
> code in get_hub_descriptor() to ask for the right descriptor, but I'm
> not sure if userspace is issuing a control transfer through usbfs and
> bypassing the kernel.
> 
> Full USBmon, lsusb and dmesg output attached.  I'm running lsusb
> (usbutils) version 0.82.
> 
> The first failed transfer is
> ffff88012c161cc0 3629591912 S Ci:9:002:0 s a0 06 2900 0000 000d 13 <
> ffff88012c161cc0 3629595966 C Ci:9:002:0 -32 0
> 
> bmRequestType = a0, bRequest = 06, wValue = 2900, wIndex = 0000,
> wLength
> = 000d
> 
> That looks like a USB 2.0 GetHubDescriptor request to me.
> 
> Alan, Daniel, or Greg, do you know if lsusb is calling through libusb
> to
> get the hub descriptor, or is it just getting cached descriptors from
> the kernel?
> 
> 
> John, I'm concerned that you're blindly assigning the USB 3.0 hub
> descriptor to a usb_hub_descriptor.  The current structure is:
> 
> struct usb_hub_descriptor {
>         __u8  bDescLength;
>         __u8  bDescriptorType;
>         __u8  bNbrPorts;
>         __le16 wHubCharacteristics;
>         __u8  bPwrOn2PwrGood;
>         __u8  bHubContrCurrent;
>                 /* add 1 bit for hub status change; round to bytes */
>         __u8  DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
>         __u8  PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
> } __attribute__ ((packed));
> 
> The USB 3.0 hub descriptor should look something like this:
> 
> struct usb_hub_usb3_descriptor {
>         __u8  bDescLength;
>         __u8  bDescriptorType;
>         __u8  bNbrPorts;
>         __le16 wHubCharacteristics;
>         __u8  bPwrOn2PwrGood;
>         __u8  bHubContrCurrent;
>                 /* add 1 bit for hub status change; round to bytes */
>         __u8  bHubHdrDecLat;
>         __u16  wHubDelay;
>         __u8  DeviceRemovable[2];
> } __attribute__ ((packed));
> 
> The descriptor is longer, and the fields after bHubContrCurrent don't
> align properly.  So I don't think your current approach of just
> assigning the new hub descriptor to a pointer of the old hub descriptor
> type is going to work very well.
> 

Actually the 3.0 descriptor is smaller than the largest 2.0 descriptor, so it fits into the same buffer.  And most of the structure is the same so I left it like that so the core can access the same structure and fields.

The differences are only at the end, so for 3.0 hubs I skipped where the hub accesses the 2.0-only fields DeviceRemovable and PortPwrCtrlMask, and put the FIXME comment.  For the new 3.0 fields, there is no code to use them yet.

Not a complete solution obviously but I did somewhat account for the difference.

John



--
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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux