Re: UAS support for hcd without sg support

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

 



On Mon, 9 Jan 2012, Sarah Sharp wrote:

> On Mon, Jan 09, 2012 at 03:24:06PM -0500, Alan Stern wrote:
> > On Mon, 9 Jan 2012, Felipe Balbi wrote:
> > 
> > > > Actually it does help: In that situation, the uas driver can print a 
> > > > warning message telling the user to plug the device into a different 
> > > > controller.  We already do something very much like that when a 
> > > > high-speed-capable device is plugged into a full-speed controller; see 
> > > > check_highspeed() in hub.c.  Is there any way to do the same thing when 
> > > > a SuperSpeed-capable device is plugged into a USB <= 2.0 controller?
> > > 
> > > you should be able to implement something like that by checking your
> > > Device Capability Descriptor which comes with the BOS descriptor set.
> > > 
> > > Then you can check wSpeedSuppoted field on that device, if it has the
> > > SuperSpeed bit enabled and you're attached to <=USB_SPEED_HIGH, then you
> > > can warn.
> > 
> > Anybody have the time to do this?  :-)
> 
> Done, although untested.  lsusb also needs to be fixed to fetch the BOS
> descriptor if it sees a USB 2.1 device.  I'll send that patch shortly.

> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index db6b751..1f92ce8 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -3164,6 +3164,16 @@ check_highspeed (struct usb_hub *hub, struct usb_device *udev, int port1)
>  	kfree(qual);
>  }
>  
> +static void check_superspeed(struct usb_hub *hub, struct usb_device *udev,
> +		int port1)
> +{
> +	if (le16_to_cpu(udev->descriptor.bcdUSB) < 0x0300 &&

What's the point of this check?  What happens if a USB-3.0 device sets 
bcdUSB to 0x0300 in its high-speed device descriptor?

> +			dev->bos->ss_cap)

What if dev->bos is NULL?

> +		/* BOS descriptor should have already been fetched by now. */

Is this comment really helpful?

> +		dev_info(&udev->dev, "not running at top speed; "
> +			"connect to a SuperSpeed hub or host\n");

The "or host" part doesn't seem very useful.  What if the user doesn't 
have a SuperSpeed host?  Might as well leave it out.

> +}
> +
>  static unsigned
>  hub_power_remaining (struct usb_hub *hub)
>  {
> @@ -3383,6 +3393,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
>  				&& udev->speed == USB_SPEED_FULL
>  				&& highspeed_hubs != 0)
>  			check_highspeed (hub, udev, port1);

You need to check some things here: Is the device running at less than 
SuperSpeed?  Are there any USB-3.0 controllers in the system?

Or add those tests to your check_super_speed routine.

> +		check_super_speed(hub, udev, port1);

Alan Stern

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