USB 2.0 device through a USB 1.1 hub

View: New views
6 Messages — Rating Filter:   Alert me  

USB 2.0 device through a USB 1.1 hub

by rliou :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

I need to detect if my USB 2.0 device is connected through a USB 1.1 hub so I can handle the device accordingly. The value of bcdUSB in the descriptor and device qualifier always shows me 200H(USB 2.0) with or without the hub. How do I get the actual USB speed for a device with a low/full speed hub in the middle?

Thanks.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libusb-devel mailing list
Libusb-devel@...
https://lists.sourceforge.net/lists/listinfo/libusb-devel

Re: USB 2.0 device through a USB 1.1 hub

by Alan Stern :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 21 Oct 2008 rliou@... wrote:

> I need to detect if my USB 2.0 device is connected through a USB 1.1
> hub so I can handle the device accordingly. The value of bcdUSB in
> the descriptor and device qualifier always shows me 200H(USB 2.0)
> with or without the hub. How do I get the actual USB speed for a
> device with a low/full speed hub in the middle?

I don't think there's any direct way to do it with libusb.

You can use an indirect technique.  For example, if a device is running
at high speed then all Bulk endpoints must have a maxpacket size of
512, whereas at full speed all Bulk endpoints must have a maxpacket
size <= 64.

Or you could parse the contents of /proc/bus/usb/devices if you're
running on a Linux system.  That file contains the actual speed of
each USB device (among a lot of other information).  Or you can get the
speed through sysfs.

Alan Stern


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libusb-devel mailing list
Libusb-devel@...
https://lists.sourceforge.net/lists/listinfo/libusb-devel

Re: USB 2.0 device through a USB 1.1 hub

by Tim Roberts :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

rliou@... wrote:
>
> I need to detect if my USB 2.0 device is connected through a USB 1.1
> hub so I can handle the device accordingly. The value of bcdUSB in the
> descriptor and device qualifier always shows me 200H(USB 2.0) with or
> without the hub. How do I get the actual USB speed for a device with a
> low/full speed hub in the middle?
>

Do you have an "other speed configuration descriptor"?  If so, you
should be able to fetch the current configuration descriptor and see
which one you got.  Your device should return the "other speed"
descriptor if it connects as USB 1.1.

--
Tim Roberts, timr@...
Providenza & Boekelheide, Inc.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libusb-devel mailing list
Libusb-devel@...
https://lists.sourceforge.net/lists/listinfo/libusb-devel

Re: USB 2.0 device through a USB 1.1 hub

by Alan Stern :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 22 Oct 2008, Tim Roberts wrote:

> rliou@... wrote:
> >
> > I need to detect if my USB 2.0 device is connected through a USB 1.1
> > hub so I can handle the device accordingly. The value of bcdUSB in the
> > descriptor and device qualifier always shows me 200H(USB 2.0) with or
> > without the hub. How do I get the actual USB speed for a device with a
> > low/full speed hub in the middle?
> >
>
> Do you have an "other speed configuration descriptor"?  If so, you
> should be able to fetch the current configuration descriptor and see
> which one you got.  Your device should return the "other speed"
> descriptor if it connects as USB 1.1.

A USB 2.0 device will _never_ connect as USB 1.1.  No matter what speed
it operates at, it will always report its bcdUSB value as 0x0200.  This
is required by the USB 2.0 spec.

Furthermore, you can't rely on the "other speed config" descriptor to
tell you what speed a USB 2.0 device is running at.  If it's running at
full speed then the "other speed config" descriptor will be for a
high-speed configuration, and vice versa, if it's running at high speed
then the "other speed config" descriptor will be for a full-speed
configuration.

Either way, you still have to figure out which configuration is for
which speed.  There's no direct way to do this, since the speed isn't
part of the config descriptor.

Alan Stern


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libusb-devel mailing list
Libusb-devel@...
https://lists.sourceforge.net/lists/listinfo/libusb-devel

Re: USB 2.0 device through a USB 1.1 hub

by Tim Roberts :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Alan Stern wrote:

> On Wed, 22 Oct 2008, Tim Roberts wrote:
>
>  
>> Do you have an "other speed configuration descriptor"?  If so, you
>> should be able to fetch the current configuration descriptor and see
>> which one you got.  Your device should return the "other speed"
>> descriptor if it connects as USB 1.1.
>>    
>
> A USB 2.0 device will _never_ connect as USB 1.1.  No matter what speed
> it operates at, it will always report its bcdUSB value as 0x0200.  This
> is required by the USB 2.0 spec.
>  

You are quite correct.  I should have said "...if it is forced to
connect as full-speed."

> Furthermore, you can't rely on the "other speed config" descriptor to
> tell you what speed a USB 2.0 device is running at.  If it's running at
> full speed then the "other speed config" descriptor will be for a
> high-speed configuration, and vice versa, if it's running at high speed
> then the "other speed config" descriptor will be for a full-speed
> configuration.
>  

But that's clearly sufficient.  As long as you can tell the difference
between them, you just ask for the current configuration descriptor.  If
the one you get is your high-speed descriptor, then you are running
high-speed.  If the one you get is your full-speed descriptor, then you
are running full-speed.

This doesn't work in the general case for an arbitrary device, but few
of us are really writing apps for the general case.

--
Tim Roberts, timr@...
Providenza & Boekelheide, Inc.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libusb-devel mailing list
Libusb-devel@...
https://lists.sourceforge.net/lists/listinfo/libusb-devel

Re: USB 2.0 device through a USB 1.1 hub

by Alan Stern :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 22 Oct 2008, Tim Roberts wrote:

> > Furthermore, you can't rely on the "other speed config" descriptor to
> > tell you what speed a USB 2.0 device is running at.  If it's running at
> > full speed then the "other speed config" descriptor will be for a
> > high-speed configuration, and vice versa, if it's running at high speed
> > then the "other speed config" descriptor will be for a full-speed
> > configuration.
> >  
>
> But that's clearly sufficient.  As long as you can tell the difference
> between them, you just ask for the current configuration descriptor.  If
> the one you get is your high-speed descriptor, then you are running
> high-speed.  If the one you get is your full-speed descriptor, then you
> are running full-speed.

If you can tell the difference then you don't need to use the "other
speed config" descriptor at all.

The real question is how can you tell the difference?  It depends on
the device, obviously, but in general full-speed and high-speed configs
tend to be pretty similar.  The most notable distinction, as I pointed
out earlier, is the size of the Bulk endpoint maxpacket values.

However, if somebody is concerned with only one specific device, things
become simpler.  Compare the two descriptors for the two difference
speeds, looking for any distinguishing characteristic.  Then use that
characteristic to tell which speed the current config descriptor is
for.

Alan Stern


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libusb-devel mailing list
Libusb-devel@...
https://lists.sourceforge.net/lists/listinfo/libusb-devel