You are not logged in.

#1 2014-09-14 19:52:12

jeroentbt
Member
From: .be
Registered: 2014-03-29
Posts: 25

[SOLVED] udev rule not working

Hi!

I'm trying to set my trackpoint sensitivity and speed using an udev rule:

[jeroen@zechs ~]$ ls -l /etc/udev/rules.d/
total 4
-rw-r--r-- 1 root root 113 Sep 14 01:54 10-trackpoint.rules
[jeroen@zechs ~]$ cat /etc/udev/rules.d/10-trackpoint.rules
# Set trackpoint option
KERNEL=="serio2", ATTR{speed}="180", ATTR{sensitivity}="255", RUN+="touch /tmp/udevtest"

When I test the rule, everything seems to be working as planned:

[jeroen@zechs ~]$ cat /sys/devices/platform/i8042/serio1/serio2/speed
97
[jeroen@zechs ~]$ cat /sys/devices/platform/i8042/serio1/serio2/sensitivity
128
[jeroen@zechs ~]$ sudo udevadm test /sys/devices/platform/i8042/serio1/serio2/
calling: test
version 216
[...]
timestamp of '/etc/udev/rules.d' changed
[...]
Reading rules file: /etc/udev/rules.d/10-trackpoint.rules
[...]
ATTR '/sys/devices/platform/i8042/serio1/serio2/speed' writing '180' /etc/udev/rules.d/10-trackpoint.rules:2
ATTR '/sys/devices/platform/i8042/serio1/serio2/sensitivity' writing '255' /etc/udev/rules.d/10-trackpoint.rules:2
RUN 'touch /tmp/udevtest' /etc/udev/rules.d/10-trackpoint.rules:2
[...]
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=284056746
run: 'touch /tmp/udevtest'
run: 'kmod load serio:ty05pr00id00ex00'
unload module index
Unloaded link configuration context.
[jeroen@zechs ~]$ cat /sys/devices/platform/i8042/serio1/serio2/sensitivity
255
[jeroen@zechs ~]$ cat /sys/devices/platform/i8042/serio1/serio2/speed
180

But when I boot the system, the rule has not been applied

[BOOT]
[jeroen@zechs ~]$ cat /sys/devices/platform/i8042/serio1/serio2/speed
97
[jeroen@zechs ~]$ cat /sys/devices/platform/i8042/serio1/serio2/sensitivity
128
[jeroen@zechs ~]$ sudo udevadm trigger
[jeroen@zechs ~]$ ls -l /tmp/udevtest
ls: cannot access /tmp/udevtest: No such file or directory

So the rule runs fine when I do `udevadm test` but fails to run on boot or `udevadm trigger`

Any hints or ideas, or probably some basic stuff I missed, to get this working?

Thank you for reading this far!

Last edited by jeroentbt (2015-07-20 11:46:40)

Offline

#2 2014-09-14 20:14:58

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [SOLVED] udev rule not working

Match on something better than KERNEL=="serio2"

E.g. the model number of the trackpoint. Use "udevadm info"

Offline

#3 2014-09-14 21:12:38

jeroentbt
Member
From: .be
Registered: 2014-03-29
Posts: 25

Re: [SOLVED] udev rule not working

There is not much to go with.
I'll try adding the 'description' attribute maybe.

$ udevadm info -a -p /sys/devices/platform/i8042/serio1/serio2

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/platform/i8042/serio1/serio2':
    KERNEL=="serio2"
    SUBSYSTEM=="serio"
    DRIVER=="psmouse"
    ATTR{resolution}=="200"
    ATTR{rate}=="100"
    ATTR{bind_mode}=="auto"
    ATTR{resync_time}=="0"
    ATTR{jenks}=="135"
    ATTR{reach}=="10"
    ATTR{speed}=="180"
    ATTR{ztime}=="38"
    ATTR{draghys}=="255"
    ATTR{description}=="Synaptics pass-through"
    ATTR{mindrag}=="20"
    ATTR{ext_dev}=="1"
    ATTR{skipback}=="0"
    ATTR{upthresh}=="255"
    ATTR{resetafter}=="5"
    ATTR{thresh}=="8"
    ATTR{protocol}=="TPPS/2"
    ATTR{press_to_select}=="0"
    ATTR{sensitivity}=="255"
    ATTR{inertia}=="6"
    ATTR{firmware_id}==""

  looking at parent device '/devices/platform/i8042/serio1':
    KERNELS=="serio1"
    SUBSYSTEMS=="serio"
    DRIVERS=="psmouse"
    ATTRS{resolution}=="200"
    ATTRS{rate}=="80"
    ATTRS{bind_mode}=="auto"
    ATTRS{resync_time}=="0"
    ATTRS{description}=="i8042 AUX port"
    ATTRS{resetafter}=="5"
    ATTRS{protocol}=="SynPS/2"
    ATTRS{firmware_id}=="PNP: LEN0015 PNP0f13"

  looking at parent device '/devices/platform/i8042':
    KERNELS=="i8042"
    SUBSYSTEMS=="platform"
    DRIVERS=="i8042"

  looking at parent device '/devices/platform':
    KERNELS=="platform"
    SUBSYSTEMS==""
    DRIVERS==""

