[libhid-discuss] libhid + swig -> c#

Peter Stuge peter at stuge.se
Sun Apr 10 14:46:56 UTC 2011

Rudolf Muehlbauer wrote:
> I will try to write the HID code in C# with LibUsbDotNet

I'd strongly recommend using HIDAPI instead.

Xiaofan Chen wrote:
> The main issue if you want to use libusb-1.0 with HID device
> is when you want to have cross-platform capability.

Indeed. There must always be a helpful kernel driver for libusb, and
as Xiaofan points out it's no longer possible to "blacklist" a HID
class device so that the Mac OS X HID kernel driver (which by
definition can not support libusb) will not grab it, making libusb
access impossible.

Windows and Linux both permit replacing the HID class kernel driver
with something that supports libusb from within the application, but
there is no portable API (libusb can do it on Linux, libwdi can do it
on Windows) but Mac is unfortunately no longer possible.

> There is no HID backend for Mac OS X and it is not easy now to
> detach the kernel driver. And the Windows HID backend
> is removed thanks to Peter Stuge's vehement objection to the
> idea.

Yes. libusb isn't the right tool for talking to the kernel HID

> So you may want to look HIDAPI instead...

Agree. You will avoid all system-specific issues by using HIDAPI,
since it is intended exactly for communicating with HID class devices
through the various API offered by different kernel HID class drivers.

If you go with libusb you'll have to do some kernel driver management,
which doesn't currently have a great portable solution, and for
Mac OS X has no solution at all when it comes to HID class.


More information about the libhid-discuss mailing list