none
Mass storage device identification in a particular USB port RRS feed

  • Question

  • Hi Team,

    We are using wince 6.0 and freescale imx51.Our system consists of 3 USB port.  It is required us to identify/distinguish this a particular mass storage device. 

    For example : I have 1 USB Hard disk and 2 USB mass storage cards. Suppose If connected the USB hard disk firstly, then it will be exposed as " HardDisk1" and other 2 USB Sticks as "HardDisk2"  and "HardDisk3" . But if i Connected the 2 USB Sticks to the device firslty, then they will be exposed as "HardDisk1" and "HardDisk2" and if i connectd the USB Harddisk after that it will be mounted as "HardDisk3".

    My requirement is to identify  particular device is connected to which port. Is there any mechanism available

    Pls help me to identify this particular device.

    Your help will be gratly appreciated.

    Regards,

    Wince User

    Friday, September 16, 2011 6:04 AM

Answers

  • I think there's nothing ready to do it. If you have access to the USB host controller driver source code you can modify it to track what (in terms of USB device ID and vendor ID) is connected to a specific port. You can then implement a custom IOCTL to retrieve such information whan you detect an USB mass storage device insertion: about this last topic see Bruce Eitman's blog: http://geekswithblogs.net/BruceEitman/archive/2008/06/13/windows-ce-monitoring-for-disk-insertion-to-add-support-for.aspx

     


    Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.com
    • Marked as answer by new_user_wince Monday, September 19, 2011 8:15 AM
    Friday, September 16, 2011 1:51 PM
  • As Luca said, the CE USB MSC driver unfortunately does not provide too much info regard to the device id. Besides to alter HCD driver, another solution is to modify Mass Storage Class driver and supposes to be a more platform neutral approach.
    For a regular USB class driver, it calls LPGET_DEVICE_INFO (http://msdn.microsoft.com/en-us/library/ee484661.aspx) in its USBDeviceAttach to obtain the necessary info in order to attach and configure the device.
    This function returns USB_DEVICE which contains USB_DEVICE_DESCRIPTOR (http://msdn.microsoft.com/en-us/library/ee483872.aspx) and provides many useful identification fields, such as Vendor, Product IDs and even serial number.
    The corresponding code in MSC can be found in public\common\oak\drivers\usb\class\storage\class\usbmsc.c.
    There is a function, ParseUsbDescriptors, which retrieves USB_DEVICE_DESCRIPTOR and mainly for configuration count.
    It is possible to alter the code, so we can use VID, PID or even the SN to create an unique device ID. Then implements IOCTL_DISK_GET_STORAGEID (http://msdn.microsoft.com/en-us/library/ee484802.aspx) to expose the ID to user application.
    • Marked as answer by new_user_wince Monday, September 19, 2011 8:15 AM
    Sunday, September 18, 2011 5:01 AM

All replies

  • I think there's nothing ready to do it. If you have access to the USB host controller driver source code you can modify it to track what (in terms of USB device ID and vendor ID) is connected to a specific port. You can then implement a custom IOCTL to retrieve such information whan you detect an USB mass storage device insertion: about this last topic see Bruce Eitman's blog: http://geekswithblogs.net/BruceEitman/archive/2008/06/13/windows-ce-monitoring-for-disk-insertion-to-add-support-for.aspx

     


    Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.com
    • Marked as answer by new_user_wince Monday, September 19, 2011 8:15 AM
    Friday, September 16, 2011 1:51 PM
  • As Luca said, the CE USB MSC driver unfortunately does not provide too much info regard to the device id. Besides to alter HCD driver, another solution is to modify Mass Storage Class driver and supposes to be a more platform neutral approach.
    For a regular USB class driver, it calls LPGET_DEVICE_INFO (http://msdn.microsoft.com/en-us/library/ee484661.aspx) in its USBDeviceAttach to obtain the necessary info in order to attach and configure the device.
    This function returns USB_DEVICE which contains USB_DEVICE_DESCRIPTOR (http://msdn.microsoft.com/en-us/library/ee483872.aspx) and provides many useful identification fields, such as Vendor, Product IDs and even serial number.
    The corresponding code in MSC can be found in public\common\oak\drivers\usb\class\storage\class\usbmsc.c.
    There is a function, ParseUsbDescriptors, which retrieves USB_DEVICE_DESCRIPTOR and mainly for configuration count.
    It is possible to alter the code, so we can use VID, PID or even the SN to create an unique device ID. Then implements IOCTL_DISK_GET_STORAGEID (http://msdn.microsoft.com/en-us/library/ee484802.aspx) to expose the ID to user application.
    • Marked as answer by new_user_wince Monday, September 19, 2011 8:15 AM
    Sunday, September 18, 2011 5:01 AM
  • HI Luca and KMOS,

    Thank you very much for your valuable information. I am proceeding with your comments.

    Regards,

    Wince User

    Monday, September 19, 2011 8:15 AM