.NET API for HID (USB)?
Solution 1
HidLibrary wraps up all the P/Invoke calls for you. But no, it doesn't look there are any nice framework APIs for dealing with USB devices.
Solution 2
Here's mine little library for dealing with HID devices.
It might be useful, especially when you are trying to communicate using raw HID reports. I've also included a simple demonstration of how to use it.
Solution 3
There's nothing direct or high-level. There are some things you can do through the managed WMI API, but I've personally found a lot of WMI interaction with hardware to be cryptic at best and requiring a lot of trial-and-error to get it to do what you want.
Someone on The Code Project has developed a .NET component for USB HID you can try out that's probably going to fit the bill better than WMI.
Solution 4
I would suggest you follow this example instead. It was invaluable in getting me up and running with HiD dev in C#.
Solution 5
Take a look at this library on Google Code:
Related videos on Youtube
jco
Updated on July 09, 2022Comments
-
jco almost 2 years
Is there an API in .NET (C#) for using USB HID (human interface) devices?
-
Morten Frederiksen about 12 yearsDuplate question: stackoverflow.com/questions/68749/…
-
Prasanga over 11 yearsNot totally a duplicate -- this question deals with HID (which I'm assuming means "driverless" HID), so the answers to the other question don't all apply to this one.
-
Robetto about 8 yearsNo - HID actually means all existing or yet not invented devices that humans may interact with or not interact soo much. Let it be a temp sensor or a button or a colorimeter. Some data in, some out (low amounts)
-
Christian Findlay over 5 yearsYep. github.com/MelbourneDeveloper/Hid.Net . It supports .Net Core, Framework, Android, and UWP.
-
-
jco almost 14 yearsWhy? A Nintendo Wiimote library!?
-
squig almost 14 yearsBecause the Wiimote is a HID device under windows, and that codeplex project has all the p/Invoke work needed to communicate with a HID device from the CLR done for you in the HDImports class
-
Dark Star1 almost 14 yearsThis doesn't answer the question.
-
ptrandem over 11 years+1 for HidLibrary; I was starting to go down the road of rolling my own C# wrapper lib for the kernal32 and hid.dlls. HidLibrary has already done the hard work (mostly) and provides a clean, simple API at that. Got me up and running amazingly fast (like, minutes). And you can install it with nuget, which is nice. There are other c# hid.dll wrapper libs out there, but nothing quite so clean that I've seen.
-
Saw almost 11 yearsIt is very unstable, especially on Win7
-
tarabyte almost 10 yearsThat library is no longer supported.
-
Christian Findlay over 5 yearsHidLibrary is Windows only. Device.Net supports Hid and USB on Android, Windows, and UWP. github.com/MelbourneDeveloper/Device.Net