Can I determine which USB port is being used?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Can I determine which USB port is being used?

5,957 次查看
JamesJukkola
Contributor I

If I connect a USB flash drive to either USBH1 or USBOTG, it shows up in Windows (WEC7) as a folder named "Hard Disk".  Is there a way for an application to determine which USB port "Hard Disk" is using?

标签 (2)
标记 (1)
0 项奖励
回复
3 回复数

1,160 次查看
ChrisWilliamson
Contributor III

Hi James,

In Windows 7, you can run Device Manager and select the Mass Storage device in the USB Controllers section and look at the Properties/Detail/Location to get something like Port_#0003.Hub_#0004.

I have worked with code that crawls through the registry and makes all kinds of undocumented Windows APIs to link a drive letter to a USB ID since Windows 98 days. Windows 7 was the first OS to at least show the location in Device Manager. Maybe there is a better way these day, but historically it is has been very difficult for an application to discern which USB port the device was running on.


- Chris

1,160 次查看
JamesJukkola
Contributor I

Hi Chris,

I want to do this in Windows Embedded Compact 7.  There is something called a Device Manager, but it does not have a user interface like the one in standard Windows 7.  I'm not sure what information I can get from it in my software.

James

0 项奖励
回复

1,160 次查看
ChrisWilliamson
Contributor III

Hi James,

I kind of figured you were talking about firmware, but wasn't sure. I can't say at all about WinCE myself, but I would suggest asking in a Microsoft forum maybe. Sorry I couldn't help, but would be great to know if you find a solution.

- Chris