none
Check Particular USB Port for DeviceID/Name RRS feed

  • Question

  • I'm trying to create a small program, either in VB.net, or C#, even a simple C++ program would do me, but preferably in VB or C# as that's what I'm familiar with. I need to check if a device is connected to a particular USB port on the back (motherboard) of the system. This is because the third party software on the system will only work with devices connected to the correct USB ports. My software really only has to confirm which device is connected to each USB ports for troubleshooting purposes.

    How is this possible, I've been stuck on this for a few days and tried everything from WMI to this long C# application, but I've been unable to query specific USB ports on the system, or even return results that can be linked to particular USB ports. Any code snippets would be highly appreciated. 

    Tuesday, July 4, 2017 10:16 PM

All replies

  •  I need to check if a device is connected to a particular USB port on the back (motherboard) of the system. This is because the third party software on the system will only work with devices connected to the correct USB ports. My software really only has to confirm which device is connected to each USB ports for troubleshooting purposes.

    Hi Darkest,

    It may depend on the device.

    In some cases, DSR (SerialPort.DsrHolding) or even CTS (SerialPort.CtsHolding) will be raised when the device is connected.

    But in some cases you may only have Tx / Rx connected, and the only way to tell is to attempt to communicate with the device.

    If it's a special device then it will be supplied with a driver and possibly an API that you connect to using the speciic protocols of that interface.

    You need to look at the documentation for your device.

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, July 6, 2017 3:03 AM
    Moderator
  • This is because the third party software on the system will only work with devices connected to the correct USB ports.

    What exactly does this software require for the USB port?  There is no standard for identifying particular USB ports because they could be configured in a large number of different ways, using different busses, through any configuration of controllers.

    There is a utility described here that seems to have come from the MS WDK here.  It seems that the code in the WDK works, but putting it together will be difficult.   It might be possible to use that utility with some sort of automation.

    Otherwise, you should consider working the other way around - is the device connected to the correct USB port?  That information should be available through the device information, and it is usually much easier to find what devices are installed, and how they are connected, than to find what's connected to any specific USB port.  That would require details of the device, and details of what information is available through the device driver.

    Thursday, July 6, 2017 4:15 AM
  • Hi Darkest,

    Please remember to close your thread by marking the helpful post as answer, it is very beneficial to other community members who face the same issue.

    Thanks for your understanding.

    Best regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, July 19, 2017 6:39 AM
    Moderator