How to execute command with lirc / irexec?

The button I want to map to a command is this

$ irw
20b 0 KEY_NUMERIC_POUND linux-input-layer

So I’ve tried creating both a ~/.lircrc and /etc/lirc/lircrc containing

begin
 prog = irexec
 remote = linux-input-layer
 button = KEY_NUMERIC_POUND
 config = echo "You just pressed 'KEY_NUMERIC_POUND'!" > /var/run/lircrcoutput
end

I also tried remote = mceusb. Is lirc implemented in OSMC to where it doesn’t look at these files? If so - how would I accomplish this?

1 Like

A bit more searching and I stumbled on a solution. Add this to /etc/rc.local before exit 0

/usr/bin/irexec -d /etc/lirc/lircrc

Thanks for pointing this out. I wasn’t aware we needed to run irexec as a daemon for this to work.

We have some ideas on how we could run irexec as a boot time daemon, but only if there is a lircrc file with a prog = irexec entry in it, so that it doesn’t run unnecessarily on the 99% of systems that don’t need irexec. It’s a low priority but you may see this on a future update.

Sounds good. Always glad to help out. :slight_smile: