Use a udev rule for trackpoint configuration

This commit is contained in:
Jascha Geerds 2014-07-25 17:40:13 +02:00
parent 49e6ef2a19
commit 6fe59796b2

View File

@ -46,28 +46,10 @@ with lib;
config = mkIf config.hardware.trackpoint.enable {
jobs.trackpoint =
{ description = "Initialize trackpoint";
startOn = "started udev";
task = true;
script = ''
for directory in /sys/devices/platform/i8042/serio1 \
/sys/devices/platform/i8042/serio1/serio2 \
/sys/devices/platform/i8042/serio4/serio5; do
if [ -e "$directory/speed" ]; then
echo -n ${toString config.hardware.trackpoint.speed} \
> "$directory/speed"
echo -n ${toString config.hardware.trackpoint.sensitivity} \
> "$directory/sensitivity"
break
fi
done
'';
};
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}"
'';
};
}