SystemD service for executing commands with CEC / remote control
-
Install
cec-utilswith# apt-get install cec-utils. -
Copy
cec-input.serviceto/etc/systemd/system. -
Reload the daemon with
# systemctl daemon-reload -
Start the service with
# systemctl start cec-input. -
Run
# journalctl -fu cec-input. -
Press the keys on your remote and watch the output. Direction keys tend to work, along with OK, back, exit and the 4 coloured buttons.
-
Assign your commands to keys in
/etc/systemd/system/cec-input.env. The format iskey='command'per line e.g.back='systemctl start getty@tty6'will startgetty@tty6when the key reported asbackin thejournalctloutput is pressed. -
Restart the service after adding new keys:
# systemctl daemon-reload
# systemctl restart cec-input
- Enable the service to run on boot if it works as intended with
# systemctl enable cec-input.
Note: stop the service if it conflicts with CEC input in other applications that offer their own CEC handler.