You are not logged in.

#1 2014-10-20 20:53:06

FlashG0rd0n
Member
Registered: 2014-10-20
Posts: 2

Dockingstation with udev and systemd

Hello,

first: sorry for my bad english... the last time i have practise my english was in school :-)

now my problem:
i try to setup a udev-rule for my thinkpad T61 when the latptop is (un)docked from the station.
i try a lot of thinks... RUN+=" and such stuff -- but my script takes very long time (Setup Interface, WakeOnLAN, multiple cryptet mounts from my homeserver etc.) and killed by systemd after a while.

related to this (jasonwryan.com -- Scripting with udev) and this (bbs.archlinux.org -- Automating a script for a usb device on systemd?) i create a udev-rule like this:

/etc/udev/rules.d/10-thinkpad-dock.rules:

TAG+="systemd", SUBSYSTEM=="platform", KERNEL=="dock.3", ACTION=="change", ENV{SYSTEMD_READY}="1", ENV{SYSTEMD_USER_WANTS}="dock.service"

and a service-file like this:

/etc/systemd/user/dock.service

 
[Unit]
Description=User docking actions
After=graphical.target sys-devices-platform-dock.3.device

[Service]
Type=simple
Restart=always
Environment=DISPLAY=:0.0
Environment=XAUTHORITY=/home/emilia/.Xauthority
ExecStart=-/usr/local/sbin/tp-dock


[Install]
WantedBy=graphical.target sys-devices-platform-dock.3.device

the problem is, the script runs only once at the first docking-action after a reboot. the other times nothing happens and also the logs are empty.

Any suggestions and/or help please?

Offline

#2 2016-01-29 21:01:02

aiguofer
Member
Registered: 2011-10-09
Posts: 32

Re: Dockingstation with udev and systemd

Hey, sorry to revive an old thread, but did you ever figure this out? I'm stuck trying a very similar thing... I can get it working using

...RUN+="systemctl start <service>@<user>.service"

and putting my unit file in /etc/systemd/system/<service>@.service and adding User=%u in the [Service] block. However, this blocks my startup if I'm docked and causes some other weird anomalies. I'd really like to just make this a user service and run it 'the right way'.

Offline

Board footer

Powered by FluxBB