开发者

Path to a USB Device in Windows

I would be using a USB hub to connect multiple devices. I want to fix a specific USB device to a particular slot. Then check if it is done properly.

The way I am planning to achieve this is to get the complete USB path like

PCIROOT(0)#PCI(1D00)#USBROOT(0)#USB(1)开发者_运维问答#USB(2)#USB(3)#USB(3)

I can get this particular string in w7 via device property but the same is not available in wXP.


You can build this path by using the SetupAPI.

The device manager is built with this.

You start with CM_Locate_DevNode and enumerate children with CM_Get_Child.


I strongly advise you against what you're planning to do. AFAIK a USB device MUST function regardless on the USB port it's plugged in. If you'll creating such a device, forget e.g. about the "Certified for Windows" logo.

Just handle WM_DEVICECHANGE message, then use e.g. WMI to search for the USB device you're interested in. Here's my article about it: that time I coded C# language, however WMI has C++ API as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