testsAndMisc/linux_configuration/fixes/systemd/g29-shifter-bpf.service
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

22 lines
803 B
Desktop File

[Unit]
# Safety net for the G29 shifter HID-BPF fix (see docs/DOCS-g29-shifter.md).
# udev-hid-bpf's own rule attaches the program on "add"; this unit re-checks
# after boot and on every hotplug, and re-attaches if that rule ever misses.
# It exits 0 with no wheel present, and FAILS when the wheel is present in a
# mode the fix cannot attach to (PS4 selector -> 046D:C260); the retry below
# keeps re-checking and re-notifying the desktop until the selector is flipped.
# Installed by fixes/fix_g29_shifter.sh; __SCRIPT__ is substituted there.
Description=Ensure the G29 shifter HID-BPF fix is attached
After=systemd-udevd.service
StartLimitIntervalSec=0
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=__SCRIPT__ --ensure
Restart=on-failure
RestartSec=5min
[Install]
WantedBy=multi-user.target