Streaming HID events in Node.js
Streaming HID Events in Node.js
Wraps node-hid with several parsers for common HID devices, specifically, keyboard-like devices.
Data parsers are available for:
var hid = ;var dev = '0001:001:00' parser : hidparserkeyboard ;dev;
The user has pressed Ctrl + Alt + Del
modifiers :l_shift : falsel_control : truel_alt : truel_meta : falser_ctrl : falser_shift : falser_alt : falser_meta : falsekeyCodes :76keyChars :errorStatus : false
The user has pressed w, a, s & d (simultaneously (why? I don't know))
modifiers :l_shift : falsel_control : falsel_alt : falsel_meta : falser_ctrl : falser_shift : falser_alt : falser_meta : falsekeyCodes :26 4 22 7charCodes :'w' 'a' 's' 'd'errorStatus: false
The data packet has additional convenience methods,
meta() which return
true if either the left or right of each key is pressed. The function
mod() returns true if any of the modifier keys is pressed.
empty() returns true if there is no modifier or key currently down.
Right now, hidstream is only parsing keyboard events, and has no awareness of HID feature reports.
After keyboard events are being parsed properly (and fully), I will add support for feature reports and other devices such as mice.
Significant refactor contributed by @kubat