Getting USB device details RRS feed

  • Question

  • I am looking into getting device details of a connected USB device using setupapi calls in C#/wpf. I am able to get the device path and get a handle to the device. Is it possible to get the name of the usb device( friendly name/ model name) using setup api calls?
    • Edited by its_me_here Thursday, May 25, 2017 11:47 PM
    • Moved by Bob Ding Tuesday, May 30, 2017 2:45 AM
    Thursday, May 25, 2017 11:47 PM

All replies

  • Hi,

    Are you sure you can get device details of a connected USB device using setupapi ? As far as I know, setupapi  only works on a installation process. The .NET Framework does not seem to be able to read USB device information directly. Look at these links.

    USB Device Registry Entries


    All hardware-related we can use C ++ to read.

    How to Access a USB Device by Using WinUSB Functions


    Working with USB devices in .NET and C#http://www.developerfusion.com/article/84338/making-usb-c-friendly/

    And You can get device information by using Windows SDK API. Refer the following article.

    Writing apps for USB devices (Windows Store apps using C#/VB/C++)


    This forum is discussing and asking questions about how to use XAML technologies. Your post will be move to off-topic forum.

    And I suggest you read the following article which can lead you ask a good question in MSDN forum.


    Best Regards,


    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.

    • Edited by Bob Ding Tuesday, May 30, 2017 2:41 AM
    Friday, May 26, 2017 2:18 AM
  • Yes this is not a WPF question. WPF is essentially just for a UI. Features such as accessing hardware would be something such as .Net. I don't know if .Net can do what you need to do but if not then this question should be in the Windows API (whatever it is now called) forum.

    Many years ago I tried to interface with a Garmin GPS device. I was surprised that the necessary API, at least some of it, was in an unexpected place; probably the Setup API as you say. I am sure that if you search then you will find samples of using the Setup API to get USB information.

    I am surprised that a Microsoft representative is suggesting use of the registry. That might be the only way to get the information but usually Microsoft provides functions to do things that are less likely to change.

    If it were me, I would search the MSDN and the internet. As I said, I attempted to interface with a GPS device. The Garmin documentation was lousy. I even used Microsoft Detours to attempt to determine what Garmin does.

    My guess is that there is sample code you can use, such as in GitHub and/or CodePlex (CodePlex is closing). I know there is a "CustomUsbDeviceAccess" sample for UWP.

    Sam Hobbs

    Friday, May 26, 2017 8:34 PM
  • Thank you, Sam.
    Wednesday, May 31, 2017 9:46 AM