f



USB 1.1 and USB 2.0

Dear all,

Could I use a win32 function to get the USB port is suport USB 1.1 or
USB 2.0?
I want to write a program to access the USB devices and show them is in
the USB 1.1 or USB 2.0.
Could everyone help me to find the function call?
Or where I can find any relative information?
Thanks.

---Ted

0
ted
12/7/2005 8:33:51 AM
comp.os.programmer.win32 14523 articles. 0 followers. Post Follow

9 Replies
553 Views

Similar Articles

[PageSpeed] 55

Hi,

Well, removable ms-dos devices such as USBs can be accessed through the
\\\\.\\PhysicalDrive#. Call the API QueryDosDevice(), and get a list of
all existing MS-DOS device names. You can also use the function
DefineDosDevice() to define the device name as well.

That said, when the function returns the listing if the devices, you
can use each of those strings in another call to the function, to get
the device name which is the physical mapping for each device.

char logical [2048];
char physical[1024];

	QueryDosDevice(NULL, logical, sizeof(logical));
	for (char *pos = buffer; *pos; pos+=strlen(pos)+1)
	QueryDosDevice(pos, physical, sizeof(physical));
	return 0;

Take a look at this article from microSoft, it has a sample program
that shows how to use these two functions:

http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B235128

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/querydosdevice.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/definedosdevice.asp

Hope these information helps,

Kellie.

0
Kellie
12/7/2005 9:19:52 AM
Thanks for your help.
I can get the devices list now.
But how can I know the USB device is supported in USB 1.1 or in USB
2.0.
Or my local machine can supply the USB 2.0.
Thanks.

---Ted

0
ted
12/8/2005 3:25:09 AM
Hi,

Well, I am not quite clear on what you are asking, but if you
want to know the hardWare capabilities of your machine, such as
supporting USB device version 1.1 or 2.0, you can check the
motherBoard's bios setting or the device manager module in the
control panel.

Kellie.

0
Kellie
12/8/2005 4:20:24 PM
Dear Kelie,

Yes, you are right.
Sorry, I cannot descript my program very clearly.
I want to write a program to show customer the plug-in flash disk is
runing in USB1.1 or USB2.0.
Because some PC supply USB 2.0 port, some flash disk just support
USB1.1.
So when the customer use the USB 1.1 flash disk, I must show "the USB
port is running in USB1.1 mode".
Another, if the PC's hardware just support the USB1.1, I have to show
the same message.
The other I have to show "the USB port is running in USB2.0 mode".
I cannot do anything about this issue.
Would you lead me to find any method to get this solution?
Or any win32 API can work?
Thank a lots.

---Ted

0
ted
12/12/2005 2:02:37 AM
Hi,

Well, if you have the WMI (Windows Management Instrumentation),
you can use the following classes to detect the version of the
installed USB port along with device general information:

	Win32_USBHub
	Win32_USBController
	Win32_USBControllerDevice
	Win32_PnPEntity

Also, if you have the DDK (Device Drivers Kit), you can write
hardWare drivers to poll the USB port, and retrieve the needed
information regarding their version number and what not, try
to post your question in the device drivers newsGroup, they
can point you in the right direction and help you out with
the low level programming that you need as well.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_usbhub.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_usbcontroller.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_usbcontrollerdevice.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_pnpentity.asp

Good luck,

Kellie.

0
Kellie
12/12/2005 9:29:09 AM
Dear Kelie,

Thanks a lot.
But I cannot find the Win32_USBHub class in my computer.
My system is win2K SP4.
I use the wbemtest.exe to connect the /root/cimv2 to find the class.
I can find the Win32_USB controller, Win32_USBControllerDevice.
But I cannot find the Win32_USBHub class.

I read the WMISDK.Chm, I can find the Win32_USBHub class.

I try to write a script file to get the WMI class, but it shows me
error "NULL".
( I can read the other classes.)
Did this class support in some OS?
Thanks.

Best regards
Ted



Kellie Fitton wrote:
> Hi,
>
> Well, if you have the WMI (Windows Management Instrumentation),
> you can use the following classes to detect the version of the
> installed USB port along with device general information:
>
> 	Win32_USBHub
> 	Win32_USBController
> 	Win32_USBControllerDevice
> 	Win32_PnPEntity
>
> Also, if you have the DDK (Device Drivers Kit), you can write
> hardWare drivers to poll the USB port, and retrieve the needed
> information regarding their version number and what not, try
> to post your question in the device drivers newsGroup, they
> can point you in the right direction and help you out with
> the low level programming that you need as well.
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_usbhub.asp
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_usbcontroller.asp
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_usbcontrollerdevice.asp
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_pnpentity.asp
> 
> Good luck,
> 
> Kellie.

0
ted
12/14/2005 7:16:01 AM
Hi,

According to microSoft's documentation, you need Windows XP or above to
use the
WMI class Win32_USBHub, try to read the link provided above for more
information.

Kellie.

0
Kellie
12/14/2005 11:46:42 AM
Hi,

According to microSoft's documentation, you need Windows XP or above to
use the
WMI class Win32_USBHub, try to read the link provided above for more
information.

Kellie.

0
Kellie
12/14/2005 12:03:29 PM
Hi!

So I cannot solve this issue in the OS system, win2K SP4.
Because I cannot get the Win32_USBHub in it.
It is a limitation, isn't it?
I think it is hard for me to solve this issue.
Thanks

Ted

0
ted
12/19/2005 12:30:26 PM
Reply: