LIRC

From MythTV Official Wiki
Revision as of 13:09, 12 September 2006 by Cgappleton (talk | contribs) (Set up)

Jump to: navigation, search

LIRC stands for Linux Infrared Remote Control.

So you want to control MythTV with your remote from the couch, eh? Well LIRC will help...

LIRC is a program that gives your computer the ability to send and receive infrared remote signals. Most distributions include LIRC packages, but you may have to compile your own version of the program to use certain features that the packagers did not include.

Basics

In it's most basic concept, you press the 'play' button on your remote control which sends an infrared signal to an infrared receiver connected to your computer. This infrared receiver sends a signal to LIRC, which identifies that you hit the 'play' key on your remote and then generates a keystroke on your computer that instructs MythTV to play.

For the infrared receiver, you have 2 choices about how you set it up to work with mythtv:

  • Using irxevent which is an external program that can send key presses to Mythtv as if you were pressing keys on the keyboard. irxevent reads ~/.lircrc (note the dot at the start of the filename)
  • Use mythtv native LIRC support, where mythtv reads ~/.mythtv/lircrc for its own key configuration (note no dot at the start of the filename)

In simple terms, this is what happens to the infrared (IR) signal and how it gets to mythtv:

  • The IR signal is received by an IR receiver that is configured as a device in linux to receive it. This may be an IR receiver physically attached using a serial port, USB, or a dedicated chip on a tuner card. Each different type of physical IR receiver has its own type of kernel module. The signals are usually routed through /dev/lirc or /dev/lirc0.
  • The lircd process which is running in the background gets the signal information, and translates it to a button name (e.g. CH+), using the information in /etc/lircd.conf
  • irexec gets the button name and translate it into a key press to be passed on to mythtv or other software, or mythtv runs its own IR client process to do the translation. In this case CH+ might be passed on to mythtv as Up.
  • Note that the button names in /etc/lircd.conf must match the "button" configuration names you use in your lircrc file, but are otherwise completely up to you. The translations between the button names and the mythtv's internal names is done in the .lircrc or lircrc file, in the "config" line for a button. The "config" names must match what mythtv is expecting, and for the mythtv native LIRC support the "prog" line must say "prog = mythtv".

The concept of a transmitter is a little more complex. You might want to use a transmitter if, for instance, you want MythTV to control a cable/satellite box so it can record the right shows on the right channels. Let's say LIRC just sent 'Channel +' keystroke to MythTV (like detailed above). MythTV then sends a signal back to LIRC instructing it to transmit a 'Channel +' command to the cable box. The infrared transmitter on your computer then emits an infrared signal to your cable box instructing it to change the channel + (just as if you had pressed the channel + key on the original cable remote). http://mythblasterz.gotdns.com/ Mythblasterz has some for sale.

The transmitter and receiver mentioned above are two separate devices (sometimes packaged into a single box). You cannot transmit through a receiver or receive through a transmitter.

--indulis 04:10, 27 June 2006 (UTC) added some overview info

Set up

Setting up LIRC can range from very easy to incredibly difficult. The difficulty level is likely related to what hardware you end up using for LIRC. There are several different hardware pieces for receiving and sending LIRC commands. A few are:

  • The receiver that comes with your TV card. For example, the PVR series from Hauppauge sometimes have a receiver.
  • A Serial Port reciever you can make yourself or buy for a small fee (Often called a homebrew reciever) I have made a list of homebrew lirc receiver parts that are readily available at RadioShack.
  • A Serial Port transmitter you can make yourself or buy for a small fee (called a homebrew transmitter)
  • A commercially available USB reciever.
  • A USB reciever you can make yourself.

It should be noted also that some people bypass the need for lirc altogether, and simply 'train' infrared codes from an infrared keyboard to their universal remote control. This way, pressing a key on your universal remote control would be picked up by the infrared keyboard's sensor, and pass the keystroke directly to MythTV as if you had been using an actual keyboard and not a remote at all.

For Help Setting up LIRC on your computer, follow some of these excellent resources:


lirc + 2.6.16 kernel:

As of 5/10/06 you must patch lirc-0.8 to work with the 2.6.16 kernel. Patch can be found here:

Additional info:

I have built several homebrew recievers, and it is a fun project. If you are faint-of-heart when around soldering irons and little resistors, then you might want to check out some of these sites that offer pre-built models:

-- Dave Hofstra

Key things to remember

  • If you're using a PVR-350, at least, it won't work with stock LiRc. You need 0.7.0 (as mentioned in Jarod's Guide)
  • If you're using a PVR-500MCE, please read this page: MCE_Remote
  • Set up /etc/lircd.conf to fit your remote.
  • Use the irw program to see whether LiRc and your remote are working before going any further. It shows what events are generated by your remote. This is very helpful!
  • Set up ~/.mythtv/lircrc with the keys that are needed for MythTV and MPlayer
  • Setup ~/.lircrc for Xine. I have the ~/.mythtv/lircrc be a softlink to ~/.lircrc. See my lircrc for a MythTV + Xine lircrc suggestion using the Hauppauge Grey remote.
  • Don't try to use a lircrc file written for irxevent if you are trying to use mythtv native lirc support, instead search for mythtv/configfiles/hauppauge-lircrc-nativelirc to use as a template. Even better, use Mythtv-lircrc-Dapper as the basis for your own file.

-- Peter Morch

I use KnoppMyth and it worked out of the box for me with a Homebrew transmitter & receiver.

I use this SKY channel changer script with Sky in the UK - my sky box doesn't always change channels so it does it twice :) It also has 'locking' and works with the SKY dog remover script. I the ideas for this from a website somewhere.

-- David Greaves

LIRC 2.6

LIRC26 is how I installed Lirc (well, the lirc_serial driver) under 2.6.4 and 2.6.6

Lirc on Ubuntu Dapper is how I installed Lirc under a Ubuntu Dapper system with kernel 2.6.15