testsAndMisc/linux_configuration/fixes/systemd/99-g29-shifter-ensure.rules
Krzysztof kuhy Rudnicki 3ae53499e6 g29 shifter: detect PS4 mode (046D:C260) instead of failing silently
On the 2026-09-15 and 2026-09-17 boots the wheel enumerated as 046D:C260
(PS3/PS4 selector in PS4 position, bound by hid-generic). The BPF udev
rule, the ensure unit and its hotplug rule all keyed on C24F, so the unit
failed once with "no G29 found" and nothing was said; 1st/3rd stayed on
the firmware's bad decode until the selector was flipped a day later.

- fixes/g29_wheel_mode.sh (new, sourced): classify the HID bus as
  native/ps4/compat/absent; root-safe desktop notification via
  /run/user/*/bus + sudo -u.
- --ensure: absent -> exit 0; ps4/compat -> exit 1 + critical
  notification; native -> attach. --status prints the mode first.
- g29-shifter-bpf.service: Restart=on-failure, RestartSec=5min so a
  notification lost before the session bus exists at boot is re-sent.
- 99-g29-shifter-ensure.rules: also fires on C260.
- tests/test_fix_g29_shifter.bats: 13 tests against a fake sysfs tree.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NVfC2T6DyvCFqse9A99zef
2026-09-18 10:47:18 +02:00

7 lines
526 B
Plaintext

# Run the safety-net unit whenever the G29 is (re)enumerated, so a hotplug is
# covered as well as boot. Matches the native PID (C24F, PS3 selector) AND the
# PS4-mode PID (C260) so a wheel powered on in the wrong mode is reported at
# once instead of silently falling back to the firmware's bad 1st/3rd decode.
# Installed by fixes/fix_g29_shifter.sh.
ACTION=="add", SUBSYSTEM=="hid", ENV{MODALIAS}=="hid:b0003g*v0000046Dp0000C24F|hid:b0003g*v0000046Dp0000C260", TAG+="systemd", ENV{SYSTEMD_WANTS}+="g29-shifter-bpf.service"