diff options
author | Aristid Breitkreuz <aristidb@gmail.com> | 2015-05-25 19:55:26 +0200 |
---|---|---|
committer | Aristid Breitkreuz <aristidb@gmail.com> | 2015-05-25 20:00:35 +0200 |
commit | 4835763e13c295e465936d33f3a02001cb9e93bf (patch) | |
tree | 7d7f807b57343f909b4b6f03e85eb27683800903 | |
parent | d7de6dad5fc4de83ca4c8fac93bd1a0243c45f71 (diff) |
Trackpoint scrolling on T450s et al
-rw-r--r-- | nixos/modules/tasks/trackpoint.nix | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/nixos/modules/tasks/trackpoint.nix b/nixos/modules/tasks/trackpoint.nix index 778cdc5d30dd7..bd340869d69fc 100644 --- a/nixos/modules/tasks/trackpoint.nix +++ b/nixos/modules/tasks/trackpoint.nix @@ -45,6 +45,16 @@ with lib; ''; }; + fakeButtons = mkOption { + default = false; + type = types.bool; + description = '' + Switch to "bare" PS/2 mouse support in case Trackpoint buttons are not recognized + properly. This can happen for example on models like the L430, T450, T450s, on + which the Trackpoint buttons are actually a part of the Synaptics touchpad. + ''; + }; + }; }; @@ -52,11 +62,13 @@ with lib; ###### implementation - config = mkMerge [ - (mkIf config.hardware.trackpoint.enable { + config = + let cfg = config.hardware.trackpoint; in + mkMerge [ + (mkIf cfg.enable { services.udev.extraRules = '' - ACTION=="add|change", SUBSYSTEM=="input", ATTR{name}=="TPPS/2 IBM TrackPoint", ATTR{device/speed}="${toString config.hardware.trackpoint.speed}", ATTR{device/sensitivity}="${toString config.hardware.trackpoint.sensitivity}" + ACTION=="add|change", SUBSYSTEM=="input", ATTR{name}=="TPPS/2 IBM TrackPoint", ATTR{device/speed}="${toString cfg.speed}", ATTR{device/sensitivity}="${toString cfg.sensitivity}" ''; system.activationScripts.trackpoint = @@ -65,20 +77,22 @@ with lib; ''; }) - (mkIf config.hardware.trackpoint.emulateWheel { - services.xserver.config = - '' - Section "InputClass" - Identifier "Trackpoint Wheel Emulation" - MatchProduct "Elantech PS/2 TrackPoint|TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device|Composite TouchPad / TrackPoint" - MatchDevicePath "/dev/input/event*" - Option "EmulateWheel" "true" - Option "EmulateWheelButton" "2" - Option "Emulate3Buttons" "false" - Option "XAxisMapping" "6 7" - Option "YAxisMapping" "4 5" - EndSection - ''; + (mkIf (cfg.emulateWheel) { + services.xserver.inputClassSections = + ['' + Identifier "Trackpoint Wheel Emulation" + MatchProduct "${if cfg.fakeButtons then "PS/2 Generic Mouse" else "Elantech PS/2 TrackPoint|TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device|Composite TouchPad / TrackPoint"}" + MatchDevicePath "/dev/input/event*" + Option "EmulateWheel" "true" + Option "EmulateWheelButton" "2" + Option "Emulate3Buttons" "false" + Option "XAxisMapping" "6 7" + Option "YAxisMapping" "4 5" + '']; + }) + + (mkIf cfg.fakeButtons { + boot.extraModprobeConfig = "options psmouse proto=bare"; }) ]; } |