How to tell which port a USB device is plugged into?

Posted by Ted N on Stack Overflow See other posts from Stack Overflow or by Ted N
Published on 2010-05-06T18:15:02Z Indexed on 2010/05/06 18:18 UTC
Read the original article Hit count: 158

Filed under:
|

My c# app must manage multiple USB devices which are the identical product from the same manufacturer.

If the user plugs 3 of my devices in, and then unplugs one of them, I need to know which of the 3 devices was unplugged.

However, when I register the devices and receive the WM_DEVICECHANGE notifications, the data returned from the DBT_DEVTYP_DEVICEINTERFACE is identical for each of the devices.

If I could get the USB port info when the devices arrive or are removed it would solve my problem, but I can't find a way to do this.

Any suggestions?

© Stack Overflow or respective owner

Related posts about usb

Related posts about port