0

I'll try to keep this simple.
I have a hub connected to my PC. This hub has several USB interfaces. I'm listening to WM_DEVICECHANGE event and I get the USB interface path. How can I know what port it was connected to? Looking for a non-WMI solution in c++ or c# for a windows environment.

I tried using IOCTL_USB_GET_NODE_CONNECTION_NAME with USB_NODE_CONNECTION_NAME (where USB_NODE_CONNECTION_NAME.NodeName will hold the path to the device) but this only works if the device connected to the port is a hub as well.

Any help will be much appreciated.

Tsef
  • 1,018
  • 9
  • 22

1 Answers1

0

The primary issue in C++ is that there is no standard functions for detecting USB ports.

USB Port identification and implementation is a platform specific issue. For example, Linux handles USB ports quite differently than Windows and many embedded systems don't have USB ports.

So you'll have to look for a 3rd party library or find some OS API to use for your platform.

Thomas Matthews
  • 56,849
  • 17
  • 98
  • 154