Skip to content

trowbridgec1/UsbInfo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UsbInfo

This library can get USB device information in .NET.

Nuget

Overview

The UsbInfo class can find a list of IUsbDevice class by specifying the vendor ID, product ID or by scanning the root hub list.

Supprots

  • USB3.0 device
  • Serial number
  • PortNo
  • Device name

Sample

Scanned dump from USB root hub.

[Fact]
public void TestDumpDevice()
{
    var usbRootHub = UsbInfo.RootHubs();
    foreach (var rootHub in usbRootHub)
    {
        _output.WriteLine("RootHub");
        DumpDevice(rootHub.ConnectedDevices);
    }
}

private void DumpDevice(IEnumerable<IUsbDevice> devices)
{
    foreach (var usbDevice in devices)
    {
        var deviceDescription = usbDevice.DeviceDescription;
        var portNo = usbDevice.PortNo;
        var vendorId = usbDevice.VendorId;
        var productId = usbDevice.ProductId;
        var supportSpeed = usbDevice.SupportSpeed;
        var currentUsbDevice = usbDevice.CurrentUsbDevice;
        var deviceKey = usbDevice.DeviceKey;
        var devicePath = usbDevice.DevicePath;
        var serialNumber = usbDevice.SerialNumber;
        DumpDevice(usbDevice.ConnectedDevices);
    }
}

NuGet

UsbInfo

License

This library is under the MIT License.

About

This library can get usb device infomation in .NET.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%