HidApi.Net 1.0.2

dotnet add package HidApi.Net --version 1.0.2
NuGet\Install-Package HidApi.Net -Version 1.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HidApi.Net" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HidApi.Net --version 1.0.2
#r "nuget: HidApi.Net, 1.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install HidApi.Net as a Cake Addin
#addin nuget:?package=HidApi.Net&version=1.0.2

// Install HidApi.Net as a Cake Tool
#tool nuget:?package=HidApi.Net&version=1.0.2

HidApi.Net

Build StatusNuGetLicense (MIT)

Welcome to HidApi.Net a modern cross platform C# binding for the C HIDAPI library. Supported platforms are Linux, OSX and Windows.

Supported HIDAPI version: Up to 0.14

Use

To use the library please reference the nuget package in your project. Additionally it is required to either ensure that HIDAPI is available on the host system or is distributed as part of your application.

To get an overview of the API please refer to the API documentation.

Code sample

You can use the Hid class to enumerate over devices or directly use the device class to connect to a known device:

foreach(var deviceInfo in Hid.Enumerate())
{
    using var device = deviceInfo.ConnectToDevice();
    Console.WriteLine(device.GetManufacturer());
}
Hid.Exit(); //Call at the end of your program
var device = new Device(0x00, 0x00); //Fill vendor id and product id
Console.WriteLine(device.GetManufacturer());
Hid.Exit(); //Call at the end of your program

Linux

In order to access HID devices as an unprivileged user an udev rule must be installed on the host system. Please refer to the sample udev file of the HIDAPI project.

Native AOT

If the application targets at least .NET 8 the nuget package allows applications to be published as Native AOT as itself is AOT compatible.

Build

To build the solution locally execute the following commands:

$ git clone https://github.com/badcel/HidApi.Net.git
$ cd HidApi.Net/src
$ dotnet build

Licensing terms

HidApi.Net is licensed under the terms of the MIT-License. Please see the license file for further information.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on HidApi.Net:

Package Downloads
Zenon.Wallet.Ledger

Ledger wallet for the Zenon .NET SDK

Arendi.DotNETLibrary.Serial.Hidapi.Net The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Arendi.DotNETLibrary - Serial communication extension for Hidapi.Net

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on HidApi.Net:

Repository Stars
maker-community/ElectronBot.DotNet
一个为ElectronBot机器人和瀚文键盘(HelloWorldKeyboard)开发的上位机软件(包含机器人USB操作SDK和瀚文键盘HID操作SDK),采用Windows App SDK框架编写界面。 A host computer software developed for ElectronBot robots (including robot USB operation SDK), using the Windows App SDK framework to write UI.
Version Downloads Last updated
1.0.2 841 2/24/2024
1.0.1 323 1/13/2024
1.0.0 1,016 11/25/2023
0.4.0 1,279 5/31/2023
0.3.0 526 2/17/2023
0.2.1 331 12/17/2022
0.2.0 376 10/27/2022
0.1.1 432 10/9/2022
0.1.0 380 10/7/2022