Smdn.IO.UsbHid.Abstractions
1.0.0
Prefix Reserved
dotnet add package Smdn.IO.UsbHid.Abstractions --version 1.0.0
NuGet\Install-Package Smdn.IO.UsbHid.Abstractions -Version 1.0.0
<PackageReference Include="Smdn.IO.UsbHid.Abstractions" Version="1.0.0" />
<PackageVersion Include="Smdn.IO.UsbHid.Abstractions" Version="1.0.0" />
<PackageReference Include="Smdn.IO.UsbHid.Abstractions" />
paket add Smdn.IO.UsbHid.Abstractions --version 1.0.0
#r "nuget: Smdn.IO.UsbHid.Abstractions, 1.0.0"
#:package Smdn.IO.UsbHid.Abstractions@1.0.0
#addin nuget:?package=Smdn.IO.UsbHid.Abstractions&version=1.0.0
#tool nuget:?package=Smdn.IO.UsbHid.Abstractions&version=1.0.0
Smdn.IO.UsbHid.Abstractions 1.0.0
Smdn.IO.UsbHid.Abstractions provides a unified and abstracted API for interacting with USB HID devices,
focusing on HID report I/O operations. It serves as a backend-agnostic foundation that allows applications
to switch between different hardware access implementations through dependency injection.
The following packages are available for the USB HID backend providers:
- Smdn.IO.UsbHid.Providers.HidSharp
- Smdn.IO.UsbHid.Providers.LibUsbDotNet
- Smdn.IO.UsbHid.Providers.LibUsbDotNetV3
Contributing
This project welcomes contributions, feedbacks and suggestions. You can contribute to this project by submitting Issues or Pull Requests on the GitHub repository.
API List
List of APIs exposed by assembly Smdn.IO.UsbHid.Abstractions-1.0.0 (net10.0)
// Smdn.IO.UsbHid.Abstractions.dll (Smdn.IO.UsbHid.Abstractions-1.0.0)
// Name: Smdn.IO.UsbHid.Abstractions
// AssemblyVersion: 1.0.0.0
// InformationalVersion: 1.0.0+b3fb489a540b6f3b09c308dcc0617ae282845a1e
// TargetFramework: .NETCoreApp,Version=v10.0
// Configuration: Release
// Metadata: IsTrimmable=True
// Metadata: RepositoryUrl=https://github.com/smdn/Smdn.IO.UsbHid
// Metadata: RepositoryBranch=main
// Metadata: RepositoryCommit=b3fb489a540b6f3b09c308dcc0617ae282845a1e
// Referenced assemblies:
// Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
// System.Collections, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.ComponentModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Linq, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
#nullable enable annotations
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Smdn.IO.UsbHid;
using Smdn.IO.UsbHid.Abstractions;
namespace Smdn.IO.UsbHid {
public interface IUsbHidDevice :
IAsyncDisposable,
IDisposable
{
int ProductId { get; }
int VendorId { get; }
IUsbHidEndPoint OpenEndPoint(bool openOutEndPoint, bool openInEndPoint, bool shouldDisposeDevice, CancellationToken cancellationToken);
ValueTask<IUsbHidEndPoint> OpenEndPointAsync(bool openOutEndPoint, bool openInEndPoint, bool shouldDisposeDevice, CancellationToken cancellationToken);
bool TryGetDeviceIdentifier([NotNullWhen(true)] out string? deviceIdentifier);
bool TryGetManufacturer([NotNullWhen(true)] out string? manufacturer);
bool TryGetProductName([NotNullWhen(true)] out string? productName);
bool TryGetSerialNumber([NotNullWhen(true)] out string? serialNumber);
}
public interface IUsbHidDevice<TUnderlyingDevice> : IUsbHidDevice where TUnderlyingDevice : notnull {
TUnderlyingDevice UnderlyingDevice { get; }
}
public interface IUsbHidEndPoint :
IAsyncDisposable,
IDisposable
{
bool CanRead { get; }
bool CanWrite { get; }
IUsbHidDevice Device { get; }
int Read(Span<byte> buffer, CancellationToken cancellationToken);
ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken);
void Write(ReadOnlySpan<byte> buffer, CancellationToken cancellationToken);
ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken);
}
public interface IUsbHidEndPoint<TUnderlyingReadEndPoint, TUnderlyingWriteEndPoint> : IUsbHidEndPoint {
TUnderlyingReadEndPoint ReadEndPoint { get; }
TUnderlyingWriteEndPoint WriteEndPoint { get; }
}
public interface IUsbHidService :
IAsyncDisposable,
IDisposable
{
IReadOnlyList<IUsbHidDevice> GetDevices(CancellationToken cancellationToken);
}
public static class IUsbHidDeviceExtensions {
public static IUsbHidEndPoint OpenEndPoint(this IUsbHidDevice device, CancellationToken cancellationToken = default) {}
public static IUsbHidEndPoint OpenEndPoint(this IUsbHidDevice device, bool shouldDisposeDevice) {}
public static IUsbHidEndPoint OpenEndPoint(this IUsbHidDevice device, bool shouldDisposeDevice, CancellationToken cancellationToken = default) {}
public static ValueTask<IUsbHidEndPoint> OpenEndPointAsync(this IUsbHidDevice device, CancellationToken cancellationToken = default) {}
public static ValueTask<IUsbHidEndPoint> OpenEndPointAsync(this IUsbHidDevice device, bool shouldDisposeDevice) {}
public static ValueTask<IUsbHidEndPoint> OpenEndPointAsync(this IUsbHidDevice device, bool shouldDisposeDevice, CancellationToken cancellationToken = default) {}
public static string ToIdentificationString(this IUsbHidDevice device) {}
}
public static class IUsbHidServiceExtensions {
public static IReadOnlyList<IUsbHidDevice> FindAllDevices(this IUsbHidService usbHidService, int? vendorId, int? productId, Predicate<IUsbHidDevice>? predicate = null, CancellationToken cancellationToken = default) {}
public static IReadOnlyList<IUsbHidDevice> FindAllDevices<TUnderlyingDevice>(this IUsbHidService usbHidService, int? vendorId, int? productId, Predicate<TUnderlyingDevice> predicate, CancellationToken cancellationToken = default) where TUnderlyingDevice : notnull {}
public static IUsbHidDevice? FindDevice(this IUsbHidService usbHidService, int? vendorId, int? productId, Predicate<IUsbHidDevice>? predicate = null, CancellationToken cancellationToken = default) {}
public static IUsbHidDevice? FindDevice<TUnderlyingDevice>(this IUsbHidService usbHidService, int? vendorId, int? productId, Predicate<TUnderlyingDevice> predicate, CancellationToken cancellationToken = default) where TUnderlyingDevice : notnull {}
public static IReadOnlyList<IUsbHidDevice> GetDevices(this IUsbHidService usbHidService, int? vendorId = null, int? productId = null, CancellationToken cancellationToken = default) {}
}
public class UsbHidException : InvalidOperationException {
public UsbHidException() {}
public UsbHidException(string? message) {}
public UsbHidException(string? message, Exception? innerException) {}
}
}
namespace Smdn.IO.UsbHid.Abstractions {
public sealed class NullUsbHidDevice : IUsbHidDevice<NullUsbHidUnderlyingDevice> {
public static NullUsbHidDevice Instance { get; } // = "Smdn.IO.UsbHid.Abstractions.NullUsbHidDevice"
public int ProductId { get; }
public NullUsbHidUnderlyingDevice UnderlyingDevice { get; }
public int VendorId { get; }
public void Dispose() {}
public ValueTask DisposeAsync() {}
public IUsbHidEndPoint OpenEndPoint(bool openOutEndPoint, bool openInEndPoint, bool shouldDisposeDevice, CancellationToken cancellationToken) {}
public ValueTask<IUsbHidEndPoint> OpenEndPointAsync(bool openOutEndPoint, bool openInEndPoint, bool shouldDisposeDevice, CancellationToken cancellationToken) {}
public bool TryGetDeviceIdentifier([NotNullWhen(true)] out string? deviceIdentifier) {}
public bool TryGetManufacturer([NotNullWhen(true)] out string? manufacturer) {}
public bool TryGetProductName([NotNullWhen(true)] out string? productName) {}
public bool TryGetSerialNumber([NotNullWhen(true)] out string? serialNumber) {}
}
public sealed class NullUsbHidEndPoint : IUsbHidEndPoint<NullUsbHidUnderlyingReadEndPoint, NullUsbHidUnderlyingWriteEndPoint> {
public static NullUsbHidEndPoint Instance { get; } // = "Smdn.IO.UsbHid.Abstractions.NullUsbHidEndPoint"
public bool CanRead { get; }
public bool CanWrite { get; }
public IUsbHidDevice Device { get; }
public NullUsbHidUnderlyingReadEndPoint ReadEndPoint { get; }
public NullUsbHidUnderlyingWriteEndPoint WriteEndPoint { get; }
public void Dispose() {}
public ValueTask DisposeAsync() {}
public int Read(Span<byte> buffer, CancellationToken cancellationToken = default) {}
public ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken = default) {}
public void Write(ReadOnlySpan<byte> buffer, CancellationToken cancellationToken = default) {}
public ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default) {}
}
public sealed class NullUsbHidUnderlyingDevice {
public static NullUsbHidUnderlyingDevice Instance { get; } // = "Smdn.IO.UsbHid.Abstractions.NullUsbHidUnderlyingDevice"
}
public sealed class NullUsbHidUnderlyingReadEndPoint {
public static NullUsbHidUnderlyingReadEndPoint Instance { get; } // = "Smdn.IO.UsbHid.Abstractions.NullUsbHidUnderlyingReadEndPoint"
}
public sealed class NullUsbHidUnderlyingWriteEndPoint {
public static NullUsbHidUnderlyingWriteEndPoint Instance { get; } // = "Smdn.IO.UsbHid.Abstractions.NullUsbHidUnderlyingWriteEndPoint"
}
}
namespace Smdn.IO.UsbHid.DependencyInjection {
public abstract class UsbHidServiceBuilder<TServiceKey> {
protected UsbHidServiceBuilder(IServiceCollection services, TServiceKey serviceKey, Func<TServiceKey, string?>? selectOptionsNameForServiceKey) {}
public TServiceKey ServiceKey { get; }
public IServiceCollection Services { get; }
public abstract IUsbHidService Build(IServiceProvider serviceProvider);
public virtual string? GetOptionsName() {}
}
}
// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.8.2.0.
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.6.2.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- Microsoft.Bcl.AsyncInterfaces (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.0)
- System.Memory (>= 4.5.4)
-
.NETStandard 2.0
- Microsoft.Bcl.AsyncInterfaces (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.0)
- System.Memory (>= 4.5.4)
-
.NETStandard 2.1
-
net10.0
-
net8.0
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Smdn.IO.UsbHid.Abstractions:
| Package | Downloads |
|---|---|
|
Smdn.IO.UsbHid.Providers.HidSharp
`Smdn.IO.UsbHid.Providers.HidSharp` is a backend provider for [Smdn.IO.UsbHid.Abstractions](https://www.nuget.org/packages/Smdn.IO.UsbHid.Abstractions) that utilizes the [HIDSharp](https://github.com/SeekHisKingdom/HIDSharp/) library for hardware communication. It enables applications using the `Smdn.IO.UsbHid.*` abstraction layer to operate on HID devices through the `HidSharp` implementation. |
|
|
Smdn.Devices.Mcp2221A
`Smdn.Devices.Mcp2221A` is a .NET library for the **Microchip Technology MCP2221 and MCP2221A, a USB2.0 to I2C/UART Protocol Converter with GPIO**. This library provides APIs that enable .NET applications to access the functions of the MCP2221/MCP2221A via the USB HID interface. |
|
|
Smdn.IO.UsbHid.Providers.LibUsbDotNet
`Smdn.IO.UsbHid.Providers.LibUsbDotNet` is a backend provider for [Smdn.IO.UsbHid.Abstractions](https://www.nuget.org/packages/Smdn.IO.UsbHid.Abstractions) that utilizes the [LibUsbDotNet v2](https://github.com/LibUsbDotNet/LibUsbDotNet) library for hardware communication. It enables applications using the `Smdn.IO.UsbHid.*` abstraction layer to operate on HID devices through the `LibUsbDotNet` implementation. |
|
|
Smdn.IO.UsbHid.Providers.LibUsbDotNetV3
`Smdn.IO.UsbHid.Providers.LibUsbDotNetV3` is a backend provider for [Smdn.IO.UsbHid.Abstractions](https://www.nuget.org/packages/Smdn.IO.UsbHid.Abstractions) that utilizes the [LibUsbDotNet v3](https://github.com/LibUsbDotNet/LibUsbDotNet) library for hardware communication. It enables applications using the `Smdn.IO.UsbHid.*` abstraction layer to operate on HID devices through the `LibUsbDotNet` implementation. To use this library, the native library `libusb-1.0` is required. Neither this package nor [LibUsbDotNet](https://www.nuget.org/packages/LibUsbDotNet) includes `libusb-1.0`. Therefore, please install `libusb-1.0` on your system or place it in the output directory of the executable file. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 718 | 4/11/2026 |
| 1.0.0-preview4 | 2,158 | 3/13/2026 |
| 1.0.0-preview3 | 274 | 3/8/2026 |
| 1.0.0-preview2 | 244 | 2/28/2026 |
| 1.0.0-preview1 | 285 | 2/23/2026 |
See the release notes for [Smdn.IO.UsbHid.Abstractions version 1.0.0](https://github.com/smdn/Smdn.IO.UsbHid/releases/tag/releases%2FSmdn.IO.UsbHid.Abstractions-1.0.0) on GitHub Releases.