[PR #48] fix: honor physical paths for uinput devices #49

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

📋 Pull Request Information

Original PR: https://github.com/games-on-whales/inputtino/pull/48
Author: @papi-ux
Created: 8/19/2026
Status: 🔄 Open

Base: stable ← Head: fix/uinput-device-phys


📝 Commits (1)

  • 8da0031 fix: honor physical paths for uinput devices

📊 Changes

11 files changed (+117 additions, -70 deletions)

View changed files

📝 src/uinput/include/inputtino/protected_types.hpp (+40 -0)
📝 src/uinput/joypad_nintendo.cpp (+2 -7)
📝 src/uinput/joypad_ps.cpp (+2 -7)
📝 src/uinput/joypad_xbox.cpp (+3 -8)
📝 src/uinput/keyboard.cpp (+3 -8)
📝 src/uinput/mouse.cpp (+4 -14)
📝 src/uinput/pentablet.cpp (+2 -7)
📝 src/uinput/touchscreen.cpp (+3 -8)
📝 src/uinput/trackpad.cpp (+2 -7)
📝 tests/libinput.h (+14 -4)
📝 tests/testLibinput.cpp (+42 -0)

📄 Description

Summary

  • apply non-empty DeviceDefinition::device_phys values through the kernel UI_SET_PHYS ioctl before creating libevdev uinput devices
  • share the explicit uinput file-descriptor setup and cleanup across keyboard, relative and absolute mouse, touchscreen, pen tablet, trackpad, and uinput joypads
  • verify the configured physical path through the sysfs attribute consumed by udev

Root cause

The public device definition exposes device_phys, and callers already populate it, but inputtino's uinput implementations only applied the name and numeric identity fields. Only the UHID DualSense path consumed the physical path. Consumers that rely on udev matching by phys therefore could not classify uinput devices as intended.

This was observed in papi-ux/polaris#494, where private-session keyboard and pointer devices remained on the host seat because their configured isolation marker never reached the kernel device.

libevdev_set_phys() is not sufficient here. It updates libevdev's in-memory descriptor, while libevdev documents virtual uinput devices as having no libevdev physical location. The working path opens /dev/uinput, applies UI_SET_PHYS before UI_DEV_CREATE, passes that descriptor into libevdev, and closes it after destroying the device.

Compatibility

Empty physical paths retain the existing libevdev-managed descriptor path. Non-empty paths now honor the existing public field. Failure to open /dev/uinput or apply the requested physical path fails device creation instead of silently creating a device with the wrong identity.

Validation

  • GCC 16 Linux build with C and C++ bindings: pass
  • source-only RED using the current upstream stable library: all five device sections fail because the sysfs phys value is empty, return code 5
  • GREEN using this branch: 11 of 11 assertions pass for keyboard, both mouse nodes, touchscreen, pen tablet, and trackpad
  • Polaris udev smoke: keyboard plus relative and absolute mouse nodes all expose the requested marker, receive ID_SEAT=seat-polaris, group input, and mode 0660; all nodes disappear after teardown
  • changed-line clang-format check: pass
  • full CTest comparison: both the upstream baseline and this branch pass 15 of 21 tests on the validation host; the remaining SDL identity, event-order, and UHID timing failures are host-dependent and occur on both sides

This PR remains draft pending maintainer review.


🔄 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/48 **Author:** [@papi-ux](https://github.com/papi-ux) **Created:** 8/19/2026 **Status:** 🔄 Open **Base:** `stable` ← **Head:** `fix/uinput-device-phys` --- ### 📝 Commits (1) - [`8da0031`](https://github.com/games-on-whales/inputtino/commit/8da0031e73217706931b5a4f2902d7bec4e01f58) fix: honor physical paths for uinput devices ### 📊 Changes **11 files changed** (+117 additions, -70 deletions) <details> <summary>View changed files</summary> 📝 `src/uinput/include/inputtino/protected_types.hpp` (+40 -0) 📝 `src/uinput/joypad_nintendo.cpp` (+2 -7) 📝 `src/uinput/joypad_ps.cpp` (+2 -7) 📝 `src/uinput/joypad_xbox.cpp` (+3 -8) 📝 `src/uinput/keyboard.cpp` (+3 -8) 📝 `src/uinput/mouse.cpp` (+4 -14) 📝 `src/uinput/pentablet.cpp` (+2 -7) 📝 `src/uinput/touchscreen.cpp` (+3 -8) 📝 `src/uinput/trackpad.cpp` (+2 -7) 📝 `tests/libinput.h` (+14 -4) 📝 `tests/testLibinput.cpp` (+42 -0) </details> ### 📄 Description ## Summary - apply non-empty `DeviceDefinition::device_phys` values through the kernel `UI_SET_PHYS` ioctl before creating libevdev uinput devices - share the explicit uinput file-descriptor setup and cleanup across keyboard, relative and absolute mouse, touchscreen, pen tablet, trackpad, and uinput joypads - verify the configured physical path through the sysfs attribute consumed by udev ## Root cause The public device definition exposes `device_phys`, and callers already populate it, but inputtino's uinput implementations only applied the name and numeric identity fields. Only the UHID DualSense path consumed the physical path. Consumers that rely on udev matching by `phys` therefore could not classify uinput devices as intended. This was observed in papi-ux/polaris#494, where private-session keyboard and pointer devices remained on the host seat because their configured isolation marker never reached the kernel device. `libevdev_set_phys()` is not sufficient here. It updates libevdev's in-memory descriptor, while libevdev documents virtual uinput devices as having no libevdev physical location. The working path opens `/dev/uinput`, applies `UI_SET_PHYS` before `UI_DEV_CREATE`, passes that descriptor into libevdev, and closes it after destroying the device. ## Compatibility Empty physical paths retain the existing libevdev-managed descriptor path. Non-empty paths now honor the existing public field. Failure to open `/dev/uinput` or apply the requested physical path fails device creation instead of silently creating a device with the wrong identity. ## Validation - GCC 16 Linux build with C and C++ bindings: pass - source-only RED using the current upstream `stable` library: all five device sections fail because the sysfs `phys` value is empty, return code 5 - GREEN using this branch: 11 of 11 assertions pass for keyboard, both mouse nodes, touchscreen, pen tablet, and trackpad - Polaris udev smoke: keyboard plus relative and absolute mouse nodes all expose the requested marker, receive `ID_SEAT=seat-polaris`, group `input`, and mode `0660`; all nodes disappear after teardown - changed-line `clang-format` check: pass - full CTest comparison: both the upstream baseline and this branch pass 15 of 21 tests on the validation host; the remaining SDL identity, event-order, and UHID timing failures are host-dependent and occur on both sides This PR remains draft pending maintainer review. --- <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#49
No description provided.