Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

library is not working with more than 2 keyboards

Đang mở
#6 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
operating-systems

Hướng nghiên cứu

Bắt đầu với ví dụ đã sửa đổi trong thư mục example và tái hiện hành vi bằng cách sử dụng /dev/input/event21 và /dev/input/event23, sau đó thêm bàn phím thứ ba như mô tả. Theo dõi cách thư viện đọc và phát các sự kiện cho từng thiết bị trên Ubuntu hoặc Raspberry Pi; hoàn thành khi các sự kiện phím từ tất cả bàn phím được kết nối được ghi nhật ký ngay lập tức và độc lập.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
JavaScript
Star
65
Fork
22
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của lsongdev/input-event

Tất cả issue của lsongdev/input-event

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.