Thomas7
Posts: 1
Joined: Sat Oct 19, 2013 9:39 am

LIRC use IR-Remote in Shell

Sat Oct 19, 2013 9:44 am

Hello,

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.
Example:
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
Regards
Thomas

mba
Posts: 110
Joined: Fri Jun 08, 2012 7:05 pm
Location: Denmark

Re: LIRC use IR-Remote in Shell

Sat Oct 26, 2013 6:33 am

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

begin
 prog = irexec
 remote = mceusbou 
 button = OK
 config = echo "You just pressed 'OK'!" > /var/run/lircrcoutput
end
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
Martin
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

Return to “Beginners”