Reputation: 175
I've got a microcontroller unit and I need to connect it to PC via USB. I've already created its HID descriptor and it's up and running on Windows but I need a C#/WPF application to communicate with it (Read/Write). There's no built-in library for USB in C# (.NET) so I searched the web long enough but can't find a way to perform this task. I found many solutions on Github but they don't seem to work with me. Could anyone help me with a USB library that's straightforward and easy to use? Thanks very much in advance.
Upvotes: 0
Views: 4389
Reputation: 184
I recommend checking out this library https://archive.codeplex.com/?p=simplehidlibrary This one has a demo app and also references other solutions for communicating with HID devices.
If these don't work for you, you can still write your own implementation using P/Invoke based on official HID API documentation from Microsoft: https://learn.microsoft.com/en-us/windows-hardware/drivers/hid/introduction-to-hid-concepts
Happy hacking!
Update for 2024: Since the original response is about 4 years old now, the original link I posted doesn't work anymore. The lib is still available here - http://www.java2s.com/Open-Source/CSharp_Free_Code/DotNet_Assembly/Download_Simple_HID_Library.htm However, it may be a good time to look at a different library like https://github.com/mikeobrien/HidLibrary with almost 6 hundred stars and 3 hundred forks on GitHub.
Upvotes: 1