sdumetz / node-evdev

pure nodejs evdev reader

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: ESPIPE: invalid seek

djthread opened this issue · comments

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!

Looks like you forgot to add a filter. Try with ./index.js event-joystick.

Good thing you reported that thoug. It points out that

  • I don't have a proper handling for when users don't provide a string to match against
  • ESPIPE is a confusing error to get in this case.

I'll correct it. Thanks.

@sdumetz, thank you so much for the reply!

It seems I forgot to tell the whole story. I had first duplicated your index.js code into my own file and changed the process.argv[2] bit to be "event-joystick" where I got the same error. I forgot to use the argument on the command line when invoking your script, but it didn't seem to help much:

root@DietPi ~/t/n/evdev# ./index.js event-joystick
searching for event streams matching event-joystick in : /dev/input/by-path
found 1 inputs
{ bustype: 3, vendor: 2064, product: 58625, version: 272 }
reader error :  { Error: ESPIPE: invalid seek, read errno: -29, code: 'ESPIPE', syscall: 'read' }

Any idea what I might be missing here?

Thank you so very much!

No idea at all then, sorry.

Will look into it further to see if I can reproduce. Could you tell me more infos about your system? Joystick used, active distro, ...

This is DietPi[1] running on a USBridge[2] with a very cheap USB gamepad[3] connected.

Thank you very much for looking into this! I'd very much appreciate any thoughts. Happy to try things if you need me to test a theory.

[1] https://dietpi.com/
[2] https://www.allo.com/sparky/usbridge.html
[3] https://www.ebay.com/itm/2-PCS-USB-NES-Retro-Classic-Controller-Gamepad-For-Windows-PC-MAC-Nintendo-Games-/132668831670?hash=item1ee3adb7b6

Looks like a documented error on fs.createReadStream. nodejs/node@a653f23 which should have been merged in node 6 and above. What's your exact nodejs version?

If v6.xor v8.x, could you try one of the following :

  • Upgrade to v9.x
  • Update to v6.x or v8.x latest stable patch

Thanks

Hm! This is node v9.7.1, so perhaps this does not explain the issue?

OK then I have no idea why createReadStream would try to seek in your file.

I'll try to set up a similar environment to check if I can reproduce.