Difference between revisions of "LIRC"

From MythTV Official Wiki
Jump to: navigation, search
(Added info about getting LIRC to play with mythtv under Ubuntu 9.10 Karmic Koala)
 
(66 intermediate revisions by 29 users not shown)
Line 1: Line 1:
{{Wikipedia}}
+
{{User Manual TOC}}
'''LIRC''' stands for Linux Infrared Remote Control.
 
  
So you want to control MythTV with your remote from the couch, eh? Well LIRC will help...
+
{{UpToDate 0.27}}
[[Image:Lirclogo.gif|right]]
 
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.
 
  
It should be noted that many people bypass the need for lirc altogether, and simply use a "learning remote control" and a infrared keyboard receiver. Train the learning remote control to output the appropriate keyboard press for each button/label. Linux and MythTV will not know any better and you have a simple and staightforward infrared controller.
+
{{Wikipedia}}
  
Why would you use LIRC with MythTV? To utilise a generic non-learning remote control with MythTV and/or to enable MythTV to receive commands from a remote control and then use that information to control other bits of equipment (via IR, WIFI, LAN, Bluetooth, RS232 or whatever)...  
+
==Introduction==
 +
'''LIRC''' stands for Linux Infrared Remote Control. It is required to use certain Remote Controls with MythTV.
  