EDIT:
tried with these two rules, no dice:

KERNEL=="serio2", ATTR{description}=="Synaptics pass-through", ATTR{speed}="180", ATTR{sensitivity}="255", RUN+="touch /tmp/udevtest"
ATTR{description}=="Synaptics pass-through", ATTR{speed}="180", ATTR{sensitivity}="255", RUN+="touch /tmp/udevtest"

Last edited by jeroentbt (2014-09-14 21:23:33)

Offline

#4 2014-09-14 21:22:39

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [SOLVED] udev rule not working

Yeah, try matching on *only*:

ATTR{description}=="Synaptics pass-through"

Offline

#5 2014-09-14 21:24:39

jeroentbt
Member
From: .be
Registered: 2014-03-29
Posts: 25

Re: [SOLVED] udev rule not working

My edit was to slow (see my previous post)
Unfortunatly that didn't work...

Offline

#6 2014-09-27 20:42:51

jeroentbt
Member
From: .be
Registered: 2014-03-29
Posts: 25

Re: [SOLVED] udev rule not working

I get this from journalctl:

Sep 27 22:38:02 zechs systemd-udevd[322]: failed to execute '/usr/lib/udev/touch' 'touch /tmp/udevtest': No such file or directory
Sep 27 22:38:02 zechs systemd-udevd[173]: error opening ATTR{/sys/devices/platform/i8042/serio1/serio2/sensitivity} for writing: Permission denied
Sep 27 22:38:02 zechs systemd-udevd[173]: error opening ATTR{/sys/devices/platform/i8042/serio1/serio2/speed} for writing: Permission denied

allthough

$ ls -al /sys/devices/platform/i8042/serio1/serio2/sensitivity 
-rw-r--r-- 1 root root 4096 Sep 27 22:43 /sys/devices/platform/i8042/serio1/serio2/sensitivity

And `touch` should create a file if it does not exist, no?

EDIT: should have looked at the logs more carefully.. when calling `/usr/bin/touch` in stead of just `touch` the file is created.
The rest though still fails.

Last edited by jeroentbt (2014-10-06 22:47:09)

Offline

#7 2014-10-07 11:42:10

jeroentbt
Member
From: .be
Registered: 2014-03-29
Posts: 25

Re: [SOLVED] udev rule not working

Solved...

The files in /sys I was trying to set simply did not exist yet when the rule was applied.

But udev apparently knows how to handle that with the WAIT_FOR param.
Here's the rule I'm using now with success:

SUBSYSTEM=="serio", DRIVERS=="psmouse", WAIT_FOR="/sys/devices/platform/i8042/serio1/serio2/speed", WAIT_FOR="/sys/devices/platform/i8042/serio1/serio2/sensitivity", ATTR{sensitivity}="255", ATTR{speed}="180"

Notice that I also changed the parameters to look for (ATTR{description} vs SUBSYSTEM/DRIVERS) as keeping the former would produce errors on boot.

Offline

#8 2015-07-20 11:42:33

jeroentbt
Member
From: .be
Registered: 2014-03-29
Posts: 25

Re: [SOLVED] udev rule not working

Well, this stopped working for me.
Running

udevadm test  /sys/devices/platform/i8042/serio1/serio2/

says "WAIT_FOR" is an unsupported key.
There is indeed no more mention of this key in de udev man page.
And then there's this: http://lists.freedesktop.org/archives/s … 33485.html ...

Maybe best to start a new thread. Can be found here

Readers be advised. WAIT_FOR is no longer supported

Last edited by jeroentbt (2015-07-20 12:09:13)

Offline

#9 2015-08-18 09:07:47

jakob
Member
From: Berlin
Registered: 2005-10-27
Posts: 419

Re: [SOLVED] udev rule not working

Wow, last night I realised I was having the exactly same problem (I'll reprint it here to do some SEO):

Reading rules file: /etc/udev/rules.d/10-trackpoint.rules
unknown key 'WAIT_FOR' in /etc/udev/rules.d/10-trackpoint.rules:1
invalid rule '/etc/udev/rules.d/10-trackpoint.rules:1'

Started to think I was getting crazy since I also couldn't find anything on wait_for being depreceated, but so glad you were more successful!

Offline

Board footer

Powered by FluxBB