Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boombuler/hid
golang HID API implementation
https://github.com/boombuler/hid
Last synced: 2 months ago
JSON representation
golang HID API implementation
- Host: GitHub
- URL: https://github.com/boombuler/hid
- Owner: boombuler
- License: mit
- Created: 2014-09-22T16:02:47.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-03-10T02:14:45.000Z (almost 4 years ago)
- Last Synced: 2024-06-18T15:40:30.544Z (7 months ago)
- Language: Go
- Size: 31.3 KB
- Stars: 76
- Watchers: 3
- Forks: 56
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HID
A [GO](http://golang.org) package to access Human Interface Devices.
The platform specific parts of this package are heavily based on
[Signal 11 - HIDAPI](https://github.com/signal11/hidapi).### Supported operating systems
The following operating systems are supported targets
(as used by [*$GOOS* environment variable](https://golang.org/doc/install/source#environment))* darwin (uses native IOKit framework)
* linux (uses libusb 1.0+)
* windows (uses native Windows HID library)##### Known quirks for building on Windows 64bit
For building this HID package, you need to have a gcc.exe in your *%PATH%* environment variable.
There are two tested GCC toolchains: [tdm-gcc](http://tdm-gcc.tdragon.net/)
and [mingw-w64](http://mingw-w64.yaxm.org/). At the moment (March 2015), both toolchains
are missing some declarations in header files, which will result in the following error message,
when running the ```go build```:```
D:\projects.go\src\github.com\boombuler\hid> go build -v -work
WORK=C:\Users\xxx\AppData\Local\Temp\go-build011586055
github.com/boombuler/hid
# github.com/boombuler/hid
could not determine kind of name for C.HidD_FreePreparsedData
could not determine kind of name for C.HidD_GetPreparsedData
```The solutions is simple: just add these four lines to your gcc toolchain header file ```hidsdi.h```
````C
/* http://msdn.microsoft.com/en-us/library/windows/hardware/ff538893(v=vs.85).aspx */
HIDAPI BOOLEAN NTAPI HidD_FreePreparsedData(PHIDP_PREPARSED_DATA PreparsedData);/* http://msdn.microsoft.com/en-us/library/windows/hardware/ff539679(v=vs.85).aspx */
HIDAPI BOOLEAN NTAPI HidD_GetPreparsedData(HANDLE HidDeviceObject, PHIDP_PREPARSED_DATA *PreparsedData);
````
Depending on your gcc toolchain installation folder, the files are located in``` C:\TDM-GCC-64\x86_64-w64-mingw32\include\hidsdi.h ```
or
``` c:\mingw-w64\x86_64-4.9.2-win32-seh-rt_v3-rev1\mingw64\x86_64-w64-mingw32\include\hidsdi.h ```
After patching the header file, this package will compile.
Future releases of the gcc toolchains will surely fix this issue.### License
[![License: MIT](https://img.shields.io/:license-MIT-blue.svg)](http://opensource.org/licenses/MIT)