What is the best usb library to communicate with usb HID devices on Windows?

独自空忆成欢 提交于 2019-11-29 23:09:33
Femi

Take a look at hidapi: it is C, which answers the C++ bindings question (effectively :)), is cross platform and has a very permissive license. Doesn't appear to have the callbacks, but...

If libhid works for you, then perhaps the thing to do would be to write an app (which you would GPL), which uses libhid to talk to devices, then provides whatever you need via a TCP connection. Your real app would connect via TCP to do what it needs. This would obviously be a massive performance hit.

This app would effectively be a 'shim' between libhid and your app. In this case, the shim would exist for legal, not technical reasons.

I'm not saying it's a good idea, just that it's an idea.

HIDmaker software suite from Trace systems is an option.

Pros: - Easy to use (Excelent for learning how to program for USB HID) - Generates working applications source code in a various project formats (Visual Studio, Borland) - Generates stable example code for both host and device (stable in my experience) - High performance (if HID can even be said to have high performance in the first place)

Cons: - Only works on Microsoft Windows - Uses it's own USB library I think (ActiveX)

Consider rolling your own. You'll have total control over the interface, the level of platform independence, and such. Even though a project is GPL, you can use it as a recipe for your own, and as a testbed to find issues with your own.

Potter

There are several USB HID Host drivers for Windows. An easy to use Dynamic Link Library is from http://embedded24.net. There are also several example applications included for Visual Studio 2010 (C++, C# and VB).

Coderer

Look at this code:

http://geekswithblogs.net/tamir/archive/2008/12/30/read-and-use-fm-radio-or-any-other-usb-hid.aspx

It gives you some simple classes to talk to a HID device. What it boils down to is, get the alias for the device (something like \?\HID#Vid_nnnn&Pid_nnn#.......) and use CreateFile to open it. You can get the device's alias under HKML\SYSTEM\CCS\Control\DeviceClasses{4d1e55...}\

The Vid and Pid are the vendor ID and product ID of the device (check Device Manager).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!