Is there a way to indicate that a USB device is connected to the wrong port?

Hi,
the usb device for which I wrote a driver needs to be connected to a USB3 port. My question is: Is there a way for the driver to detect at which kind of port (USB2/USB3) the device is connected to? And if yes, is there a way for the driver to prompt the user to replug the device to the right port?
I am asking this, because I already saw for some devices a pop-up message on Windows, telling the user to select a different port to enable the support for higher data rates. I wonder how this is done and where?

Thanks a lot for any advice

There is no generic notification mechanism, the ui you are referring to is specifically addressing bandwidth and power requirements. You can detect if you are plugged into a usb3 port by trying to do usb3 things and if that fails, you know you are not connected to a usb3 port.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmx.net
Sent: Monday, February 9, 2015 9:35 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Is there a way to indicate that a USB device is connected to the wrong port?

Hi,
the usb device for which I wrote a driver needs to be connected to a USB3 port. My question is: Is there a way for the driver to detect at which kind of port (USB2/USB3) the device is connected to? And if yes, is there a way for the driver to prompt the user to replug the device to the right port?
I am asking this, because I already saw for some devices a pop-up message on Windows, telling the user to select a different port to enable the support for higher data rates. I wonder how this is done and where?

Thanks a lot for any advice


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

xxxxx@gmx.net wrote:

the usb device for which I wrote a driver needs to be connected to a USB3 port. My question is: Is there a way for the driver to detect at which kind of port (USB2/USB3) the device is connected to? And if yes, is there a way for the driver to prompt the user to replug the device to the right port?
I am asking this, because I already saw for some devices a pop-up message on Windows, telling the user to select a different port to enable the support for higher data rates. I wonder how this is done and where?

The host controller knows, of course, at what speed your device actually
enumerated. It also knows, by reading your descriptors, what speed you
are capable of. If a device with SuperSpeed descriptors enumerates on a
USB 2.0 port, then you see the “this device can perform faster in
another port” message.

I’m not sure it’s possible to tell the difference between “USB 3 device
plugged into a USB 2 port” and “USB 3 device plugged into a USB 3 port
but failed to enumerate properly at super speed”, but the latter would
be a hardware problem that you would presumably detect pretty early.

You can use the badly designed
IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX_V2 to determine whether you
are actually operating at SuperSpeed or not:
https://msdn.microsoft.com/en-US/library/windows/hardware/hh450861.aspx

I call it badly designed because it applies ONLY to USB 3. You would
think that, once you see that you have USB 1 and 2, you would make sure
that any new interfaces are future-proof. So, for example, if this
structure had included the clock speed at which the device was
operating, we would not have to modify all of our drivers when USB 4
comes out.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

>the user to select a different port to enable the support for higher data rates. I wonder how this is

done and where?

I think this is always for the USB3 device connected to USB2 port.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

Frist of all, it is highly recommended that a Super-speed device and its driver should not assume Super-Speed. They should be able to scale back to 2.0 speeds and give a good experience to the user. There are still a number of systems that only have 2.0 ports on them (even if they are moving to XHCI). In most cases, a driver should never need to take a dependency on the bus speed. It should rather base the decision on something more generic such as the end point max packet size, etc. However, if a driver does need to optimize based on the speed, the recommended way is to use the DEVICE_CONNECTION_SUPER_SPEED_COMPATIBLE capability (https://msdn.microsoft.com/en-us/library/windows/hardware/hh406230(v=vs.85).aspx). Note that this capability will return true for any higher speeds that are introduced in future (for e.g. SuperSpeedPlus), so in that sense, it is future compatible. One caveat is that if the driver is being written for internal devices that might be connected on SSIC, the PHY speed might actually be slower than the standard SuperSpeed speed.

A driver should never need to worry about giving messages to the user about plugging the device in a different port. Windows does detect when a 2.0 USB device is plugged into a 3.0 port and indicates to the user that the device can perform faster.

>>>>>From: xxxxx@live.com "…A driver should never need to worry

>>>>about giving messages to the user about plugging the device in a
>>>>different port. Windows does detect when a 2.0 USB device is plugged
>>>>into a 3.0 port and indicates to the user that the device can perform
>>>>faster."<<<<<<

I assume that is supposed to say “Windows does detect when a 3.0 USB device
is plugged into a 2.0 port and indicates to the user that the device can
perform faster”

Is this true for Windows 7? I have not seen any messages when connecting a
USB3 disk to random ports. In fact I can’t find any way as a user to know if
it has achieved USB3 speeds, apart from transferring a lot of data. I know
that a complete Windows backup of my machine takes more than 24 hours with a
USB2 drive and about 18 hours with a USB 3 drive, but it’s a long wait to
find out!

  • Mike

Yes, I meant to say “3.0 USB device is plugged into a 2.0 port”. Thanks for the catch.

Unfortunately, it is not guaranteed to work on Windows 7 because there is no inbox support for USB3.0. The USB 3.0 experience is controlled by the third party USB stacks on Windows 7.