mirror of
https://github.com/zephrynis/nix-flake.git
synced 2026-08-17 21:45:53 +00:00
gaming: udev rules for phantom controllers and WebHID configurators
Clear ID_INPUT_JOYSTICK on the Keychron keyboard (3434) and X3PRO mouse receiver (3151) so Steam/games stop grabbing them as a phantom controller. Also grant the active session uaccess to those devices' hidraw nodes via a 60-*.rules package file (must sort before systemd's 73-seat-late.rules) so their browser-based WebHID configurators work. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -29,4 +29,35 @@
|
|||||||
enable = true;
|
enable = true;
|
||||||
packages = [ "io.mrarm.mcpelauncher" ];
|
packages = [ "io.mrarm.mcpelauncher" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Some devices expose a control interface that udev misdetects as a joystick,
|
||||||
|
# so Steam/games pick up a phantom controller and grab input. Clear
|
||||||
|
# ID_INPUT_JOYSTICK for them (extraRules → 99-local.rules is fine here, since
|
||||||
|
# this only rewrites a udev property later consumers read):
|
||||||
|
# 3434 = Keychron keyboard
|
||||||
|
# 3151 = "2.4G Wireless Mouse" (X3PRO) receiver
|
||||||
|
services.udev.extraRules = ''
|
||||||
|
SUBSYSTEM=="input", ATTRS{idVendor}=="3434", ENV{ID_INPUT_JOYSTICK}=""
|
||||||
|
SUBSYSTEM=="input", ATTRS{idVendor}=="3151", ENV{ID_INPUT_JOYSTICK}=""
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Browser-based (WebHID) configurators need the logged-in user to have access
|
||||||
|
# to the device's raw HID nodes:
|
||||||
|
# 3434 = Keychron keyboard (launcher.keychron.com)
|
||||||
|
# 3151 = X3PRO mouse (its web editor)
|
||||||
|
# TAG+="uaccess" makes systemd-logind grant the active session an ACL — but
|
||||||
|
# that tag is CONSUMED by systemd's 73-seat-late.rules, so the rule must sort
|
||||||
|
# BEFORE it. services.udev.extraRules lands in 99-local.rules (too late), so
|
||||||
|
# ship this as a package-provided 60-*.rules file instead.
|
||||||
|
# (WebHID is Chromium-only — use Chrome, not Firefox.)
|
||||||
|
services.udev.packages = [
|
||||||
|
(pkgs.writeTextFile {
|
||||||
|
name = "hid-webconfig-uaccess";
|
||||||
|
destination = "/etc/udev/rules.d/60-hid-webconfig-uaccess.rules";
|
||||||
|
text = ''
|
||||||
|
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="3434", TAG+="uaccess"
|
||||||
|
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="3151", TAG+="uaccess"
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user