From: Daniel Frey <djqfrey@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: [gentoo-user] systemd unit executing but not persistent later in boot
Date: Sat, 6 Apr 2024 18:32:07 -0700 [thread overview]
Message-ID: <395ad795-24c9-4f78-b0f9-75119e859ddf@gmail.com> (raw)
Hi all,
Still new to systemd and am struggling with a custom unit file.
Some background:
I have a HTPC that requires loading a custom keymap in order for the
remote to work. It sets up an alternate protocol that the driver
supports but not defaults to.
In short:
# ir-keytable
Found /sys/class/rc/rc0/ with:
Name: iMON Remote (15c2:0038)
Driver: imon
Default keymap: rc-imon-pad
Input device: /dev/input/event8
LIRC device: /dev/lirc0
Supported kernel protocols: rc-6 imon
--> Enabled kernel protocols: imon
bus: 3, vendor/product: 15c2:0038, version: 0x0001
Repeat delay = 500 ms, repeat period = 125 ms
This protocol needs to change to rc-6. This is done by a simple command:
/usr/bin/ir-keytable -c -p rc-6 -w /etc/rc_keymaps/imon_mce.toml
So my thought was to create a custom Unit:
[Unit]
Description=Add custom keymap to iMon remote
[Service]
ExecStart=/bin/bash -c "exec /usr/bin/ir-keytable -c -p rc-6 -w
/etc/rc_keymaps/imon_mce.toml"
I've called it ir-key-map.service.
I can see through the status that it is indeed running and applying the
keymaps and protocol changes:
# systemctl status ir-key-map
○ ir-key-map.service - Add custom keymap to iMon remote
Loaded: loaded (/etc/systemd/system/ir-key-map.service; enabled;
preset: disabled)
Active: inactive (dead) since Sat 2024-04-06 18:17:43 PDT; 6min ago
Duration: 46ms
Main PID: 292 (code=exited, status=0/SUCCESS)
CPU: 12ms
Apr 06 18:17:43 htpclivingrm systemd[1]: Started Add custom keymap to
iMon remote.
Apr 06 18:17:43 htpclivingrm bash[292]: Read imon_mce table
Apr 06 18:17:43 htpclivingrm bash[292]: Old keytable cleared
Apr 06 18:17:43 htpclivingrm bash[292]: Wrote 76 keycode(s) to driver
--> Apr 06 18:17:43 htpclivingrm bash[292]: Protocols changed to rc-6
Apr 06 18:17:43 htpclivingrm systemd[1]: ir-key-map.service:
Deactivated successfully.
As the output says, it ran successfully.
lircd also is running after this unit like it's supposed to (snipped
from `journalctl --unit lircd`:
Apr 06 18:17:43 htpclivingrm systemd[1]: Starting Flexible IR remote
input/output application support...
However, the remote does not work.
When I log in and check:
# ir-keytable
Found /sys/class/rc/rc0/ with:
Name: iMON Remote (15c2:0038)
Driver: imon
Default keymap: rc-imon-pad
Input device: /dev/input/event8
LIRC device: /dev/lirc0
Supported kernel protocols: rc-6 imon
ARGH --> Enabled kernel protocols: imon
bus: 3, vendor/product: 15c2:0038, version: 0x0001
Repeat delay = 500 ms, repeat period = 125 ms
It's like the unit is running in an isolated environment or something
which is not at all helpful.
What's even stranger is if I manually start it and restart lircd it works!
`systemctl start ir-key-map`
`systemctl restart lircd`
...and it is set up normally and the remote works:
# systemctl start ir-key-map
# systemctl restart lircd
# ir-keytable
Found /sys/class/rc/rc0/ with:
Name: iMON Remote (15c2:0038)
Driver: imon
Default keymap: rc-imon-pad
Input device: /dev/input/event8
LIRC device: /dev/lirc0
Supported kernel protocols: rc-6 imon
YAY --> Enabled kernel protocols: rc-6
bus: 3, vendor/product: 15c2:0038, version: 0x0001
Repeat delay = 500 ms, repeat period = 125 ms
So why does this not work at boot time? Are these units spawned in an
environment on their own and thusly not modifying the main system?
I'm quite confused.
In openrc I just edited /etc/init.d/lircd and put the ir-keytable
command in it before lircd was started and it was working fine.
Can someone give some pointers?
Dan
next reply other threads:[~2024-04-07 1:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-07 1:32 Daniel Frey [this message]
2024-04-07 1:38 ` [gentoo-user] systemd unit executing but not persistent later in boot Andrew Udvare
2024-04-07 16:01 ` Daniel Frey
2024-04-07 19:59 ` Daniel Frey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=395ad795-24c9-4f78-b0f9-75119e859ddf@gmail.com \
--to=djqfrey@gmail.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox