Welcome to the Linux Foundation Forum!

Reading keystrokes when running as a service


Newbe here so be gentle.

I want to capture keystrokes send out by the FLIRC dongle and toggle some GPIO pins accordingly. I made a script file which works fine when I run it from the command line. But it doesn't work when it runs as a service. I think it doesn't receive any keystrokes at all. Basically, what I've done is this:

while true
read -n 1 ir_code

case $ir_code in
echo "... inschakelen"
echo 1 > /sys/class/gpio/gpio200/value
sleep 2
echo 1 > /sys/class/gpio/gpio91/value
echo "Uitschakelen ..."
echo 0 > /sys/class/gpio/gpio91/value
sleep 2
echo 0 > /sys/class/gpio/gpio200/value


How can I make this work when running as a service?


Upcoming Training