[PR #40] [3/5] Runtime uhid/uinput backend selection + self-describing udev #43

Open
opened 2026-10-15 12:51:34 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/games-on-whales/inputtino/pull/40
Author: @kmreisi
Created: 6/24/2026
Status: 🔄 Open

Base: stable ← Head: feature/runtime-uhid-uinput-joypads


📝 Commits (8)

  • 2ca4e07 Align PS5 MAC handling via shared uhid helpers
  • 7a88920 Introduce Mac struct with shared helpers
  • 342f6c3 Use pooled MAC allocation with reuse on release
  • b24e301 fix(mac): monotonic counter allocation, validate parse input
  • d010cdb refactor(uhid): move find_uhid_sys_nodes out of the header
  • b4f7fe9 test(capi): assert every switch node path, not just the first
  • 52736d1 Share get_nodes() via sys_nodes_to_dev_paths helper
  • 49d35fe feat(joypad): runtime uhid/uinput selection + self-describing udev

📊 Changes

22 files changed (+1222 additions, -287 deletions)

View changed files

📝 CMakeLists.txt (+17 -5)
📝 include/inputtino/input.hpp (+247 -71)
➕ include/inputtino/mac.hpp (+42 -0)
➕ src/host_capability.cpp (+84 -0)
➕ src/mac.cpp (+103 -0)
➕ src/udev_helpers.hpp (+63 -0)
➕ src/uhid/include/uhid/joypad_common.hpp (+64 -0)
📝 src/uhid/include/uhid/protected_types.hpp (+8 -14)
📝 src/uhid/include/uhid/uhid.hpp (+38 -5)
📝 src/uhid/joypad_ps5.cpp (+183 -125)
➕ src/uhid/uhid.cpp (+50 -0)
📝 src/uinput/include/inputtino/protected_ps5_types.hpp (+1 -1)
📝 src/uinput/include/inputtino/protected_types.hpp (+2 -0)
📝 src/uinput/joypad_nintendo.cpp (+14 -3)
📝 src/uinput/joypad_ps.cpp (+24 -33)
📝 src/uinput/joypad_utils.hpp (+38 -0)
📝 src/uinput/joypad_xbox.cpp (+8 -1)
📝 tests/CMakeLists.txt (+3 -0)
📝 tests/testCAPI.cpp (+11 -7)
➕ tests/testFactory.cpp (+82 -0)

...and 2 more files

📄 Description

[3/5] in the dynamic-UHID-joypads roadmap — see #44.

The runtime joypad factory + udev self-description.

  • is_uhid_supported() + Joypad::create(Joypad::TYPE, def, prefer_uhid): the rich
    uhid pad when /dev/uhid is reachable, the uinput pad otherwise. Joypad::TYPE is
    nested in Joypad, matching inputtino's other enums.
  • Optional capabilities hoisted onto the Joypad base as no-op virtuals.
  • Self-describing udev (get_udev_events() / get_udev_hw_db_entries()).
  • set_gyro() / set_accel() base motion virtuals; set_motion() kept as a PS5 shim.
  • Joypad::default_definition(Joypad::TYPE) exposes each type's identity.

The factory is purely additive — the existing per-type API (PS5Joypad::create,
set_motion, …) is untouched, so the current consumers (Sunshine, wolf) keep
compiling and adopting the factory is optional.

Stacks on #43. Builds, tests pass, Sunshine + wolf compile.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/games-on-whales/inputtino/pull/40 **Author:** [@kmreisi](https://github.com/kmreisi) **Created:** 6/24/2026 **Status:** 🔄 Open **Base:** `stable` ← **Head:** `feature/runtime-uhid-uinput-joypads` --- ### 📝 Commits (8) - [`2ca4e07`](https://github.com/games-on-whales/inputtino/commit/2ca4e07cd5ffb60cd3cffe17f500e6e1c067c86f) Align PS5 MAC handling via shared uhid helpers - [`7a88920`](https://github.com/games-on-whales/inputtino/commit/7a889203b0338efa5aafa2bb6442319217cfd63a) Introduce Mac struct with shared helpers - [`342f6c3`](https://github.com/games-on-whales/inputtino/commit/342f6c3a8557b58ca509d4fe09071e61dc4d6291) Use pooled MAC allocation with reuse on release - [`b24e301`](https://github.com/games-on-whales/inputtino/commit/b24e3012ec9d530ab03a08aa05092ef33d66f1ba) fix(mac): monotonic counter allocation, validate parse input - [`d010cdb`](https://github.com/games-on-whales/inputtino/commit/d010cdb4cf64f58a97651fe14263616740a3d7b8) refactor(uhid): move find_uhid_sys_nodes out of the header - [`b4f7fe9`](https://github.com/games-on-whales/inputtino/commit/b4f7fe9a36b4a9b532b83949daee8e28c5017bd9) test(capi): assert every switch node path, not just the first - [`52736d1`](https://github.com/games-on-whales/inputtino/commit/52736d1ad81b9e4d32cc863d22b3444e95694d90) Share get_nodes() via sys_nodes_to_dev_paths helper - [`49d35fe`](https://github.com/games-on-whales/inputtino/commit/49d35fe3dbce4539b65ff590a39b3fe9f28c399b) feat(joypad): runtime uhid/uinput selection + self-describing udev ### 📊 Changes **22 files changed** (+1222 additions, -287 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+17 -5) 📝 `include/inputtino/input.hpp` (+247 -71) ➕ `include/inputtino/mac.hpp` (+42 -0) ➕ `src/host_capability.cpp` (+84 -0) ➕ `src/mac.cpp` (+103 -0) ➕ `src/udev_helpers.hpp` (+63 -0) ➕ `src/uhid/include/uhid/joypad_common.hpp` (+64 -0) 📝 `src/uhid/include/uhid/protected_types.hpp` (+8 -14) 📝 `src/uhid/include/uhid/uhid.hpp` (+38 -5) 📝 `src/uhid/joypad_ps5.cpp` (+183 -125) ➕ `src/uhid/uhid.cpp` (+50 -0) 📝 `src/uinput/include/inputtino/protected_ps5_types.hpp` (+1 -1) 📝 `src/uinput/include/inputtino/protected_types.hpp` (+2 -0) 📝 `src/uinput/joypad_nintendo.cpp` (+14 -3) 📝 `src/uinput/joypad_ps.cpp` (+24 -33) 📝 `src/uinput/joypad_utils.hpp` (+38 -0) 📝 `src/uinput/joypad_xbox.cpp` (+8 -1) 📝 `tests/CMakeLists.txt` (+3 -0) 📝 `tests/testCAPI.cpp` (+11 -7) ➕ `tests/testFactory.cpp` (+82 -0) _...and 2 more files_ </details> ### 📄 Description **`[3/5]` in the dynamic-UHID-joypads roadmap — see #44.** The runtime joypad factory + udev self-description. - `is_uhid_supported()` + `Joypad::create(Joypad::TYPE, def, prefer_uhid)`: the rich uhid pad when `/dev/uhid` is reachable, the uinput pad otherwise. `Joypad::TYPE` is nested in `Joypad`, matching inputtino's other enums. - Optional capabilities hoisted onto the `Joypad` base as no-op virtuals. - Self-describing udev (`get_udev_events()` / `get_udev_hw_db_entries()`). - `set_gyro()` / `set_accel()` base motion virtuals; `set_motion()` kept as a PS5 shim. - `Joypad::default_definition(Joypad::TYPE)` exposes each type's identity. The factory is purely additive — the existing per-type API (`PS5Joypad::create`, `set_motion`, …) is untouched, so the current consumers (Sunshine, wolf) keep compiling and adopting the factory is optional. Stacks on #43. Builds, tests pass, Sunshine + wolf compile. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
games-on-whales/inputtino#43
No description provided.