Vurdalakov edited this page Apr 19, 2016 · 4 revisions

Welcome to the UsbDevices project

The purpose of this project is to create a C# class library that is able to enumerate all USB devices, hubs and controllers attached to local computer using Setup API and provide access to USB properties and events.

What's inside

UsbDevicesDotNet is a .NET class library that uses Setup API to enumerate all USB devices, hubs and controllers attached to local computer. It also provides easy access to USB properties and events.

UsbDevices is a simple command line program that demonstrates usage of UsbDevicesDotNet class library.

UsbDevicesViewer is a WPF UI application that shows all available USB devices, hubs and controllers, all their properties, USB events and a system USB devices tree. It also uses UsbDevicesDotNet class library.

Code example

UsbDevice[] usbDevices = UsbDevice.GetDevices(new Guid("A5DCBF10-6530-11D2-901F-00C04FB951ED"));

Console.WriteLine("{0} USB devices:\n", usbDevices.Length);

foreach (UsbDevice usbDevice in usbDevices)
{
    Console.WriteLine("{0}:{1} = VID_{2}&PID_{3} = {4}",
        usbDevice.Hub, usbDevice.Port, usbDevice.Vid, usbDevice.Pid, usbDevice.DeviceId);

    if (!String.IsNullOrEmpty(usbDevice.BusReportedDeviceDescription))
    {
        Console.WriteLine("{0}", usbDevice.BusReportedDeviceDescription);
    }
}
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.