HidApi.Net
1.0.4
See the version list below for details.
dotnet add package HidApi.Net --version 1.0.4
NuGet\Install-Package HidApi.Net -Version 1.0.4
<PackageReference Include="HidApi.Net" Version="1.0.4" />
paket add HidApi.Net --version 1.0.4
#r "nuget: HidApi.Net, 1.0.4"
// Install HidApi.Net as a Cake Addin #addin nuget:?package=HidApi.Net&version=1.0.4 // Install HidApi.Net as a Cake Tool #tool nuget:?package=HidApi.Net&version=1.0.4
HidApi.Net
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 | Versions 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. |
-
net6.0
- WCharT.Net (>= 0.1.2)
-
net7.0
- WCharT.Net (>= 0.1.2)
-
net8.0
- WCharT.Net (>= 0.1.2)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on HidApi.Net:
Package | Downloads |
---|---|
Arendi.DotNETLibrary.Serial.Hidapi.Net
Arendi.DotNETLibrary - Serial communication extension for Hidapi.Net |
|
Zenon.Wallet.Ledger
Ledger wallet for the Zenon .NET SDK |
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.
|