sdumetz / node-evdev Goto Github PK
View Code? Open in Web Editor NEWpure nodejs evdev reader
pure nodejs evdev reader
Hey,
atyour npmjs entry you link your example like that which leads nowhere
https://github.com/klepthys/node-evdev/blob/HEAD/sdumetz/blob/master/index.js
This is likely not a library issue, but user error. I'm really not sure what I'm missing here, though.
I'm trying to recognize events coming from a simple USB gamepad under linux. I've got things working with the legacy, "jsdev" method via the node-joystick
package, but I'm trying to switch to the evdev method.
I can cat /dev/input/by-id/usb-0810_usb_gamepad-event-joystick
and see output as I press buttons, so it seems that the kernel is functioning properly, but when I run the index.js
in this package, the output is as follows:
root@DietPi ~/t/n/evdev# ./index.js
searching for event streams matching undefined in : /dev/input/by-path
found 4 inputs
{ bustype: 3, vendor: 2064, product: 58625, version: 272 }
reader error : { Error: ESPIPE: invalid seek, read errno: -29, code: 'ESPIPE', syscall: 'read' }
root@DietPi ~/t/n/evdev#
I would love a hint on this. What might be going wrong and what can I do about it?
Any help would be very much appreciated! Thanks!
How can is isolate an event to a specific input? I'm monitoring events on multiple inputs with the same events so need to get a handle on both the event and the input that made it.
Would it be possible to implement ioctl's EVIOCGRAB
to provide exclusive control of a device so it doesn't send commands to the system at the same time as it is being monitored?
python-evdev has this feature implemented, I'm just not sure how to implement it here in Node.
https://python-evdev.readthedocs.io/en/latest/apidoc.html#evdev.device.InputDevice.grab
Thanks for the help!
Anyway to start a reader when the input device connects?
The following code throws Unhandled 'error' event
error.
const EvdevReader = require("evdev");
const reader = new EvdevReader();
reader.on("error", (error) => console.log(error))
reader.open("/dev/null");
There is as expected a TypeError: Inappropriate ioctl for device
error emitted by DeviceReader.init, but I would expect this error to be captured by the EvdevReader which in turn would emit an error event of its own.
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.