You are not logged in.

#1 2012-08-16 03:42:49

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

[Solved] Systemd: /etc/rc.local Functionality (TrackPoint settings)

Howdy-ha, folks.   So after getting a Thinkpad some months back I went over to Thinkwiki and set persistent settings for the Trackpoint, eventually using the sysfs method as it was the simplest, and stuck the strings there (with modifications) in /etc/rc.local.  With the transition to systemd the file /etc/rc.local no longer exists, so I'm looking to replicate its functionality.  For the time being I'm using the instructions found here, but I'm not sure if this is the best method (the unit file described doesn't exist, though a broke symlink for it did; I suspect it was part of the initscripts-systemd compatibility package).  I'm just curious: Is this the cleanest solution to the problem?  I could try out the udev rule method (don't really want to do that, as I never got it working) or the xorg.conf method (really don't want that, as it's deprecated).  It's definitely the easiest, since I was ready to sit down and learn how to write a custom .service file, which I am willing to do. 

Note that I'm only concerned with speed and sensitivity of the pointing device; clicking and scrolling work out-of-the-box.  Is it possible to call "echo" from a systemd unit (or, more to the point, to call multiple ExecStart values), and remove the rc.local abstraction?  I suspect the answer is somewhat obvious, so a point in the right direction should do.*  smile Thanks in advance.

* Despite my generally positive stance on systemd at the moment, the man pages are kinda all over the place.

Last edited by ANOKNUSA (2012-09-07 19:00:55)

Offline

#2 2012-08-16 04:01:58

Wibjarm
Member
Registered: 2012-05-04
Posts: 43

Re: [Solved] Systemd: /etc/rc.local Functionality (TrackPoint settings)

Have a look at the man page for tmpfiles.d, I'm pretty sure that's exactly what you're looking for as far as sticking values into files in sysfs on boot.  Also, in general you can stick '/bin/sh -c' in as the ExecStart to do whatever you want, including echoing things and redirecting it into files, and chain them together with a semicolon in between.  For a silly example:

[Unit]
Description=Test echoing into files

[Service]
Type=oneshot
ExecStart=/bin/sh -c 'echo "It works" > /home/rob/testfile' ; /bin/sh -c 'echo "like a charm!" >> /home/rob/testfile'

Last edited by Wibjarm (2012-08-16 04:31:55)

Offline

#3 2012-08-16 14:34:14

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,138
Website

Re: [Solved] Systemd: /etc/rc.local Functionality (TrackPoint settings)

To change the trackpoint settings, i use a .service that is activated with the graphical.target . Usually you do not need the trackpoint outside of the graphical environment.
I also tried the tempfiles solution , but it was unreliable.

Offline

#4 2012-08-16 15:19:30

progandy
Member
Registered: 2012-05-17
Posts: 5,196

Re: [Solved] Systemd: /etc/rc.local Functionality (TrackPoint settings)

Why are you calling the shell twice? Did you already try it with one shell? Just make sure there is no space in front of the semicolon.

ExecStart=/bin/sh -c 'echo "It works" > /tmp/testfile; echo "like a charm!" >> /tmp/testfile'

Last edited by progandy (2012-08-16 15:20:21)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#5 2012-08-16 15:21:21

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: [Solved] Systemd: /etc/rc.local Functionality (TrackPoint settings)

don't use service files to echo stuff into files, use tmpfiles.
@teateawhy: how exactly were tmpfiles "unreliable" for you?

Offline

#6 2012-08-16 17:16:13

Wibjarm
Member
Registered: 2012-05-04
Posts: 43

Re: [Solved] Systemd: /etc/rc.local Functionality (TrackPoint settings)

Yeah, I know you can also just call the shell once, that was just a silly example of chaining together separate ExecStart commands.

Offline

#7 2012-08-20 20:34:37

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: [Solved] Systemd: /etc/rc.local Functionality (TrackPoint settings)

Thanks for the responses, folks; I haven't had much opportunity these last few days to look into this; I'll get on tmpfiles.d when I get the chance.

@teateawhy: I start DWM from a command line, so graphical.target is unnecessary for me.

Offline

#8 2012-09-07 19:00:15

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: [Solved] Systemd: /etc/rc.local Functionality (TrackPoint settings)

Alright, so I finally got around to writing up a tmpfile for this, and it works like a charm.  Folks using Thinkpads in the future can use the following for persistent TrackPoint  settings:

/etc/tmpfiles.d/tpoint.conf

w /sys/devices/platform/i8042/serio1/speed - - - - 215
w /sys/devices/platform/i8042/serio1/sensitivity - - - - 230

Just change the integers to suit your own taste.  Thanks for the pointers, everyone.

Offline

#9 2012-09-11 20:46:15

Laputa
Member
Registered: 2012-06-16
Posts: 5

Re: [Solved] Systemd: /etc/rc.local Functionality (TrackPoint settings)

I'm also using thinkpad, but i think it's not the best way to do so. Some thinkpads udev and create the files pretty late after boot.

if the file haven't been created before exec the tmpfiles.d.  It wouldn't work!! (that's what happened to my thinkpad).

When i'm using rc.local previously, adding a timer "sleep 5" maybe a solution. but using tmpfiles.d, there's no way to add a delay execution.

so the best way is here:

/etc/udev/rules.d/trackpoint.rules

SUBSYSTEM=="serio", DRIVERS=="psmouse", WAIT_FOR="/sys/devices/platform/i8042/serio1/serio2/sensitivity", ATTR{sensitivity}="200", ATTR{speed}="150"
ANOKNUSA wrote:

Alright, so I finally got around to writing up a tmpfile for this, and it works like a charm.  Folks using Thinkpads in the future can use the following for persistent TrackPoint  settings:

/etc/tmpfiles.d/tpoint.conf

w /sys/devices/platform/i8042/serio1/speed - - - - 215
w /sys/devices/platform/i8042/serio1/sensitivity - - - - 230

Just change the integers to suit your own taste.  Thanks for the pointers, everyone.

Offline

Board footer

Powered by FluxBB