February 18th, 2013, 04:40 PM
Identifying physcal USB slot an USB device is attached to
I have an applicattion in Windows 7 that uses two USB handsets plugged to specific physical external USB slots in a PC (eg: the left side USB slot and the right-side USB slot in a tablet).
The application needs to handle differently those handsets, based on the physical external USB slots they are plugged in. So far I have got to discover Location Information via SetupDiGetDeviceRegistryProperty() with parameter SPDRP_LOCATION_INFORMATION.
That gives me a string like "Port_#0004_Hub_#0006" that i can MANUALLY AND BY INSPECTION associate with external physical USB slots for a given hardware system. But that isn't very reliable and persistent, since it varies with many things like Windows version installed, variability between units of the same model of PC, etc.
Is there a consistent procedure of identification that is :
1. stable across restarts of the system
2. stable across installations of new devices, Windows or drivers updates, or reinstallations of Windows. 3. stable across plugging of additional USB
4. stable across different units of the same computer model
I have been warned by some knowledgeable guys that this is unachievable, but i still hope a better luck!
Many thanks for any help.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.