From: ADAC-Reaper on
Hello,

I am trying to request device speed with the following code:

WINUSB_INTERFACE_HANDLE WinUsbHandle;
BOOL boolResult;
ULONG length;
UCHAR speed;
length = sizeof(speed);
boolResult = WinUsb_QueryDeviceInformation(WinUSbHandle, DEVICE_SPEED,
&length, &speed);



My Device is a USB 2.0 device with LowSpeed and FullSpeed transfer but no
HighSpeed transfers.
Whenever I request the device speed this function reports no error (TRUE ==
boolResult) but the "speed" variable is set to LowSpeed (0x01), even when my
device is working in FullSpeed mode. The UVCView tool what is inclulded in
the WinDDK correctly displays the speed.
In my testing program I also can request device descriptors an transfer data
in bulk mode what somehow confuses me since this is allowed only for
FullSpeed devices. Everythig I implemented is working except the device speed
request.
With my USB flash drive the QueryDevice Information returns HighSpeed what
is correct in that case. Unfortunately I couldn't test it with a LowSpeed
device.
For initialisation i adhered to the HowTo (How to Use WinUSB to Communicate
with a USB Device).
I am using Visual Studio 2008 on Windows 7. My programming language is C++.

I hope someone may help me.

Thanks in advance.
ADAC-Reaper.
From: Philip Ries [MSFT] on
This appears to be a bug: the WinUsb_QueryDeviceInformation doc doesn't
match WinUSB's functionality (at least in Win7). I will try to resolve
that issue but for now, in my judgment, you shouldn't rely on the
validity of any result other than HighSpeed.

So you will need a different way to differentiate full speed from low speed.

If your full speed and low speed devices have different device
descriptors, you could use WinUsb_GetDescriptor. Another way would be
to CreateFile on the device's parent hub (this can be made a little
easier by reusing the HDEVINFO for the device, which you needed at
initialization, and calling SetupDiEnumDeviceInfo, CM_Get_Parent, ...).
Then you can send IOCTLs to the hub like UvcView and UsbView do.

Anyone else have alternatives for getting the USB speed from inside a
WinUSB client?

Thanks,
Philip

ADAC-Reaper wrote:
> Hello,
>
> I am trying to request device speed with the following code:
>
> WINUSB_INTERFACE_HANDLE WinUsbHandle;
> BOOL boolResult;
> ULONG length;
> UCHAR speed;
> length = sizeof(speed);
> boolResult = WinUsb_QueryDeviceInformation(WinUSbHandle, DEVICE_SPEED,
> &length, &speed);
>
>
>
> My Device is a USB 2.0 device with LowSpeed and FullSpeed transfer but no
> HighSpeed transfers.
> Whenever I request the device speed this function reports no error (TRUE ==
> boolResult) but the "speed" variable is set to LowSpeed (0x01), even when my
> device is working in FullSpeed mode. The UVCView tool what is inclulded in
> the WinDDK correctly displays the speed.
> In my testing program I also can request device descriptors an transfer data
> in bulk mode what somehow confuses me since this is allowed only for
> FullSpeed devices. Everythig I implemented is working except the device speed
> request.
> With my USB flash drive the QueryDevice Information returns HighSpeed what
> is correct in that case. Unfortunately I couldn't test it with a LowSpeed
> device.
> For initialisation i adhered to the HowTo (How to Use WinUSB to Communicate
> with a USB Device).
> I am using Visual Studio 2008 on Windows 7. My programming language is C++.
>
> I hope someone may help me.
>
> Thanks in advance.
> ADAC-Reaper.
From: ADAC-Reaper on
Hello and thank you for your reply!

Well, it's not that important for my application to see what speed my device
is working on. I just thought it would be nice to see at what speed the
device is working on. But for now it's just fine that Bulk transfer is acting
as it should do. I just began doubting about my application and my device.
However, I will pay attention to that on XP and Vista and maybe try out one
of the other ways you mentioned.

Thank you again for solving this.
Simon.


"Philip Ries [MSFT]" wrote:

> This appears to be a bug: the WinUsb_QueryDeviceInformation doc doesn't
> match WinUSB's functionality (at least in Win7). I will try to resolve
> that issue but for now, in my judgment, you shouldn't rely on the
> validity of any result other than HighSpeed.
>
> So you will need a different way to differentiate full speed from low speed.
>
> If your full speed and low speed devices have different device
> descriptors, you could use WinUsb_GetDescriptor. Another way would be
> to CreateFile on the device's parent hub (this can be made a little
> easier by reusing the HDEVINFO for the device, which you needed at
> initialization, and calling SetupDiEnumDeviceInfo, CM_Get_Parent, ...).
> Then you can send IOCTLs to the hub like UvcView and UsbView do.
>
> Anyone else have alternatives for getting the USB speed from inside a
> WinUSB client?
>
> Thanks,
> Philip
>
> ADAC-Reaper wrote:
> > Hello,
> >
> > I am trying to request device speed with the following code:
> >
> > WINUSB_INTERFACE_HANDLE WinUsbHandle;
> > BOOL boolResult;
> > ULONG length;
> > UCHAR speed;
> > length = sizeof(speed);
> > boolResult = WinUsb_QueryDeviceInformation(WinUSbHandle, DEVICE_SPEED,
> > &length, &speed);
> >
> >
> >
> > My Device is a USB 2.0 device with LowSpeed and FullSpeed transfer but no
> > HighSpeed transfers.
> > Whenever I request the device speed this function reports no error (TRUE ==
> > boolResult) but the "speed" variable is set to LowSpeed (0x01), even when my
> > device is working in FullSpeed mode. The UVCView tool what is inclulded in
> > the WinDDK correctly displays the speed.
> > In my testing program I also can request device descriptors an transfer data
> > in bulk mode what somehow confuses me since this is allowed only for
> > FullSpeed devices. Everythig I implemented is working except the device speed
> > request.
> > With my USB flash drive the QueryDevice Information returns HighSpeed what
> > is correct in that case. Unfortunately I couldn't test it with a LowSpeed
> > device.
> > For initialisation i adhered to the HowTo (How to Use WinUSB to Communicate
> > with a USB Device).
> > I am using Visual Studio 2008 on Windows 7. My programming language is C++.
> >
> > I hope someone may help me.
> >
> > Thanks in advance.
> > ADAC-Reaper.
> .
>