geertjohan / go.hid Goto Github PK
View Code? Open in Web Editor NEWProvides communication with USB Human Interface Devices.
Home Page: godoc.org/github.com/GeertJohan/go.hid
License: BSD 2-Clause "Simplified" License
Provides communication with USB Human Interface Devices.
Home Page: godoc.org/github.com/GeertJohan/go.hid
License: BSD 2-Clause "Simplified" License
Unfortunately, this fails to run with the latest Golang:
panic: runtime error: cgo argument has Go pointer to Go pointer
goroutine 1 [running]:
panic(0x4100900, 0xc82005c270)
/usr/local/Cellar/go/1.6/libexec/src/runtime/panic.go:464 +0x3e6
github.com/GeertJohan/cgo%2ewchar.convertWcharStringToGoString(0xc82007c100, 0xa, 0x10, 0x0, 0x0, 0x0, 0x0)
/Users/weingart/src/github.com/GeertJohan/cgo.wchar/convert.go:150 +0x521
github.com/GeertJohan/cgo%2ewchar.WcharStringPtrToGoString(0x4309800, 0x0, 0x0, 0x0, 0x0)
/Users/weingart/src/github.com/GeertJohan/cgo.wchar/wchar.go:141 +0x91
github.com/GeertJohan/go%2ehid.Enumerate(0xc800000000, 0x0, 0x0, 0x0, 0x0, 0x0)
/Users/weingart/src/github.com/GeertJohan/go.hid/hid.go:211 +0x3e6
hidapi is a cross-platform library, the included version is only for linux/hidraw. By doing so, you limit unnecessarily the scope of your library.
Download and compile hidapi separately, then compile/install your project.
This is a fantastic Go library for HID devices! Finally, after 6+ years of sitting on some unique USB HID devices, I saw this repo and sniffed out the commands for my device (though there are other types and models out there).
As I started to use go.hid, I quickly ran up against the limitations of the hidapi
library! In particular:
http://stackoverflow.com/questions/17706853/using-hidapi-how-can-you-query-the-raw-report-descriptor
HIDAPI does not provide functions for getting or parsing the report descriptor. Since HIDAPI is
for talking to a custom devices, these devices will likely contain all or mostly vendor-defined
report items anyway.
That's a bummer as I was attempting to query for and then enumerate over all report IDs and their descriptors as that's what my device uses.
So I am back to investigating into the libusb
C++ cross-platform project.
Please ignore this issue, as it was on the device's side, anyway that seemed totally impossible that the bug could be on go.hid's side.
Conversion fails for some reason on raspberry pi (running linux arm and using libusb). Errors are shown below. These changes tested on linux (arm) and osx.
./go.hid/hid.go:597: cannot convert ws.Pointer() (type *wchar.Wchar) to type *C.wchar_t ./go.hid/hid.go:624: cannot convert ws.Pointer() (type *wchar.Wchar) to type *C.wchar_t ./go.hid/hid.go:651: cannot convert ws.Pointer() (type *wchar.Wchar) to type *C.wchar_t ./go.hid/hid.go:679: cannot convert ws.Pointer() (type *wchar.Wchar) to type *C.wchar_t
For instance:
FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF
(16x)
this raises an error from libiconv: illegal byte sequence.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.