FS#31890 - [lirc-utils] Systemd 'lirc.service' does not read /etc/conf.d/lircd.conf
Attached to Project:
Arch Linux
Opened by Paolo (palmaway) - Thursday, 11 October 2012, 00:13 GMT
Last edited by Tobias Powalowski (tpowa) - Tuesday, 08 October 2013, 14:53 GMT
Opened by Paolo (palmaway) - Thursday, 11 October 2012, 00:13 GMT
Last edited by Tobias Powalowski (tpowa) - Tuesday, 08 October 2013, 14:53 GMT
|
Details
Before the switch to systemd, the /etc/rc.d/lirc.d daemon
script would read the file /etc/conf.d/lircd.conf in order
to get custom options. In particular, this is used to
configure the device LIRC should listen to, and set the
driver (most commonly, to 'devinput'). The provided systemd
'lirc.service' does not read these options anymore. Since
LIRC does not have a configuration file for these settings
(files in /etc/lirc/ are used for other purposes), it is
impossible to configure most systems, since the default
device /dev/lirc0 is usually not available under Arch.
Additional info: * package version: 1:0.9.0-30 * config files: /etc/conf.d/lircd.conf which contains arguments that need to be passed to lircd Steps to reproduce: - configure some options in /etc/conf.d/lircd.conf - restart the daemon with: # systemctl restart lirc.service - the options are not passed to the daemon Possible solution: I overwrote the service file with my own in /etc/systemd/system (see below), and this partially solves the problem. However, this oviously does not work when variables in /etc/conf.d/lircd.conf are not set, so a general solution like the one implemented by the /etc/rc.d/lirc.d script is needed. Output of systemd-delta: [OVERRIDDEN] /etc/systemd/system/lirc.service → /usr/lib/systemd/system/lirc.se --- /usr/lib/systemd/system/lirc.service 2012-10-06 12:32:07.000000000 + +++ /etc/systemd/system/lirc.service 2012-10-11 01:51:08.334578131 +0200 @@ -2,8 +2,9 @@ Description=Linux Infrared Remote Control [Service] +EnvironmentFile=/etc/conf.d/lircd.conf ExecStartPre=/usr/bin/ln -sf /run/lirc/lircd /dev/lircd -ExecStart=/usr/sbin/lircd --pidfile=/run/lirc/lircd.pid +ExecStart=/usr/sbin/lircd --pidfile=/run/lirc/lircd.pid --device=${LIRC_DEVICE} --driver=${LIRC_DRIVER} Type=forking PIDFile=/run/lirc/lircd.pid |
This task depends upon
Closed by Tobias Powalowski (tpowa)
Tuesday, 08 October 2013, 14:53 GMT
Reason for closing: Not a bug
Tuesday, 08 October 2013, 14:53 GMT
Reason for closing: Not a bug
In order for this change to work, /etc/conf.d/lircd.conf will need to be modified so LIRC_DRIVER="default". Otherwise, lircd will exit with an error, stating that the driver '' isn't supported. Assuming the change to lirc.service is made to the installed files, the change to lirc.conf will also need to be made in order to prevent the default installation from failing.
I opened a bug about it over a year ago (https://bugs.archlinux.org/task/23673) but nothing came of it.
@Aaron: Install v4l-utils and understand what /usr/lib/udev/rules.d/70-infrared.rules does. Try your own rule for your purpose in /etc/udev/rules.d (ir-keytable --protocol=LIRC) or try to adjust /etc/rc_maps.cfg to force the lirc protocol (if the latter is even possible, I'm not sure). Keeping RC6 protocol should be the better solution. If you rely on a LIRC daemon use RC6 protocol and start lircd using devinput driver, the appropriate rc device node in /dev/input/by-path/... and the key table /usr/share/lirc/remotes/devinput/lircd.conf.devinput.
Edit: +1 for fine sane defaults for the service
[Unit]
Description=LIRC Daemon
After=network.target
[Service]
Type=forking
EnvironmentFile=/etc/conf.d/lircd.conf
PIDFile=/run/lirc/lircd.pid
ExecStartPre=/bin/mkdir -p /run/lirc
ExecStartPre=/bin/rm -f /dev/lircd
ExecStartPre=/bin/rm -f /run/lirc/lircd
ExecStartPre=/bin/ln -s /run/lirc/lircd /dev/lircd
ExecStart=/usr/sbin/lircd -d $LIRC_DEVICE -P /run/lirc/lircd.pid -H $LIRC_DRIVER $LIRC_CONFIGFILE
ExecStopPost=/bin/rm -f /dev/lircd
ExecStopPost=/bin/rm -fR /run/lirc
[Install]
WantedBy=multi-user.target
no need to override the service file from lirc-utils package, just don't enable lirc.service, instead enable lircd.service.
FS#32354FS#32336andFS#32275. Systemd wont work with /etc/conf.d."Not using an EnvironmentFile= is OK if:"
1. "Either the daemon has its own configuration file where the same settings can be specified"
-> lircd has NOT own a configuration file, these settings cannot be specified elsewhere.
2. "The default service file "just works" in the most common case. Users who want to change the behavior should then override the default service file. If it is not possible to provide a sane default service file, it should be discussed on a case-by-case basis"
-> The lirc.service file does NOT work in the most common case, because most users have to set the device file and driver for lircd. lircd is unable to detect the proper configuration without specifying it with command line parameters.
[1] https://wiki.archlinux.org/index.php/DeveloperWiki:Systemd#Units
diff /etc/systemd/system/lirc.service /usr/lib/systemd/system/lirc.service
5,6d4
< EnvironmentFile=/etc/conf.d/lircd.conf
< ExecStartPre=/usr/bin/ln -sf /dev/lirc0 /dev/lirc
In the same idea, the /usr/lib/systemd/system/irexec.service must change like this
- ExecStart=/usr/bin/irexec --daemon
+ ExecStart=/usr/bin/irexec --daemon /etc/lirc/irexec.conf
this is a idea to have a global config to execute script with IR remote
Create "/etc/systemd/system/lirc.service.d/device.conf" (filename doesn't matter aside from the .conf suffix)
Add:
[Service]
ExecStart=
ExecStart=/usr/bin/lircd --whatever --goaway