Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

library is not working with more than 2 keyboards

Aperta
#6 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
javascript

Direzione di ricerca

Inizia con l’esempio modificato nella cartella example e riproduci il comportamento usando /dev/input/event21 e /dev/input/event23; quindi aggiungi una terza tastiera come descritto. Traccia il modo in cui la libreria legge ed emette gli eventi per ogni dispositivo su Ubuntu o Raspberry Pi; il lavoro è completato quando gli eventi dei tasti di tutte le tastiere collegate vengono registrati immediatamente e in modo indipendente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

help wanted

Hi!

Thank you for this great library.
It is exactly what I need for a project where i have to listen to and be able to distinguish between 4 different keyboard inputs.

I tried it on ubuntu 16.04 and on raspberry pi 3.
Everything works fine with 2 keyboards attached, but unfortunately I get some very strange behaviour when I attach a third one.

I use this slightly modified example code inside of the example folder

const InputEvent = require('../')

let inputSlots = [21, 23]
let inputs = []
let readers = []

for (let i = 0; i < inputSlots.length; i++) {
  try {
    inputs[i] = new InputEvent(`/dev/input/event${inputSlots[i]}`)
    readers[i] = new InputEvent.Keyboard(inputs[i])
    readers[i].on('keyup', (data) => { console.log(`reader ${i}: ${data.code}`) })
  } catch (err) {
    console.error(`Can not open device ${i}`)
  }
  if (readers[i]) {
    readers[i].on('error', (data) => { console.log(`reader ${i}: ${data.code}`) }) 
  }
}

When I adapt the inputSlots array and attach a third keyboard, the keycode doesn't get logged to the console immediately when pressing a key.
I have to press a key on one of the other 2 attached keyboards, then the keycode from before and the keycode from the key that was just pressed are logged.
If i now press another key on this keyboard the thing starts again and i have to press a key on one of the other keyboards in order to log the keycode.

I am wondering if you have ever encountered this problem, or if you happen to know what could be the reason for this behaviour.

I also tried it with the 'keydown' and 'keypress' event, but that didnt change anything.

Thank you very much
Best regards

Lingua principale
JavaScript
Stelle
65
Fork
22
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di lsongdev/input-event

Tutte le issue di lsongdev/input-event

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.