none
Map flash disk volume to USB hub port number RRS feed

  • Question

  • Hi,

    I'm trying to write a game using USB flash disks as "keys", were players must find the right key (identified by volume label) to plugin into port 1,2,3 or 4 of a USB hub. 

    I am struggling to find a way to map the volume (and it's label) to the USB port number it is connected to. I can enumerate all the USB devices (USBView style), but haven't found a way to determine the mount point for devices plugged into a port. I can map the logical device to the physical device (using DeviceIoControl and IOCTL_STORAGE_GET_DEVICE_NUMBER), but the physical device doesn't let me query for the property SPDRP_LOCATION_INFORMATION.

    Any insight would be helpful and example code if possible.


    Saturday, May 19, 2018 6:57 AM

All replies

  • You can use config manager APIs (CM_xxx) to walk up the tree until you reach a hub...BUT the hub port number reported by the hardware can have no correlation to the physical ordering of the ports on the hub, IOW port zero can be the physical middle port on the hub. Or not exposed to the user at all.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Saturday, May 19, 2018 3:00 PM