Re: UAS support for hcd without sg support

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

 



On Mon, Jan 09, 2012 at 05:54:46PM -0500, Alan Stern wrote:
> 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?

Why would it do that?  I haven't seen any devices that do, and I'm
pretty sure they would fail the USB-IF certification test if they did.

I'm mostly copying the speed check from check_highspeed().  I assumed it
was checking the bcdUSB version rather than using the udev->speed
because it wouldn't be set yet, although I'll admit I didn't look at the
speed setting code too closely.

> 
> > +			dev->bos->ss_cap)
> 
> What if dev->bos is NULL?

Fixed in the next version of the patch.

> 
> > +		/* BOS descriptor should have already been fetched by now. */
> 
> Is this comment really helpful?

Eh, I can remove it.  I thought it might be useful in case anyone tried
to move the SuperSpeed before the descriptor fetches.  The
check_highspeed() function will work in that case, but not the
check_superspeed() function.

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

It might incentive them to procure one. ;)  But in all seriousness, a
user could plug a USB 3.0 device into a USB 3.0 hub, but still have the
message print because they've plugged the hub into an EHCI port.
Telling them to plug the device into a SuperSpeed hub doesn't help, they
already do!

> > +}
> > +
> >  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.

So should I add more warnings if there aren't any USB 3.0 hosts in the
system (or CONFIG_USB_XHCI is not turned on)?

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


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

  Powered by Linux