You are not logged in.
I have a Thinkpad T430s, kde5 plasma, sddm, and a very, very sore wrist.
The simple, yet seemingly unattainable goal:
To have the following commands run at some point during login, at a time where they will actually have an effect:
echo -n 250 >/sys/devices/platform/i8042/serio1/serio2/speed
echo -n 180 >/sys/devices/platform/i8042/serio1/serio2/sensitivity
I have tried to follow the wiki's wise words, but this time, they fail me.
** Take 1: udev rule **
$ cat /etc/udev/rules.d/10-trackpoint.rules
ACTION=="add", DEVPATH=="/devices/platform/i8042/serio1/serio2", ATTR{sensitivity}="180", ATTR{speed}="250"
(reboot)
$ cat /sys/devices/platform/i8042/serio1/serio2/sensitivity
128
What could be wrong with the rule? I don't have the faintest idea!
There isn't a log file to be found anywhere with any trace of it:
$ # 'rg -uu' searches all non-binary files (including hidden files)
$ cd /
$ sudo rg -uu '10-trackpoint' !(proc|sys)
[ hits from /home/lampam/.bash_history ]
[ hits from /home/lampam/.viminfo ]
$
So I'm afraid I don't have much to go on.
** Take 2: path-triggered systemctl service **
I have created the following files:
/
├── etc
│ └── systemd
│ └── system
│ ├── trackpoint-sensitivity.path
│ └── trackpoint-sensitivity.service
└── usr
└── local
└── bin
└── fix-trackpoint-sensitivity.sh
$ cat /usr/local/bin/fix-trackpoint-sensitivity.sh
#!/bin/sh
log=/home/lampam/trackpoint-log.txt
{
echo -n 250 >/sys/devices/platform/i8042/serio1/serio2/speed && \
echo -n 180 >/sys/devices/platform/i8042/serio1/serio2/sensitivity
} 2>$log && echo "fix-trackpoint-sensitivity success" >>$log
$ cat /etc/systemd/system/trackpoint-sensitivity.path
[Unit]
Description=Watch for, and modify, Trackpoint attributes
[Path]
PathExists=/sys/devices/platform/i8042/serio1/serio2/sensitivity
PathExists=/sys/devices/platform/i8042/serio1/serio2/speed
[Install]
WantedBy=default.target
$ cat /etc/systemd/system/trackpoint-sensitivity.service
[Unit]
Description=Set TrackPoint attributes
[Service]
# NOTE: I tried adding the following two lines today thinking they
# would do it, but it still doesn't run on boot.
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/local/bin/fix-trackpoint-sensitivity.sh
Here's what always happens on boot, after logging into plasma.
[reboot]
$ cat trackpoint-log.txt
cat: 'trackpoint-log.txt': no such file or directory
$ cat /sys/devices/platform/i8042/serio1/serio2/sensitivity
128
$ sudo systemctl status trackpoint-sensitivity.path
● trackpoint-sensitivity.path - Watch for, and modify, Trackpoint attributes
Loaded: loaded (/etc/systemd/system/../../../home/lampam/dotfiles/stow/t430s-trackpoint-sensitivity/etc/systemd/system/trackpoint-sensitivity.path; enabled; vendor preset: disabled)
Active: active (waiting) since Sat 2017-04-08 15:26:01 EDT; 4min 8s ago
Apr 08 15:26:01 arch-t430s systemd[1]: Started Watch for, and modify, Trackpoint attributes.
$ sudo systemctl status trackpoint-sensitivity
● trackpoint-sensitivity.service - Set TrackPoint attributes
Loaded: loaded (/etc/systemd/system/../../../home/lampam/dotfiles/stow/t430s-trackpoint-sensitivity/etc/systemd/system/trackpoint-sensitivity.service; linked; vendor preset: disabled)
Active: inactive (dead)
Manually enabling the service actually does cause the script to run!!
$ cat /sys/devices/platform/i8042/serio1/serio2/sensitivity
128
$ sudo systemctl enable trackpoint-sensitivity.path
$ cat /sys/devices/platform/i8042/serio1/serio2/sensitivity
180
$ cat trackpoint-log.txt
fix-trackpoint-sensitivity success
$ sudo systemctl status trackpoint-sensitivity.path
● trackpoint-sensitivity.path - Watch for, and modify, Trackpoint attributes
Loaded: loaded (/etc/systemd/system/../../../home/lampam/dotfiles/stow/t430s-trackpoint-sensitivity/etc/systemd/system/trackpoint-sensitivity.path; enabled; vendor preset: disabled)
Active: active (running) since Sat 2017-04-08 15:26:01 EDT; 8min ago
Apr 08 15:26:01 arch-t430s systemd[1]: Started Watch for, and modify, Trackpoint attributes.
$ sudo systemctl status trackpoint-sensitivity
● trackpoint-sensitivity.service - Set TrackPoint attributes
Loaded: loaded (/etc/systemd/system/../../../home/lampam/dotfiles/stow/t430s-trackpoint-sensitivity/etc/systemd/system/trackpoint-sensitivity.service; linked; vendor preset: disabled)
Active: active (exited) since Sat 2017-04-08 15:33:05 EDT; 1min 43s ago
Process: 1003 ExecStart=/usr/local/bin/fix-trackpoint-sensitivity.sh (code=exited, status=0/SUCCESS)
Main PID: 1003 (code=exited, status=0/SUCCESS)
Apr 08 15:33:04 arch-t430s systemd[1]: Starting Set TrackPoint attributes...
Apr 08 15:33:05 arch-t430s systemd[1]: Started Set TrackPoint attributes.
...but it still doesn't run on the next boot.
$ rm trackpoint-log.txt
$ sudo reboot -h now
[reboot]
$ cat trackpoint-log.txt
cat: 'trackpoint-log.txt': no such file or directory
$ cat /sys/devices/platform/i8042/serio1/serio2/sensitivity
128
$ sudo systemctl status trackpoint-sensitivity.path
(same output as under "Here's what always happens on boot...")
$ sudo systemctl status trackpoint-sensitivity
(same output as under "Here's what always happens on boot...")
</3
I've wasted days on this by simply not knowing the right place to look. Somebody please help give me a push in the right direction.
Last edited by ExpHP (2017-04-15 21:08:24)
Offline
Using a udev rule must work!
Try checking your device (and its parents) with
udevadm info -a -p /sys/devices/platform/i8042/serio1/serio2
and create your specific udev rule accordingly.
For instance, my personal specific rule for my Lenovo ThinkPad Compact USB Keyboard with TrackPoint looks like this:
ACTION=="add", SUBSYSTEM=="hid", DRIVERS=="lenovo", ATTR{sensitivity}="9"
SUBSYSTEM and DRIVERS are just enough in order to pattern match the device successfully. It matches even if the DEVPATH changes for whatever reason.
Reload the rules files by executing
udevadm control --reload
Simulate a udev event run, i.e. test your specific rule for your device by executing
udevadm test /sys/devices/platform/i8042/serio1/serio2
If the test ends successfully, the rule will be applied at startup.
Most importantly, every now and then check the journal for udev errors:
journalctl -xe _SYSTEMD_UNIT=systemd-udevd.service
You could look for errors like
Invalid rule /etc/udev/rules.d/10-trackpoint.rules:1: invalid ATTRS operation
or
Invalid rule /etc/udev/rules.d/51-sony.rules:1: unknown key 'UBSYSTEM'
Offline
Thank you for your detailed response!
Simulate a udev event run, i.e. test your specific rule for your device by executing
udevadm test /sys/devices/platform/i8042/serio1/serio2
If the test ends successfully, the rule will be applied at startup.
My new rule:
ACTION=="add", SUBSYSTEM=="serio", DRIVERS=="psmouse", ATTR{sensitivity}="250", ATTR{speed}="180"
Testing:
$ sudo udevadm control --reload
$ sudo udevadm test /sys/devices/platform/i8042/serio1/serio2
...
...
Reading rules file: /usr/lib/udev/rules.d/95-upower-hid.rules
Reading rules file: /usr/lib/udev/rules.d/95-upower-wup.rules
Reading rules file: /usr/lib/udev/rules.d/99-bumblebee-nvidia-dev.rules
Reading rules file: /usr/lib/udev/rules.d/99-systemd.rules
rules contain 196608 bytes tokens (16384 * 12 bytes), 27403 bytes strings
19934 strings (164650 bytes), 17456 de-duplicated (139726 bytes), 2479 trie nodes used
ATTR '/sys/devices/platform/i8042/serio1/serio2/sensitivity' writing '250' /etc/udev/rules.d/10-trackpoint.rules:1
ATTR '/sys/devices/platform/i8042/serio1/serio2/speed' writing '180' /etc/udev/rules.d/10-trackpoint.rules:1
IMPORT builtin 'hwdb' /usr/lib/udev/rules.d/50-udev-default.rules:15
IMPORT builtin 'hwdb' returned non-zero
RUN 'kmod load $env{MODALIAS}' /usr/lib/udev/rules.d/80-drivers.rules:5
ACTION=add
DEVPATH=/devices/platform/i8042/serio1/serio2
DRIVER=psmouse
MODALIAS=serio:ty05pr00id00ex00
SERIO_EXTRA=00
SERIO_ID=00
SERIO_PROTO=00
SERIO_TYPE=05
SUBSYSTEM=serio
USEC_INITIALIZED=393707463
run: 'kmod load serio:ty05pr00id00ex00'
Unload module index
Unloaded link configuration context.
$ echo $?
0
Seems good to me, right? (the 'hwdb' error seems to show up for any device I specify, so I disregard it...)
And yet...
(reboots)
$ journalctl -xe _SYSTEMD_UNIT=systemd-udevd.service
-- Reboot --
Apr 15 14:59:29 arch-t430s systemd-udevd[207]: error opening ATTR{/sys/devices/platform/i8042/serio1/serio2/sensitivity} for writing: Permission denied
Apr 15 14:59:29 arch-t430s systemd-udevd[207]: error opening ATTR{/sys/devices/platform/i8042/serio1/serio2/speed} for writing: Permission denied
But thank goodness I at least have an error message now! Apparently the attribute files somehow still don't exist at the time when this rule runs?
While searching around about this, I was inspired to take the easy way out.
Now, I have finally had success using the technique of having a udev rule use a script to set attributes after a short delay.
/etc/udev/rules.d/10-trackpoint.rules
ACTION=="add", KERNEL=="serio2", SUBSYSTEM=="serio", DRIVERS=="psmouse", RUN+="/usr/local/bin/_udev--trackpoint-sensitivity.sh"
/usr/local/bin/_udev--trackpoint-sensitivity.sh
#!/bin/bash
# a dumb workaround to my trackpoint udev issues;
# a script which will set the desired values *after a delay*.
dateit() { while IFS= read -r x; do echo "$(date) $x"; done; }
logit() { cat >>/home/lampam/.serio.log; }
{
sleep 1
echo -n 250 >/sys/devices/platform/i8042/serio1/serio2/sensitivity
echo -n 180 >/sys/devices/platform/i8042/serio1/serio2/speed
} 2>&1 | dateit | logit &
Last edited by ExpHP (2017-04-15 21:19:02)
Offline