In many installations the MythTV backend/frontend server is hidden in a cupboard. Often just the IR receiver is in the same room as the TV display and all the AV equipment is in a nearby closet. In this scenario the IR receiver must pickup a command in the living room from a proprietary tv tuner card remote control and IR receiver (a command such as volume-up) LIRC understands this but the volume is not controlled by the computer, but by a high quality amplifier. LIRC must then be configured to transmit a (different) IR code (to that which was received and to equipment within the closet) to control the amplifier and increase the volume.
+
LIRC is not easy to set up. Remote controls that work by keyboard control, either using a keyboard emulator or built in drivers using evdev are preferable. For details of the available options see [[User Manual:Setting Up#Remote_controls]].
  
 +
Before you start down the LIRC path validate whether your remote will work in some way as a keyboard emulator. [[Remote_Control#Check if your remote emulates a keyboard]].
  
== Basics ==
+
If you need to use an IR blaster to change channels on a set top box you may have to use LIRC, since there is no built in support in Linux for those.
=== IR Reception (to MythTV) ===
 
In its 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:
+
LIRC is a software package that gives your computer the ability to send and receive infra-red remote control signals when combined with appropriate hardware.  Most distributions include LIRC packages, but you may have to compile it yourself if you wish to use certain features that the distribution packagers did not include.
* Using [http://www.lirc.org/html/irxevent.html '''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) (Note: As of 0.21 Mythtv will read ~/.lircrc if ~/.mythtv/lircrc does not exist).  ''This is vastly preferable.''
 
  
In simple terms, this is what happens to the infrared (IR) signal and how it gets to mythtv:
+
==Hardware==
* A remote control ''(A)'' emits pulses of infra-red light signals that are seen by an IR receiver ''(B)'' that is connected to your computerThe receiver may be connected to the computer via a serial port, over USB, or by a dedicated chip built into a TV tuner card.  Each different type of physical IR receiver has its own type of kernel module.
+
There are several different hardware pieces for receiving and sending LIRC commands. A few are:
[[Image:Rect32603.png|center]]
+
* The receiver that comes with your TV cardFor example, the [[HD-PVR]] series from Hauppauge sometimes have a receiver.
* The kernel module ''(C)'' uses /dev/lirc (typically) to emit the pulse-length information, which is then parsed by the lircd process. The LIRC daemon ''(D)'' then uses the information from /etc/lircd.conf ''(E)'' to convert the pulse-lengths into button press information.
+
*  A [[Using_an_IR_Blaster_with_MythTV|Serial Port transmitter]] you can make yourself or buy for a small fee (called a homebrew transmitter)
[[Image:Rect32606.png|center]]
+
A commercially available USB receiver (e.g. [[MCE Remote|Microsoft MCE]] remote control). Note that some of these may emulate a keyboard, which eliminates the need for LIRC and may make your life much easier. Some which previously required LIRC have now been added to the kernel and are supported using [[User Manual:IR control via evdev|evdev]].
* Lastly, all programs that use LIRC need a ''second'' configuration file which tells liblirc_client.so what button presses are to be translated into which commands for ''each'' client program using LIRC, including MythTV.  Once the button presses have been converted into instructions by liblirc_client.so using the lircrc ''(F)'' file (~/.mythtv/lircrc in 0.20, but 0.21 will read ~/.lircrc as well), ''then'' they are ready to be used by MythTV. ''(G)''
+
*  A USB receiver you can make yourself.
[[Image:Rect32607.png|center]]
+
* [http://www.lirc.org/parallel.html A Parallel Port transmitter and/or receiver] you can make yourself.
* 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".  This can be debugged with ircat (invoked as `ircat mythtv`).
+
* http://www.irblaster.info/ Sells both blasters and receivers that work with lirc at a reasonable price
 
+
* http://www.iguanaworks.net/ sell combination blaster / receivers that can drive multiple devices
=== IR Transmission (from MythTV) ===
+
* http://dangerousprototypes.com/docs/USB_Infrared_Toy Works with LIRC 0.9.3a. Receives and sends IR signals.
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).
+
* Refer to http://www.lirc.org/ where there is a list of available devices that work with LIRC.
 
 
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.
 
 
 
[http://www.eggshellskull.com/lirc/blaster/index.php Controlling a digital cable/satellite box using Fedora, MythTV, an IR Blaster and one instance of LIRC]
 
  
===LIRC with Multiple External Tuners===
+
==Installing LIRC==
If you are using a system with multiple external tuners, you can use LIRC to control each one independently.  The proper [http://www.lirc.org/html/irsend.html irsend] command for each tuner can be placed in a separate channel changing script, and then specified as an external channel changing program for the appropriate video source in the [[Mythtv-setup]] program. 
+
Check whether your distribution includes LIRC and the version:
  
Normally, only a single LIRC transmitter is required as long as each of the tuners have mutually exclusive remote codes, and the LIRC transmitter can placed in the line of sight of all tuners' IR receivers.  In this configuration, each tuner will need a "Remote Block" setting in the [http://winlirc.sourceforge.net/technicaldetails.html lircd.conf] file and irsend simply needs the correct <code>REMOTE</code> argument.  This is probably the simplest solution to most multiple tuner systems.
+
On an Ubuntu or Debian derivative system:
 +
<pre>
 +
sudo apt-get update
 +
apt-cache showpkg lirc
 +
</pre>
  
However, there are some instances where unique control codes aren't possible, or simultaneous line of sight to the two receivers is not possibleIn these cases, there are some options available:
+
If your distribution includes an outdated version of LIRC, you may need to build it yourself. Please refer to http://www.lirc.org/. The [http://www.lirc.org/html/index.html LIRC Documentation] page has a complete description of how to build, install and configure LIRC.   
  
* [http://www.freelancelogic.com/Projects/lirc_pport/lirc_pport_mod.html Build a Multi-Transmitter Homebrew Parallel Port Device]  and use irsend's <code>SET_TRANSMITTER</code> directive.
+
If your distribution has an outdated version of LIRC or one that has the wrong options built in you may need to download the source from lirc.org and compile it yourself.
  
* [http://www.lirc.org/html/configure.html Load multiple LIRC drivers] using irsend's <code>--device</code> option. For some drivers, including lirc_serial ([http://www.mythtv.org/wiki/index.php/Using_an_IR_Blaster_with_MythTV IR Blaster], etc.), this method won't work with multiple transmitters of the same type.
+
You may also need to install specific device drivers for the device itself. Those need to be found on the device vendor's web page.
  
* [http://losdos.dyndns.org:8080/public/mythtv-info/IR-BLASTER-HOWTO.html Modify the source tree to support multiple instances of the LIRC driver] and use 2 separate copies of irsend compiled.
+
To help with installing you can use the [https://help.ubuntu.com/community/CheckInstall checkinstall] program, which allows you to install the package and also include it in the package management system for your distribution.
  
* [http://www.commandir.com/mini/ Use multiple IR emitters] independently controlled by CommandIR Mini, a USB TX/RX combo device, with irsend's <code>SET_TRANSMITTERS</code> directive.
+
Example of build commands is below. I use the package name lirc_mod instead of lirc so that the automatic update features of the operating system do not spring into action and try to update my package with a "new version" from the repository.
 +
<pre>
 +
apt-get install libusb-dev libusb-1.0-0-dev python3-yaml xsltproc checkinstall
 +
./configure
 +
make
 +
sudo checkinstall -D --pkgname=lirc_mod --pkgversion=0.9.3 --install=no
 +
</pre>
 +
This creates a deb package you can install and remove.
  
== Set up ==
+
==Configuring LIRC for Frontend==
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:
+
LIRC needs to be installed on your frontend if you are using it with a remote control device (the most common use).
*  The receiver that comes with your TV card.  For example, the PVR series from Hauppauge sometimes have a receiver.
 
*  A Serial Port receiver you can make yourself or buy for a small fee (Often called a homebrew receiver)  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 receiver (e.g. Microsoft MCE remote control).
 
*  A USB receiver you can make yourself.
 
*  [http://www.lirc.org/parallel.html A Parallel Port transmitter and/or receiver] you can make yourself.
 
* The built in receiver with [http://www.mythtv.org/wiki/index.php/Silicondust_HDHomeRun HDHomerun] that works over UDP. [http://www.silicondust.com/wiki/hdhomerun/instructions/mythtv HDhomerun instructions]
 
  
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.
+
===/etc/lirc/lircd.conf===
 +
This file contains a section for each remote control device you are using. It maps the code generated by each key on the remote to a function name, number or letter (for example PLAY, VOLUP, 1). You can have a pile of remote control devices from different manufacturers and use any or all of them to control mythtv at the same time. This file will contain entries for each device type. The file format is described in the man page or at http://www.lirc.org/html/lircd.conf.html. On the [http://www.lirc.org LIRC home page] there is a link to the [http://lirc-remotes.sourceforge.net/ LIRC Remotes database] where you can find an lircd.conf file for almost any remote. Avoid any that use RAW codes, I have found that very unreliable. If you have more than one remote you will be using, simply concatenate the files together for your lircd.conf.
  
For Help Setting up LIRC on your computer, follow some of these excellent resources:
+
Obviously you should not use a remote that goes with another appliance in the same room as your MythTV setup, because the remote button presses will be picked up by both MythTV and your other device.
* [http://www.mythtv.org/docs/mythtv-HOWTO-8.html Official FAQ 8]
 
* [http://wilsonet.com/mythtv/fcmyth.php#lirc The Lirc section in Jarod's Guide]
 
* [http://gentoo-wiki.com/HOWTO_Setup_LIRC_for_MythTV Gentoo:HOWTO Setup LIRC for MythTV]
 
* [http://www.lirc.org The Lirc website]
 
* [http://lircconfig.commandir.com Online LIRC Configuration Tool] for remotes and A/V blasting
 
* [[Imon|iMON SoundGraph HOWTO (Silverstone)]]
 
* [http://losdos.dyndns.org:8080/public/mythtv-info/MythTV_DISH_IR_LED_TX_via_Modified_LIRC.html DISH Network IR Blaster] [http://mirror.mmdsi.com/losdos.dyndns.org/public/mythtv-info/MythTV_DISH_IR_LED_TX_via_Modified_LIRC.html (mirror)]
 
* [[DISHNetworkLIRCConfiguration|DISH Network /etc/lircd.conf with all buttons, discrete power, and 16 codesets]]
 
  
== LIRCRC ==
+
===Creating your own lircd.conf===
 +
If there is no file for your remote in the database, or the one in the database uses RAW codes or does not work, you can create your own using [http://www.lirc.org/html/irrecord.html irrecord]. irrecord can also update an existing lircd.conf with additional keys. Some of the downloaded lircd.conf files only contain a few of the keys that are available on the remote. Follow the instructions to record each button of the remote you want to use.
  
The lircrc file defines the mapping between the buttons on your own remote (as defined in the lircd.conf) and the functions you actually want it to perform. Note that most installations of the myth frontend also use mplayer or xine to play external video files, so you also need to define what the buttons do inside it.
+
Recording works best if you hold the remote really close to the receiver. In normal operation the idea of the remote is to operate across the living room. However for recording keys I found that holding it a few inches from the receiver worked better. If you find your configuration file contains RAW codes then you should try again. In my experience recording from across the room created raw codes that were useless, but holding the remote close to the receiver created proper codes.
  
[[Keybindings]] has a list of all the keys used, which can be used in your lircrc file.
+
===/home/userid/.mythtv/lircrc===
 +
The lircrc file defines the mapping between the buttons on your own remote (as defined in the lircd.conf) and the functions you actually want it to perform.
  
With native lirc support, MythTV can use Qt [http://doc.trolltech.com/4.4/qt.html#Key-enum  keys], removing the prefix Qt::Key_. Not all of MythTV's key names match their Qt counterparts, however. Instead of Period and Comma, for example, use the symbols (. and ,) themselves. Instead of PageUp and PageDown, use PgUp and PgDown.
+
The format of the file is documented at http://www.lirc.org/html/configure.html#lircrc_format. To find the exact syntax for a key (config parameter), run the MythTV Frontend and go to Edit Keys. Select the function you want to invoke and look at the up to 4 key assignments at the bottom of the screen. The text displayed there will be what you need to use (for example PgDown). You are actually mapping the LIRC key codes to keyboard key codes.
  
Keys can also have a [http://doc.trolltech.com/4.4/qt.html#Modifier-enum modifier] applied.  These are ''case sensitive''.
+
For example, Setting the (Gray Hauppauge's) Power button to be CTRL-Escape:
 
 
For example, Setting the (Gray Hauppauge's) Power button to be Qt::CTRL Qt::Key_Escape:
 
 
   begin
 
   begin
 
   prog = mythtv
 
   prog = mythtv
 
   remote = Hauppauge_Gray
 
   remote = Hauppauge_Gray
   button = Power
+
   button = KEY_POWER
 
   config = CTRL+Escape
 
   config = CTRL+Escape
 
   end
 
   end
{{Note box|This also works as CTRL+''''Esc'''', but NOT ''''Ctrl''''+Escape}}
 
  
 
"remote" is optional, but if you have multiple remotes configured in your lircd.conf e.g. for IR Blasting, you can use this line to make sure that only commands from the correct remote are used.
 
"remote" is optional, but if you have multiple remotes configured in your lircd.conf e.g. for IR Blasting, you can use this line to make sure that only commands from the correct remote are used.
  
To configure the TV button to jump to Live TV by using the key sequence Qt::ALT Qt::Key_L,
+
To configure the TV button to jump to Live TV by using the key sequence ALT L, Add or modify your lircrc to contain
* Add or modify your lircrc to contain
 
 
   begin
 
   begin
 
   prog = mythtv
 
   prog = mythtv
 
   remote = Hauppauge_Gray
 
   remote = Hauppauge_Gray
   button = TV
+
   button = KEY_TV
 
   repeat = 3
 
   repeat = 3
 
   config = ALT+L
 
   config = ALT+L
 
   end
 
   end
* Restart mythfrontend
 
* Go to Setup/Edit Keys/JumpPoints
 
* Select Live TV
 
* Press enter (until you see a dialog appear, that says it is waiting for a keypress)
 
* Press the TV button on your remote
 
Hopefully, you will now see Alt-L listed!
 
  
== lirc + 2.6.16 kernel ==
+
==Configuring LIRC for Backend (IR Blasting)==
 +
LIRC can be used by your backend if you are using a cable Company receiver box or satellite receiver with HD PVR, firewire, etc. to receiver the signal from the converter box. You may neeed to control your converter box with an IR blaster that can emulate the command send by the cable box remote.
 +
 
 +
If your frontend and backend are the same machine then the same LIRC instance can be used for both IR blasting and receiving at the same time. The product from http://www.iguanaworks.net/ can be used this way, or you may have separate receiver and blaster.
 +
 
 +
The same lircd.conf is used as for receiving (see above). Normally there will be a different remote type for receiver and blaster functions. Using the same one for both will only cause frustration, since your commands to MythTV will be received also by the cable box and the commands from the backend will be seen by the frontend.
 +
 
 +
Add the lircd.conf file for your blaster remote to the /etc/lirc/lircd.conf, in addition to any other remote you have there. You can also create your own lircd.conf as suggested above for receiving.
 +
 
 +
This process starts by configuring the video source in the [[Mythtv-setup]] program to use an an external channel changing program. More specifically, the channel changing script is a per capture card property that is specified in the Input Connections section of mythtv-setup. If you are using LIRC, this program will be a  channel changing script that invokes LIRC's [http://www.lirc.org/html/irsend.html irsend] command, passing it appropriate arguments to send the channel changing IR codes.
 +
 
 +
Let's say MythTV wishes to tune to channel 2 (either to record a scheduled show or because it was instructed by the user viewing live TV), it invokes the external channel changing program passing it '2' as an argument. The channel changing script turns that into an invocation of irsend, and LIRC transmits the appropriate codes via your infra-red transmitter.
 +
 
 +
In practice it is more complicated. Most channel numbers are more than one digit, and you may have to pause between digits. You may have to send a ''Select'' key press after the channel number. Also you may have to power on the cable box. The cable box may be in some incorrect mode such as ''On Demand'' and will not respond correctly to a channel number.
 +
 
 +
There is an extensive script at [[LircChannelChanger]] which you can download and use.
 +
 
 +
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.
 +
 
 +
* [[Using an IR Blaster with MythTV]]
 +
* [[IguanaIR]] USB-based IR Transceiver
 +
* [[FTDI USB IR Blaster / Transmitter using LIRC]]
 +
 
 +
===LIRC with Multiple External Tuners===
 +
If you are using a system with multiple external tuners, you can use LIRC to control each one independently.  The proper [http://www.lirc.org/html/irsend.html irsend] command for each tuner can be placed in a separate channel changing script, and then specified as an external channel changing program for the appropriate video source in the [[Mythtv-setup]] program. 
 +
 
 +
Normally, only a single LIRC transmitter is required as long as each of the tuners have mutually exclusive remote codes, and the LIRC transmitter can placed in the line of sight of all tuners' IR receivers.  In this configuration, each tuner will need a "Remote Block" setting in the lircd.conf file and irsend simply needs the correct <code>REMOTE</code> argument.  This is probably the simplest solution to most multiple tuner systems.
 +
 
 +
However, there are some instances where unique control codes aren't possible (for example, you have two Comcast Cable boxes so you can record two shows at once. These would both respond to the same commands.), or simultaneous line of sight to the two receivers is not possible. In these cases, there are some options available:
 +
 
 +
* [http://www.iguanaworks.net/ IguanaIR] includes up to four output sockets for transmitters. These can be placed in positions where they are only seen by the desired tuner box.
  
As of 5/10/06 you must patch lirc-0.8 to work with the 2.6.16 kernel. Patch can be found here:
+
* Load multiple LIRC drivers using irsend's <code>--device</code> option.  For some drivers, including lirc_serial ([[Using an IR Blaster with MythTV|IR Blaster]], etc.), this method won't work with multiple transmitters of the same type.
* https://bugs.gentoo.org/show_bug.cgi?id=127122
 
  
Additional info:
+
* [http://losdos.dyndns.org:8080/public/mythtv-info/IR-BLASTER-HOWTO.html Modify the source tree to support multiple instances of the LIRC driver] and use 2 separate copies of irsend compiled.
* http://www.itzangler.com/lirc.html
 
* http://lnx.manoweb.com/lirc/?partType=section&partName=lirc
 
  
I have built several homebrew receivers, 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:
+
* [[Multiple LIRC Drivers]] with multiple IR emitters of the same type without having to recompile lirc_serial.
*  http://www.irblaster.info/index.html IRBlaster.info
 
*  http://lnx.manoweb.com/lirc/?partType=section&partName=buy
 
*  http://homepage.ntlworld.com/rendus/ir_receiver_01.htm
 
  
-- [[Dave Hofstra]]
+
==Links==
 +
There are additional pages in this wiki here:
 +
* [[:Category:LIRC Configuration Files]]
 +
* [[:Category:Remote Controls]]
 +
* [[Using an IR Blaster with MythTV]]
 +
* [[Homebrew lirc reciever parts]]
 +
* [[Ubuntu Serial Lirc Install]]
  
 
== Troubleshooting ==
 
== Troubleshooting ==
 
=== irw ===
 
=== irw ===
 
Use the <code>irw</code> 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!
 
Use the <code>irw</code> 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!
The irw tool connects to the lircd socket and displays any recognized IR signals detected by the driver. If this works, then your hardware and driver is working. All that remains is your application setup.
+
 
 +
The irw tool connects to the lircd socket and displays any recognized IR signals detected by the driver. If this works, then your hardware, driver and lirc.conf is working; all that remains is your application setup. If irw does not generate the expected output though, not all is lost -- see the ''mode2'' command below.
  
 
=== Logging ===
 
=== Logging ===
Line 138: Line 149:
  
 
* The log file showing "accepted new client" immediately followed by "removed client" can indicate a a ~/.lircrc or ~/.mythtv/lircrc parsing error. Check the formatting.
 
* The log file showing "accepted new client" immediately followed by "removed client" can indicate a a ~/.lircrc or ~/.mythtv/lircrc parsing error. Check the formatting.
=== Make the lirc device static ===
+
 
If you follow this http://parker1.co.uk/mythtv_tips.php Tip to make the lirc device static, you may notice that it only works if you have only one card with the same vendor ID.
+
=== Make the LIRC device static ===
 +
If you have more than one input device on your system, the numbering may change from one reboot to the next.
 +
You can [[http://parker1.co.uk/mythtv_tips.php use udev]] to ensure the input device corresponding to your remote has a name that does not change across reboots.
 +
 
 +
You may notice that it only works if you have only one card with the same vendor ID.
 
If you have more than one card from the same vendor, but with a different name, you can use the following line to create the /dev/input symlink:
 
If you have more than one card from the same vendor, but with a different name, you can use the following line to create the /dev/input symlink:
 
  ln -fs /dev/input/`cat /proc/bus/input/devices|grep -A 3 "Hauppauge Nova-S-Plus"|grep event|cut -d ' ' -f3` /dev/input/irremote
 
  ln -fs /dev/input/`cat /proc/bus/input/devices|grep -A 3 "Hauppauge Nova-S-Plus"|grep event|cut -d ' ' -f3` /dev/input/irremote
Line 147: Line 162:
 
  if $START_LIRCD; then
 
  if $START_LIRCD; then
 
Using an udev rule may be more elegant, but I found this one liner to be more reliable.
 
Using an udev rule may be more elegant, but I found this one liner to be more reliable.
 
  
 
The above failed for me for two reasons - one, my device is not an S-plus, and two, I have more than one of the same card.
 
The above failed for me for two reasons - one, my device is not an S-plus, and two, I have more than one of the same card.
 
My small modification of the above one-liner should work for everyone:
 
My small modification of the above one-liner should work for everyone:
 
  ln -fs /dev/input/`cat /proc/bus/input/devices | grep -A 3 "Hauppauge" | grep event | cut -d ' ' -f3 | head -n1` /dev/input/irremote
 
  ln -fs /dev/input/`cat /proc/bus/input/devices | grep -A 3 "Hauppauge" | grep event | cut -d ' ' -f3 | head -n1` /dev/input/irremote
 +
 +
The above fails on Ubuntu 10.04. A solution to this is: (Not tested on dual card setups)
 +
ln -fs /dev/input/event$(cat /proc/bus/input/devices | grep -A 3 "Hauppauge" | grep Sysfs | sed -e "s/^.*\(.\)$/\1/") /dev/input/irremote
 +
 +
This makes a symbolic link in /dev/input called "irremote" this will always point to the Hauppauge event.
  
 
===mode2===
 
===mode2===
The command '''mode2''' will give each separate pulse for button
+
The command '''mode2''' will give each separate pulse for button pushes.  Some buttons have different pulses for pushing the button than for releasing the button.  Using '''mode2''' will show all pulses and is a lower-level lirc testing tool than irw.
pushes.  Some buttons have different pulses for pushing the button
+
 
than for releasing the button.  Using '''mode2''' will show all of pulses.
+
=== Devices ===
 +
Depending on your setup, lirc may be looking for either /dev/lirc0 or /dev/lirc, and the wrong one will obviously break things. You can use <code>ln -s /dev/lirc0 /dev/lirc</code> or <code>ln -s /dev/lirc /dev/lirc0</code> to fix this.
  
 
===LircSocket===
 
===LircSocket===
If you know lirc is working, and mapped correctly in the lircrc file, but is not doing anything in MythTV, you may want to check your LircSocket (frontend settings). This was a problem for me with MythTV 0.22 installed via atrpms on Centos 5.4. After installing lirc manually, I had to change the LircSocket setting from <code>/var/run/lirc/lircd</code> to <code>/dev/lircd</code> to get it to work. The frontend log should contain clues that it was not able to connect to the lircd socket. <code>/var/run/lirc/lircd</code> is the default location for the lircd socket for lirc 0.8.6 and higher.
+
If you know LIRC is working, and mapped correctly in the lircrc file, but is not doing anything in MythTV, you may want to check your LircSocket (frontend settings). This was a problem for me with MythTV 0.22 installed via atrpms on Centos 5.4. The frontend log should contain clues that it was not able to connect to the lircd socket. <code>/var/run/lirc/lircd</code> is the default location for the lircd socket for lirc 0.8.6 and higher.
 +
 
 +
===Double presses for certain buttons===
 +
You may find that you are getting double hits for some of your buttons (example: arrows) but not all of your buttons.  The kernel may be listening to your remote as well as lircd.
 +
Check and see if it is:
 +
 
 +
<pre>
 +
cat /sys/class/rc/rc0/protocols
 +
</pre>
 +
 
 +
You should see something like:
 +
rc-5 nec rc-6 jvc sony mce_kbd [lirc]
 +
 
 +
If anything other than lirc has the brackets, then you need to do the following:
 +
 
 +
Create a file in <code>/etc/udev/rules.d</code> called <code>remote-control-lirc.rules</code> and put this line in it:
 +
 
 +
<pre>
 +
SUBSYSTEM=="rc", ATTRS{protocols}=="*lirc*" RUN+="/bin/sh -c 'echo lirc > /sys$env{DEVPATH}/protocols'"
 +
</pre>
 +
 
 +
After creating that file, test the rule by running:
 +
 
 +
<pre>
 +
$ udevadm test /devices/pci0000:00/0000:00:06.0/usb4/4-5/4-5:1.0/rc/rc2
 +
</pre>
 +
 
 +
(replacing that path with whatever the link in <code>/sys/class/rc</code> points to currently). You should see a line at the end of the output saying it's going to run the echo lirc command.
 +
 
 +
Later, when you reboot or disconnect/reconnect the receiver, the udev rule should detect the new location of the receiver and echo lirc to the appropriate file.
 +
 
 +
Reboot for changes to take effect.
 +
 
 +
Source: http://www.gossamer-threads.com/lists/mythtv/users/504746#504746
 +
 
 +
180806 - Here is an alternate udev rule for disabling kernel remote decoding.
  
== Key things to remember ==
+
cat /etc/udev/rules.d/99-zremote-control-lirc.rules
* 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 <code><nowiki>/etc/lircd.conf</nowiki></code> to fit your '''remote'''.
 
* Set up <code><nowiki>~/.mythtv/lircrc</nowiki></code> with the keys that are needed for MythTV and MPlayer
 
* Ensure MPlayer knows about LIRC (assuming you use it as the default player). If LIRC was installed AFTER MPlayer, you need to tell mplayer where to find the lircrc file in either the global config file <code><nowiki>/etc/mplayer/mplayer.conf</nowiki></code>, the local user override file <code><nowiki>~/.mplayer/config</nowiki></code>, or on the command line in <code><nowiki>mythfrontend -> Utilities/Setup -> Setup -> Media Settings -> Video Settings -> Player Settings -> Default Player</nowiki></code> by adding <code><nowiki>-lircconf /path/to/lircrc</nowiki></code>. Note that when using all the default video players etc in myth, native control of MPlayer is only required when playing video files (like AVI's etc..) under "Watch Videos".
 
* Setup <code><nowiki>~/.lircrc</nowiki></code> for Xine. I have the <code><nowiki>~/.mythtv/lircrc</nowiki></code> be a softlink to <code><nowiki>~/.lircrc</nowiki></code> see [[Lirc on Ubuntu Dapper]] as the basis for your own file.
 
* Don't try to use a lircrc file written for '''irxevent''' if you are trying to use mythtv native lirc support, see [[Lirc on Ubuntu Dapper]] as the basis for your own file. Or search for mythtv/configfiles/hauppauge-lircrc-nativelirc to use it as a template.
 
  
-- Orginal by [[Abandoned_User_Pages#Peter_Morch|Peter Morch]]
+
SUBSYSTEMS=="rc", ATTRS{protocols}=="*mce_kbd*", RUN="/bin/sh -c 'echo lirc > /sys/class/rc/%k/protocols'"
  
I use [[KnoppMyth]] and it worked out of the box for me with a Homebrew transmitter & receiver.
+
NOTES:
 +
Make sure /bin/sh exists on your system.
  
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.
+
The ATTRS key can be removed (not recommended) if only one rc SUBSYSTEMS device
 +
is on the computer (ls -al /sys/class/rc). See below on selecting the protocol
 +
to use. %k is the kernel name for this device.
  
-- [[David Greaves]]
+
If there are multiple "rc" devices, omitting the ATTRS key will disable kernel
 +
decoding on ALL these devices. If this is not an issue, document system
 +
changes according to local policy.
  
==Multiple remotes==
+
To apply this rule only to the desired device, select a protocol unique to the
See [[MultiLIRC]] for my mods to the standard Debian Lenny lirc installation for running multiple lirc remotes and keeping everything separate.
+
device to have kernel based decoding disabled. In the example below, several
 +
protocols are unique to device rc1, and 'mce_kbd' was used in the rule above.
 +
To apply the rule to the rc0 device, note there is no unique protocol
 +
compared to the rc1 device. Assuming the protocol order does not change,   
 +
isolating the rc0 device with ATTRS{protocols}=="*rc-6 rc-5-sz*" would work.
  
== LIRC 2.6 ==
+
cat /sys/class/rc/rc0/protocols
[[LIRC]]26 is how I installed Lirc (well, the lirc_serial driver) under 2.6.4 and 2.6.6
+
[rc-5] rc-6 rc-5-sz [lirc]
  
[[Lirc on Ubuntu Dapper]] is how I installed Lirc under a Ubuntu Dapper system with kernel 2.6.15
+
cat /sys/class/rc/rc1/protocols
 +
rc-5 nec rc-6 jvc sony rc-5-sz sanyo sharp mce_kbd xmp imon [lirc]
  
== Ubuntu Karmic Koala LIRC ==
+
The rule will activate with the next reboot.
If you are using standard Ubuntu 9.10, and have got mythtv running, it is very simple to get LIRC to work with your remote.
 
  
Assuming you have got the actual remote working (see instructions above) and it is generating LIRC events OK, you can now tell Mythtv
+
===Other Notes===
how to use your remote.
+
* Don't try to use a lircrc file written for '''irxevent''' if you are trying to use MythTV native LIRC support, see [[Lirc on Ubuntu Dapper]] as the basis for your own file. Or search for mythtv/configfiles/hauppauge-lircrc-nativelirc to use it as a template.
 +
* 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]]
 +
 
 +
== Distribution-specific notes ==
 +
=== Ubuntu/Mythbuntu lircrc generation ===
 +
 
 +
Mythbuntu provides a package that will intelligently parse your lircd.conf file and attempt to create valid button mappings for use in MythTV and other media player applications.  Note that the use of this package is contingent on your remote being properly installed and working. You can install and invoke this package as follows:
  
 
  sudo apt-get install lirc mythbuntu-lirc-generator
 
  sudo apt-get install lirc mythbuntu-lirc-generator
 
  mythbuntu-lirc-generator
 
  mythbuntu-lirc-generator
 
This creates a .lircrc file in your home directory.
 
You need to link the created ''.lircrc'' file which is in your home directory (/home/''this_user'')
 
to the ''./mythtv/.lircrc'' file in the home directory of the user that will run mythfrontend (/home/''mythfrontend_user'').
 
In most cases they are one and the same user- don't get confused between the user that runs the mythtv-backend (i.e. mythtv)
 
and the user that runs mythfrontend and watches the screen (i.e. you).
 
  
  sudo ln -s /home/''this_user''/.lircrc /home/''mythfrontend_user''/.mythtv/lircrc
+
Restart mythfrontend. Your remote should now work with MythTV!
 +
 
 +
Please note that there is a bug which causes duplicate mappings to be generated. This can cause remote input to be processed twice. For instance if you press "down" and the menu selection moves down two items or if you press "pause" and the recording immediately pauses and then starts playing again. For more information please see the the Ubuntu Launchpad [https://bugs.launchpad.net/ubuntu/+source/mythbuntu-lirc-generator/+bug/779835 bug 779835].
  
Restart mythfrontend by exiting Mythtv and starting it again.  Your remote should now work with Mythtv!
+
[[Category:HOWTO]]
  
[[Category:Glossary]] [[Category:HOWTO]]
+
[[Category:Remote Control|1200]]

Latest revision as of 14:42, 31 May 2020


Software-update-available.png This page is up-to-date as of MythTV version 0.27.6, the current release is 31.0

Wikipedia-logo-en.png
Wikipedia has an article on:

Introduction

LIRC stands for Linux Infrared Remote Control. It is required to use certain Remote Controls with MythTV.

LIRC is not easy to set up. Remote controls that work by keyboard control, either using a keyboard emulator or built in drivers using evdev are preferable. For details of the available options see User Manual:Setting Up#Remote_controls.

Before you start down the LIRC path validate whether your remote will work in some way as a keyboard emulator. Remote_Control#Check if your remote emulates a keyboard.

If you need to use an IR blaster to change channels on a set top box you may have to use LIRC, since there is no built in support in Linux for those.

LIRC is a software package that gives your computer the ability to send and receive infra-red remote control signals when combined with appropriate hardware. Most distributions include LIRC packages, but you may have to compile it yourself if you wish to use certain features that the distribution packagers did not include.

Hardware

There are several different hardware pieces for receiving and sending LIRC commands. A few are:

Installing LIRC

Check whether your distribution includes LIRC and the version:

On an Ubuntu or Debian derivative system:

sudo apt-get update
apt-cache showpkg lirc

If your distribution includes an outdated version of LIRC, you may need to build it yourself. Please refer to http://www.lirc.org/. The LIRC Documentation page has a complete description of how to build, install and configure LIRC.

If your distribution has an outdated version of LIRC or one that has the wrong options built in you may need to download the source from lirc.org and compile it yourself.

You may also need to install specific device drivers for the device itself. Those need to be found on the device vendor's web page.

To help with installing you can use the checkinstall program, which allows you to install the package and also include it in the package management system for your distribution.

Example of build commands is below. I use the package name lirc_mod instead of lirc so that the automatic update features of the operating system do not spring into action and try to update my package with a "new version" from the repository.

apt-get install libusb-dev libusb-1.0-0-dev python3-yaml xsltproc checkinstall
./configure
make
sudo checkinstall -D --pkgname=lirc_mod --pkgversion=0.9.3 --install=no

This creates a deb package you can install and remove.

Configuring LIRC for Frontend

LIRC needs to be installed on your frontend if you are using it with a remote control device (the most common use).

/etc/lirc/lircd.conf

This file contains a section for each remote control device you are using. It maps the code generated by each key on the remote to a function name, number or letter (for example PLAY, VOLUP, 1). You can have a pile of remote control devices from different manufacturers and use any or all of them to control mythtv at the same time. This file will contain entries for each device type. The file format is described in the man page or at http://www.lirc.org/html/lircd.conf.html. On the LIRC home page there is a link to the LIRC Remotes database where you can find an lircd.conf file for almost any remote. Avoid any that use RAW codes, I have found that very unreliable. If you have more than one remote you will be using, simply concatenate the files together for your lircd.conf.

Obviously you should not use a remote that goes with another appliance in the same room as your MythTV setup, because the remote button presses will be picked up by both MythTV and your other device.

Creating your own lircd.conf

If there is no file for your remote in the database, or the one in the database uses RAW codes or does not work, you can create your own using irrecord. irrecord can also update an existing lircd.conf with additional keys. Some of the downloaded lircd.conf files only contain a few of the keys that are available on the remote. Follow the instructions to record each button of the remote you want to use.

Recording works best if you hold the remote really close to the receiver. In normal operation the idea of the remote is to operate across the living room. However for recording keys I found that holding it a few inches from the receiver worked better. If you find your configuration file contains RAW codes then you should try again. In my experience recording from across the room created raw codes that were useless, but holding the remote close to the receiver created proper codes.

/home/userid/.mythtv/lircrc

The lircrc file defines the mapping between the buttons on your own remote (as defined in the lircd.conf) and the functions you actually want it to perform.

The format of the file is documented at http://www.lirc.org/html/configure.html#lircrc_format. To find the exact syntax for a key (config parameter), run the MythTV Frontend and go to Edit Keys. Select the function you want to invoke and look at the up to 4 key assignments at the bottom of the screen. The text displayed there will be what you need to use (for example PgDown). You are actually mapping the LIRC key codes to keyboard key codes.

For example, Setting the (Gray Hauppauge's) Power button to be CTRL-Escape:

  begin
  prog = mythtv
  remote = Hauppauge_Gray
  button = KEY_POWER
  config = CTRL+Escape
  end

"remote" is optional, but if you have multiple remotes configured in your lircd.conf e.g. for IR Blasting, you can use this line to make sure that only commands from the correct remote are used.

To configure the TV button to jump to Live TV by using the key sequence ALT L, Add or modify your lircrc to contain

  begin
  prog = mythtv
  remote = Hauppauge_Gray
  button = KEY_TV
  repeat = 3
  config = ALT+L
  end

Configuring LIRC for Backend (IR Blasting)

LIRC can be used by your backend if you are using a cable Company receiver box or satellite receiver with HD PVR, firewire, etc. to receiver the signal from the converter box. You may neeed to control your converter box with an IR blaster that can emulate the command send by the cable box remote.

If your frontend and backend are the same machine then the same LIRC instance can be used for both IR blasting and receiving at the same time. The product from http://www.iguanaworks.net/ can be used this way, or you may have separate receiver and blaster.

The same lircd.conf is used as for receiving (see above). Normally there will be a different remote type for receiver and blaster functions. Using the same one for both will only cause frustration, since your commands to MythTV will be received also by the cable box and the commands from the backend will be seen by the frontend.

Add the lircd.conf file for your blaster remote to the /etc/lirc/lircd.conf, in addition to any other remote you have there. You can also create your own lircd.conf as suggested above for receiving.

This process starts by configuring the video source in the Mythtv-setup program to use an an external channel changing program. More specifically, the channel changing script is a per capture card property that is specified in the Input Connections section of mythtv-setup. If you are using LIRC, this program will be a channel changing script that invokes LIRC's irsend command, passing it appropriate arguments to send the channel changing IR codes.

Let's say MythTV wishes to tune to channel 2 (either to record a scheduled show or because it was instructed by the user viewing live TV), it invokes the external channel changing program passing it '2' as an argument. The channel changing script turns that into an invocation of irsend, and LIRC transmits the appropriate codes via your infra-red transmitter.

In practice it is more complicated. Most channel numbers are more than one digit, and you may have to pause between digits. You may have to send a Select key press after the channel number. Also you may have to power on the cable box. The cable box may be in some incorrect mode such as On Demand and will not respond correctly to a channel number.

There is an extensive script at LircChannelChanger which you can download and use.

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.

LIRC with Multiple External Tuners

If you are using a system with multiple external tuners, you can use LIRC to control each one independently. The proper irsend command for each tuner can be placed in a separate channel changing script, and then specified as an external channel changing program for the appropriate video source in the Mythtv-setup program.

Normally, only a single LIRC transmitter is required as long as each of the tuners have mutually exclusive remote codes, and the LIRC transmitter can placed in the line of sight of all tuners' IR receivers. In this configuration, each tuner will need a "Remote Block" setting in the lircd.conf file and irsend simply needs the correct REMOTE argument. This is probably the simplest solution to most multiple tuner systems.

However, there are some instances where unique control codes aren't possible (for example, you have two Comcast Cable boxes so you can record two shows at once. These would both respond to the same commands.), or simultaneous line of sight to the two receivers is not possible. In these cases, there are some options available:

  • IguanaIR includes up to four output sockets for transmitters. These can be placed in positions where they are only seen by the desired tuner box.
  • Load multiple LIRC drivers using irsend's --device option. For some drivers, including lirc_serial (IR Blaster, etc.), this method won't work with multiple transmitters of the same type.
  • Multiple LIRC Drivers with multiple IR emitters of the same type without having to recompile lirc_serial.

Links

There are additional pages in this wiki here:

Troubleshooting

irw

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!

The irw tool connects to the lircd socket and displays any recognized IR signals detected by the driver. If this works, then your hardware, driver and lirc.conf is working; all that remains is your application setup. If irw does not generate the expected output though, not all is lost -- see the mode2 command below.

Logging

You can enable logging for lircd with the -L option. Use this to see the results of clients connecting to lircd daemon. Compiling lircd with debugging enabled (-D option) allows you to see much more including parsing of the remote definitions.

# /usr/local/sbin/lircd --device=/dev/lirc/0 /etc/lirc/lircd.conf -L ~/lircd.log -D7
  • The log file showing "accepted new client" immediately followed by "removed client" can indicate a a ~/.lircrc or ~/.mythtv/lircrc parsing error. Check the formatting.

Make the LIRC device static

If you have more than one input device on your system, the numbering may change from one reboot to the next. You can [use udev] to ensure the input device corresponding to your remote has a name that does not change across reboots.

You may notice that it only works if you have only one card with the same vendor ID. If you have more than one card from the same vendor, but with a different name, you can use the following line to create the /dev/input symlink:

ln -fs /dev/input/`cat /proc/bus/input/devices|grep -A 3 "Hauppauge Nova-S-Plus"|grep event|cut -d ' ' -f3` /dev/input/irremote

You should run this line before running lirc, for example add it to /etc/init.d/lirc here:

echo -n "Starting lirc daemon:"
ln -fs /dev/input/`cat /proc/bus/input/devices|grep -A 3 "Hauppauge Nova-S-Plus"|grep event|cut -d ' ' -f3` /dev/input/irremote
if $START_LIRCD; then

Using an udev rule may be more elegant, but I found this one liner to be more reliable.

The above failed for me for two reasons - one, my device is not an S-plus, and two, I have more than one of the same card. My small modification of the above one-liner should work for everyone:

ln -fs /dev/input/`cat /proc/bus/input/devices | grep -A 3 "Hauppauge" | grep event | cut -d ' ' -f3 | head -n1` /dev/input/irremote

The above fails on Ubuntu 10.04. A solution to this is: (Not tested on dual card setups)

ln -fs /dev/input/event$(cat /proc/bus/input/devices | grep -A 3 "Hauppauge" | grep Sysfs | sed -e "s/^.*\(.\)$/\1/") /dev/input/irremote

This makes a symbolic link in /dev/input called "irremote" this will always point to the Hauppauge event.

mode2

The command mode2 will give each separate pulse for button pushes. Some buttons have different pulses for pushing the button than for releasing the button. Using mode2 will show all pulses and is a lower-level lirc testing tool than irw.

Devices

Depending on your setup, lirc may be looking for either /dev/lirc0 or /dev/lirc, and the wrong one will obviously break things. You can use ln -s /dev/lirc0 /dev/lirc or ln -s /dev/lirc /dev/lirc0 to fix this.

LircSocket

If you know LIRC is working, and mapped correctly in the lircrc file, but is not doing anything in MythTV, you may want to check your LircSocket (frontend settings). This was a problem for me with MythTV 0.22 installed via atrpms on Centos 5.4. The frontend log should contain clues that it was not able to connect to the lircd socket. /var/run/lirc/lircd is the default location for the lircd socket for lirc 0.8.6 and higher.

Double presses for certain buttons

You may find that you are getting double hits for some of your buttons (example: arrows) but not all of your buttons. The kernel may be listening to your remote as well as lircd. Check and see if it is:

cat /sys/class/rc/rc0/protocols

You should see something like: rc-5 nec rc-6 jvc sony mce_kbd [lirc]

If anything other than lirc has the brackets, then you need to do the following:

Create a file in /etc/udev/rules.d called remote-control-lirc.rules and put this line in it:

SUBSYSTEM=="rc", ATTRS{protocols}=="*lirc*" RUN+="/bin/sh -c 'echo lirc > /sys$env{DEVPATH}/protocols'"

After creating that file, test the rule by running:

$ udevadm test /devices/pci0000:00/0000:00:06.0/usb4/4-5/4-5:1.0/rc/rc2

(replacing that path with whatever the link in /sys/class/rc points to currently). You should see a line at the end of the output saying it's going to run the echo lirc command.

Later, when you reboot or disconnect/reconnect the receiver, the udev rule should detect the new location of the receiver and echo lirc to the appropriate file.

Reboot for changes to take effect.

Source: http://www.gossamer-threads.com/lists/mythtv/users/504746#504746

180806 - Here is an alternate udev rule for disabling kernel remote decoding.

cat /etc/udev/rules.d/99-zremote-control-lirc.rules

SUBSYSTEMS=="rc", ATTRS{protocols}=="*mce_kbd*", RUN="/bin/sh -c 'echo lirc > /sys/class/rc/%k/protocols'"

NOTES: Make sure /bin/sh exists on your system.

The ATTRS key can be removed (not recommended) if only one rc SUBSYSTEMS device is on the computer (ls -al /sys/class/rc). See below on selecting the protocol to use. %k is the kernel name for this device.

If there are multiple "rc" devices, omitting the ATTRS key will disable kernel decoding on ALL these devices. If this is not an issue, document system changes according to local policy.

To apply this rule only to the desired device, select a protocol unique to the device to have kernel based decoding disabled. In the example below, several protocols are unique to device rc1, and 'mce_kbd' was used in the rule above. To apply the rule to the rc0 device, note there is no unique protocol compared to the rc1 device. Assuming the protocol order does not change, isolating the rc0 device with ATTRS{protocols}=="*rc-6 rc-5-sz*" would work.

cat /sys/class/rc/rc0/protocols
[rc-5] rc-6 rc-5-sz [lirc]
cat /sys/class/rc/rc1/protocols
rc-5 nec rc-6 jvc sony rc-5-sz sanyo sharp mce_kbd xmp imon [lirc]

The rule will activate with the next reboot.

Other Notes

  • Don't try to use a lircrc file written for irxevent if you are trying to use MythTV native LIRC support, see Lirc on Ubuntu Dapper as the basis for your own file. Or search for mythtv/configfiles/hauppauge-lircrc-nativelirc to use it as a template.
  • 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

Distribution-specific notes

Ubuntu/Mythbuntu lircrc generation

Mythbuntu provides a package that will intelligently parse your lircd.conf file and attempt to create valid button mappings for use in MythTV and other media player applications. Note that the use of this package is contingent on your remote being properly installed and working. You can install and invoke this package as follows:

sudo apt-get install lirc mythbuntu-lirc-generator
mythbuntu-lirc-generator

Restart mythfrontend. Your remote should now work with MythTV!

Please note that there is a bug which causes duplicate mappings to be generated. This can cause remote input to be processed twice. For instance if you press "down" and the menu selection moves down two items or if you press "pause" and the recording immediately pauses and then starts playing again. For more information please see the the Ubuntu Launchpad bug 779835.