Skip to content

libwiikeyboard - track multiple devices reporting a keyboard HID descriptor - #32

Open
dborth wants to merge 1 commit into
extremscorner:masterfrom
dborth:multi-keyboard
Open

dborth wants to merge 1 commit into
extremscorner:masterfrom
dborth:multi-keyboard

Conversation

@dborth

@dborth dborth commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

I came across this when I was updating DOSBox.

This updates libwiikeyboard to iterate over all devices reporting a keyboard HID descriptor and track them independently.

Many wireless mouse receivers (and other composite USB devices) report a keyboard interface even when no actual keyboard is connected. Previously, this meant that whichever device initialized first could block or interfere with recognition, meaning you could only use a real keyboard if it happened to be plugged in or initialized before those dummy interfaces.

By tracking multiple HID entries asynchronously, a mouse or dongle reporting a keyboard interface won't block your actual keyboard from working properly anymore.

- Refactor internal tracking structures from a single global keyboard
pointer
  (_kbd) to a fixed-size array (_kbds) supporting up to MAX_KEYBOARDS
(4).
- Switch from synchronous interrupt reads to asynchronous transfers
  (USB_ReadIntrMsgAsync) to prevent slow or non-responsive HID devices
  (such as wireless receiver multi-interfaces) from blocking other
keyboards.
- Implement device skipping and pruning for non-keyboard HID interfaces
  to optimize scanning performance.
- Update LED controls, event callbacks, and disconnection routines to
iterate
  across all active keyboard slots safely.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant