Skip to content

About

WinUSB .NET wrapper library

Resources

Stars

27 stars

Watchers

2 watching

Forks

Repository files navigation

Nefarius.Drivers.WinUSB

.NET .NET Standard 2.0 .NET 4.7.2 .NET 4.8 .NET 6/7/8/10 NuGet Version NuGet

Managed wrapper for the WinUSB APIs on Microsoft Windows.

The package includes assets for .NET Standard 2.0, .NET 6/7/8/10 (Windows), and .NET Framework 4.7.2/4.8. Referencing it from a generic TFM such as net10.0 selects the .NET Standard 2.0 compatibility asset and avoids NU1701. Runtime use is still Windows-only: invoking WinUSB APIs outside Windows is unsupported and will fail.

.NET Framework 4.7.2 or later is the recommended Framework target. .NET Framework 4.7.1 can consume the .NET Standard 2.0 asset, but is not a first-class supported runtime.

This is a fork of the fantastic WinUSBNet project by Thomas Bleeker and contributors.

Changes of this fork

  • Replaced P/Invoke code with source generators
  • Changed namespace to Nefarius.Drivers.WinUSB to avoid conflicts with the origin library
  • Removed device notification listener as my other lib Nefarius.Utilities.DeviceManagement provides a drop-in replacement without depending on WinForms or WPF
  • Added USBDevice::GetSingleDeviceByPath to allow opening a WinUSB device via device path (symbolic link)

Documentation

Link to API docs.

Generating documentation

  • dotnet build -c:Release
  • dotnet tool install -g Nefarius.Tools.XMLDoc2Markdown
  • xmldoc2md .\bin\net8.0-windows\Nefarius.Drivers.WinUSB.dll .\docs\

TO-DOs

  • Migrate all buffers to Spans where possible
  • More/better tests 😇

Features

Taken verbatim from the source repository.

  • MIT licensed with C# source code available (free for both personal and commercial use)
  • CLS compliant library (usable from all .NET languages such as C#, VB.NET and C++.NET)
  • Synchronous and asynchronous data transfers
  • Support for 32-bit and 64-bit Windows versions
  • Support for multiple interfaces and endpoints
  • Intellisense documentation

Related documentation

About

WinUSB .NET wrapper library

Resources

Stars

27 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages