Reputation: 153
I'm trying to capture video from usb webcam, what is connected to a certain usb port (I have many same cameras connected). I have a code that makes USB Device Path for all webcams. I have something like:
\\?\usb#vid_0c45&pid_614a#5&18f54cb7&0&2#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global
Where: 5&18f54cb7&0&2 - USB serial string. I cant use pid and vid because I have other same webcams.
How can I get usb port and hub knowing USB serial?
Upvotes: 1
Views: 1680
Reputation: 180050
The hub is the parent of the webcam, so you find it via SetupDiGetDeviceProperty
property DEVPKEY_Device_Parent
. USB port is DEVPKEY_Device_LocationInfo
.
Upvotes: 1