Page 1 of 1

LIRC use IR-Remote in Shell

Posted: Sat Oct 19, 2013 9:44 am
by Thomas7

first, i am sorry because of my bad englisch. I will try my best that you could understand me.

I have a big problem and i hope some of you guys can help me.

My problem is that i would like to use an IR-Remote to send keyboard keys.

Background: I have a shell script where i use the "read" command to make some actions when i press a keyboard button.
Now i would like to use these buttons with the IR-Remote. LIRC is working.
But i donĀ“t know how to use the LIRC to use the IR-Buttons lile Keyboard Buttons.
If i press the button "t" at the keyboard my script is doing some action i.e. shutding down a process.
Now i would like to use the IR-Remote. If i press "Key_Red" use it as i press the "t" at the keyboard.

Is that possible?

Thank you very much

Re: LIRC use IR-Remote in Shell

Posted: Sat Oct 26, 2013 6:33 am
by mba
Hi Thomas,

that is very much possible :-) Using a builtin function of lirc it is possible to execute commands of your choice.
First you need a lircrc file either in your home folder called .lircrc or in /etc/lirc/ called lircrc without the '.'

Try with putting this into the file:

Code: Select all

 prog = irexec
 remote = mceusbou 
 button = OK
 config = echo "You just pressed 'OK'!" > /var/run/lircrcoutput
This will start the problem irexec which is part of the LIRC package. When irexec sees an "OK" command from the "mceusb" remote it will execute the command specified under config. Change the remote and key to something that makes sense on your system. Then restart lirc with:
sudo /etc/init.d/lirc restart
Press the remote button and check that the file /var/run/lircrcoutput with the content "You just pressed 'OK'!" was actually created.

For detailed information I will recommend looking here

Best regards