README.txt 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. There are two implementations of HIDAPI for Linux. One (linux/hid.c) uses the
  2. Linux hidraw driver, and the other (libusb/hid.c) uses libusb. Which one you
  3. use depends on your application. Complete functionality of the hidraw
  4. version depends on patches to the Linux kernel which are not currently in
  5. the mainline. These patches have to do with sending and receiving feature
  6. reports. The libusb implementation uses libusb to talk directly to the
  7. device, bypassing any Linux HID driver. The disadvantage of the libusb
  8. version is that it will only work with USB devices, while the hidraw
  9. implementation will work with Bluetooth devices as well.
  10. To use HIDAPI, simply drop either linux/hid.c or libusb/hid.c into your
  11. application and build using the build parameters in the Makefile.
  12. Libusb Implementation notes
  13. ----------------------------
  14. For the libusb implementation, libusb-1.0 must be installed. Libusb 1.0 is
  15. different than the legacy libusb 0.1 which is installed on many systems. To
  16. install libusb-1.0 on Ubuntu and other Debian-based systems, run:
  17. sudo apt-get install libusb-1.0-0-dev
  18. Hidraw Implementation notes
  19. ----------------------------
  20. For the hidraw implementation, libudev headers and libraries are required to
  21. build hidapi programs. To install libudev libraries on Ubuntu,
  22. and other Debian-based systems, run:
  23. sudo apt-get install libudev-dev
  24. On Redhat-based systems, run the following as root:
  25. yum install libudev-devel
  26. Unfortunately, the hidraw driver, which the linux version of hidapi is based
  27. on, contains bugs in kernel versions < 2.6.36, which the client application
  28. should be aware of.
  29. Bugs (hidraw implementation only):
  30. -----------------------------------
  31. On Kernel versions < 2.6.34, if your device uses numbered reports, an extra
  32. byte will be returned at the beginning of all reports returned from read()
  33. for hidraw devices. This is worked around in the libary. No action should be
  34. necessary in the client library.
  35. On Kernel versions < 2.6.35, reports will only be sent using a Set_Report
  36. transfer on the CONTROL endpoint. No data will ever be sent on an Interrupt
  37. Out endpoint if one exists. This is fixed in 2.6.35. In 2.6.35, OUTPUT
  38. reports will be sent to the device on the first INTERRUPT OUT endpoint if it
  39. exists; If it does not exist, OUTPUT reports will be sent on the CONTROL
  40. endpoint.
  41. On Kernel versions < 2.6.36, add an extra byte containing the report number
  42. to sent reports if numbered reports are used, and the device does not
  43. contain an INTERRPUT OUT endpoint for OUTPUT transfers. For example, if
  44. your device uses numbered reports and wants to send {0x2 0xff 0xff 0xff} to
  45. the device (0x2 is the report number), you must send {0x2 0x2 0xff 0xff
  46. 0xff}. If your device has the optional Interrupt OUT endpoint, this does not
  47. apply (but really on 2.6.35 only, because 2.6.34 won't use the interrupt
  48. out endpoint).