Skip to content

input: a pointer is no gamepad; document Bluetooth keyboards and mice - #20

Closed
KurdtNervanna wants to merge 1 commit into
PaddleStroke:mainfrom
KurdtNervanna:bt-kbd-mouse
Closed

KurdtNervanna wants to merge 1 commit into
PaddleStroke:mainfrom
KurdtNervanna:bt-kbd-mouse

Conversation

@KurdtNervanna

Copy link
Copy Markdown
Contributor

A small fix and some documentation about Bluetooth (and USB) keyboards and mice, found while checking whether they work now that 0.1.5 can pair Bluetooth devices.

The fix

A pointer node (a trackpad, a tablet, or the touchpad node a PS4-style pad exposes) has an absolute X axis and four or more buttons but no KEY_A. The generic check in dev_open() took such a node for an unconfigured gamepad and gave it a player port, so a pad's touchpad could show the "unconfigured pad" toast and a trackpad could occupy a port. This pulls the node classification out into classify_dev() and excludes pointer nodes from that generic pad check. Nodes with explicit pad bits (BTN_GAMEPAD, BTN_JOYSTICK, BTN_TRIGGER_HAPPY) are still pads.

Tests

Eight new cases in frontend/tests/test_input.c (classify): a keyboard, a mouse, a trackpad, a media-key node, a gamepad and joystick-style pads. make check-input passes in WSL Ubuntu. Not run: check-ui, the other suites, and shellcheck. No real keyboard, mouse or pad was used.

Docs

  • docs/input-design.md: a new section, "Keyboards and mice (USB and Bluetooth)", on what works today and what does not.
  • README.md: one sentence saying a Bluetooth keyboard works like a USB one once paired, and mice are not used yet.

What the section documents, from reading the code (not hardware):

  • A Bluetooth keyboard drives the menus and the in-game hotkeys, the same as USB.
  • Mice and trackpads are ignored; there is no menu cursor.
  • The host offers cores only joypad and analog devices, so DOSBox Pure and ScummVM get no physical keyboard or mouse from any device; they use their on-screen keyboard.
  • Pairing is Just Works, so a keyboard that needs a PIN or passkey cannot be paired from the console.

Forwarding keyboard and mouse input to cores, a menu cursor, and a device-type label in the Bluetooth list are noted as not built. They are bigger changes and I have not started them.

Not tested on real hardware

Whether a real Bluetooth keyboard pairs, reconnects and drives the menus, and that a mouse pairs and does nothing, still needs a RetroStone2 and the devices.

🤖 Generated with Claude Code

A trackpad, tablet or a pad's touchpad node (absolute X, 4+ buttons, no
KEY_A) was taken for an unconfigured gamepad and got a player port. Move the
node classification into classify_dev() and exclude pointers from the generic
heuristic (explicit pad bits still win). Test: make check-input (classify).

docs/input-design.md: what works for USB/Bluetooth keyboards and mice today
and what is not built (core keyboard/mouse forwarding, menu cursor).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@KurdtNervanna

Copy link
Copy Markdown
Contributor Author

A note on CI: the board script tests job fails on this PR, but not in the tests themselves. Its first step (scripts/ci/uboot-host-tools.sh) downloads u-boot-2026.07.tar.bz2 from ftp.denx.de, and that download does not complete: the job stops about two minutes in, before any test runs. I checked from another machine and ftp.denx.de also times out there, so it looks like a problem with that server, not with the change. The other six checks (make check, ASan, both cross-compiles, defconfigs and lint) pass.

Once the server answers, a re-run of that job should be enough. I can't re-run it from the fork, so I'll leave it for you; tell me if you would rather I push a small commit to retrigger CI.

@KurdtNervanna

Copy link
Copy Markdown
Contributor Author

Closing: this change is now the second commit of #19, which carries all the Bluetooth work in one PR (pad battery and PIN message, keyboards and mice, headphones prototype).

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