Difference between revisions of "LIRC"

From MythTV Official Wiki
Jump to: navigation, search
m (Formatting fixes)
(Remove commented out obsolete and moved sections.)
Line 16: Line 16:
 
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.
 
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.
  
<!--In its most basic concept, you press the 'play' button on your remote control which sends an infra-red signal to a receiver connected to your computer.  This 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 infra-red receiver, you have two choices about how you set it up to work with MythTV:
 
* The preferred method is to use mythtv native LIRC support, where mythtv reads ~/.mythtv/lircrc for its own key configuration
 
* An alternate approach uses [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)
 
 
The receiver may be connected to the computer via a serial port, 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.
 
[[Image:Rect32603.png|center]]
 
* 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.
 
[[Image:Rect32606.png|center]]
 
* 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)''
 
[[Image:Rect32607.png|center]]
 
* The button names in /etc/lircd.conf must match the "button" configuration names you use in your lircrc file. To simplify things, modern lirc supports a notion of "standard names" for buttons a. k. a., the namespace. The namespace is listed by ''irrecord -l''. Wherever possible you should use the key symbols from this namespace. When using a predefined remote configuration form the dark ages, replace home-brewed symbols with symbols from the namespace 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`).
 
-->
 
 
==Hardware==
 
==Hardware==
 
There are several different hardware pieces for receiving and sending LIRC commands. A few are:
 
There are several different hardware pieces for receiving and sending LIRC commands. A few are:
Line 139: Line 125:
  
 
* [[Multiple LIRC Drivers]] with multiple IR emitters of the same type without having to recompile lirc_serial.
 
* [[Multiple LIRC Drivers]] with multiple IR emitters of the same type without having to recompile lirc_serial.
<!-- MOVED
+
 
== 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 [[HD-PVR]] series from Hauppauge sometimes have a receiver.
 
*  A [[Using_an_IR_Blaster_with_MythTV|Serial Port transmitter]] you can make yourself or buy for a small fee (called a homebrew transmitter)
 
*  A commercially available USB receiver (e.g. [[MCE Remote|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 [[Silicondust HDHomeRun]] that works over UDP. [http://www.silicondust.com/wiki/hdhomerun/instructions/mythtv HDhomerun instructions]
 
-->
 
 
==Links==
 
==Links==
 
There are additional pages in this wiki here:
 
There are additional pages in this wiki here:
Line 156: Line 133:
 
* [[Homebrew lirc reciever parts]]
 
* [[Homebrew lirc reciever parts]]
 
* [[Ubuntu Serial Lirc Install]]
 
* [[Ubuntu Serial Lirc Install]]
 
<!--
 
== Migrating to LIRC 0.9.0+ ==
 
As of 2.6.36, some infrared receiver drivers have been removed from LIRC and into the kernel.  The following drivers are no longer available in lirc:
 
 
* mceusb
 
* streamzap
 
* it8x
 
* ene0100
 
 
Other LIRC drivers have been moved to staging. For example, the lirc_i2c driver is in this part of the kernel now. These changes have been backported to the 2.6.35 kernel for Fedora 14, and the 2.6.32 kernel used by RHEL and derivatives.
 
===Gentoo===
 
For me this broke my existing lirc MCE USB setup.  As of March 2011, I had to do the following to fix it using 2.6.37 on gentoo:
 
'''Note:''' I recently (Oct 2012) tried this migration again and failed.  The version of lirc in portage and from the lirc site no longer work for me as described below (YMMV).  I  have since stopped using lirc and am migrating to [[Sapphire]].
 
 
# Enable the lirc driver in the kernel and rebuild.  For the MCE USB remote this was under: Device Drivers -> Multimedia support - > Infrared remote controller adapters -> Windows Media Center Ed. eHome Infrared Transceiver
 
# Loaded the new mceusb driver (reboot or modprobe mceusb) which created /dev/lirc0.  The previous non-kernel modules  created the device as /dev/lirc so this is different.  Therfore I had add -d /dev/lirc0 as an option to lircd when it started (for me this change was in /etc/conf.d/lirc) so the binary knew where to find the driver
 
# lircd ran without error but irw still didn’t show my keypresses on the remote.  lircd -v showed 0.8.5 which is not compatible with the new drivers.  I removed 0.8.5 then downloaded 0.9.0pre1 from the lirc site and installed it myself (there was no gentoo ebuild at the time).  Note that this also installed drivers lirc_dev and lirc_mceusb which are the old drivers.  They aren't needed so I deleted them on my system to avoid confusion in the future.    After that I restart lircd and irw and could see my keypresses being captured.
 
# My last issue was that when I started mythfrontend, when I pressed up/down twice it would move 4 or 5 times.  This was due to the irevents being interpreted as both lirc events and as keypresses in the kernel.  This was fixed by running echo lirc > /sys/class/rc/rc0/protocols which forces them to be processed as lirc events only.  Note that command needs to be run on every reboot, so it should be added wherever your distro runs such commands (gentoo is /etc/conf.d/local.start)
 
 
Here are things I DIDN’T have to do:
 
# update /etc/lirc/lircd.conf
 
 
If you have issues
 
# Run lsmod | grep lirc_ to check that the old modules aren't loaded
 
# Check that /dev/lirc0 is being created after mceusb gets loaded.  If not look at dmesg after modprobbing mceusb it for clues
 
# run lircd in non deamon mode by using lircd -n <whatever other options you need>.    This will keep the output to the console so you can see what’s happening.
 
# Make sure irw shows your key presses.  If that doesn’t work, chances are nothing else will.
 
 
Again this all based on my experience on gentoo with 2.6.37 & 2.6.37.2.  YMMV based on the distro in use - chances are some of this will be taken care of behind the scenes.
 
 
When using the PVR-250 (ivtv) video capture card as the platform to receive IR signals you will want to configure your kernel to support LIRC (CONFIG_LIRC=y), support staging (CONFIG_STAGING=y, CONFIG_LIRC_STAGING=y) and support the LIRC I2C driver as a module(CONFIG_LIRC_I2C=m). Kormoc has ebuilds [https://github.com/kormoc/Ebuilds available] for LIRC 0.9.0 that should work sufficiently well with newer kernels. There is a [http://bugs.gentoo.org/show_bug.cgi?id=345833 bug] filed to get a newer version of LIRC into portage. It has many votes, consider adding your vote there if you would like that or Kormoc's ebuild in portage.
 
 
=== Debian ===
 
Starting with Wheezy (testing) in April 2011, kernel 2.6.38 is available as the default linux-image and the required modules are included as modules.
 
 
=== Fedora ===
 
Current versions of Fedora use the "systemd" boot sequence and include binaries of the LIRC package in the repositories which are set up for this boot sequence.
 
 
'''Incompatible Update''' - An incompatible update was promulgated on Fedora 19 at the end of October, 2013 so there are now two different versions of the package requiring different configurations. The new version can be configured following the procedure below. As usual after upgrades, you need to manually merge  the file "/etc/sysconfig/lirc.rpmnew" with "/etc/sysconfig/lirc"
 
 
'''As of Fedora 19 the installation procedure (for the new version) is as follows:'''
 
 
Run the "Software" utility from the "System Tools" menu and search for "lirc". Install the "lirc" package.  With some remotes, you may need the "lirc-disable-kernel" package. If you want to work with the source code of packages which use LIRC, install "lirc-devel".
 
 
Edit the file "etc/sysconfig/lirc" and insert the correct driver name in the LIRC_DRIVER="..." line. Search the MythTV wiki for documentation on your particular remote control which should specify the driver.  There is also documentation on the LIRC project site.  Make sure that LIRC_DEVICE="/dev/lirc0" is explicitly defined as this no longer defaults if left blank. Save the file.
 
 
The keycode translation tables at "/etc/lirc/lircd.conf" and at "<UserID>/.mythtv/lircrc" need to be configured for the particular control. See the documentation for the particular remote. Run the MythTV front-end once to initialize the configuration directory.
 
 
Open a root shell (or use "sudo") and execute the commands:
 
 
systemctl enable lircd.socket<br>
 
systemctl start lircd.socket"
 
 
Execute the command "irw" and press keys on the remote.  The codes should appear on the terminal. There could be a short delay before it starts to respond. Press "Ctrl-C" to terminate.
 
 
If only the arrow keys respond and produce odd codes, the kernel may be trapping the remote and trying to make it a keyboard.  See comments below on dealing with this problem.
 
 
=== Ubuntu ===
 
Ubuntu 11.04 will ship with 2.6.38 and pre-release reports would indicate it will work.
 
 
=== Setting Up The Devinput Option ===
 
The in-kernel drivers support the ir keycodes, however, mythtv cannot currently use the interpreted codes so must use lirc as a bridge.  The new drivers will break the configuration of pre 0.9.0 lirc setups. The devinput option uses the same setup for all of the receivers listed above.
 
 
This has been tested on Fedora 14 running 2.6.35.11-83 and Debian Wheezy (testing) with kernel 2.6.38-2.
 
 
# Install ir-keytable either from v4l-utils or the package of the same name (depending on distribution).
 
# Install the lirc-remotes RPM or lirc package to obtain various example lircd.conf files.
 
# Run ir-keytable to verify a driver has been loaded for your IR receiver
 
<pre>
 
[root@myth1 ~]# ir-keytable
 
Found /sys/class/rc/rc0/ (/dev/input/event3) with:
 
    Driver streamzap, table rc-streamzap
 
    Supported protocols: NEC RC-5 RC-6 JVC SONY LIRC other
 
    Enabled protocols: NEC RC-5 RC-6 JVC SONY LIRC other
 
    Repeat delay = 500 ms, repeat period = 33 ms
 
</pre>
 
Alternative command. The protocols that are in brackets are enabled.
 
<pre>
 
[root@myth1 ~]# cat /sys/class/rc/rc#/protocols
 
[rc-5] [nec] [rc-6] [jvc] [sony] [lirc]
 
</pre>
 
# Copy /usr/share/lirc-remotes/devinput/lircd.conf.devinput to /etc/lirc/lircd.conf
 
# Specify the devinput driver in /etc/sysconfig/lirc (LIRC_DRIVER="devinput") or in hardware.conf for Debian based systems.
 
# Determine which /dev/input device is available by looking in /dev/input/by-id.
 
# Specify the /dev/input device in /etc/sysconfig/lirc (LIRC_DEVICE="/dev/input/by-id/foo") or in hardware.conf for Debian based systems.
 
# Restart lirc.
 
# Check that your configuration is working by running irw and pressing some keys.
 
# You may need to change settings in mythtv. Under settings > general menu, look for the lirc setting. The device has moved in to /var/run/lirc/lircd.
 
 
Notes on Ubuntu/Mythbuntu 11.10 configuration:
 
#In hardware.conf edit REMOTE_DRIVER and REMOTE_DEVICE instead of LIRC_DRIVER and LIRC_DEVICE.
 
#Set LOAD_MODULES="false" in hardware.conf. For some reason with this set to "true", which is the default, the lirc service will not initialize properly.
 
 
== 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.
 
 
[[Keybindings]] has a list of all the keys used, which can be used in your lircrc file.
 
 
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.
 
 
Keys can also have a [http://doc.trolltech.com/4.4/qt.html#Modifier-enum modifier] applied.  These are ''case sensitive''.
 
 
Tip: To find the exact syntax for a key (especially when it does not match QT keys), 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 <tt>PgDown</tt>).
 
 
For example, Setting the (Gray Hauppauge's) Power button to be Qt::CTRL Qt::Key_Escape:
 
  begin
 
  prog = mythtv
 
  remote = Hauppauge_Gray
 
  button = KEY_POWER
 
  config = CTRL+Escape
 
  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.
 
 
To configure the TV button to jump to Live TV by using the key sequence Qt::ALT Qt::Key_L,
 
* Add or modify your lircrc to contain
 
  begin
 
  prog = mythtv
 
  remote = Hauppauge_Gray
 
  button = KEY_TV
 
  repeat = 3
 
  config = ALT+L
 
  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!
 
-->
 
  
 
== Troubleshooting ==
 
== Troubleshooting ==
Line 366: Line 210:
  
 
Source: http://www.gossamer-threads.com/lists/mythtv/users/504746#504746
 
Source: http://www.gossamer-threads.com/lists/mythtv/users/504746#504746
<!--
+
 
== Key things to remember ==
 
* Set up <code><nowiki>/etc/lircd.conf</nowiki></code> to fit your '''remote'''.
 
-->
 
 
===Other Notes===
 
===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.
 
* 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.
Line 375: Line 216:
 
* If you're using a PVR-500MCE, please read this page: [[MCE_Remote]]
 
* If you're using a PVR-500MCE, please read this page: [[MCE_Remote]]
  
<!--
 
==Multiple remotes==
 
See [[MultiLIRC]] for my mods to the standard Debian Lenny lirc installation for running multiple lirc remotes and keeping everything separate.
 
-->
 
<!-- to here -->
 
 
== Distribution-specific notes ==
 
== Distribution-specific notes ==
 
=== Ubuntu/Mythbuntu lircrc generation ===
 
=== Ubuntu/Mythbuntu lircrc generation ===
Line 391: Line 227:
  
 
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].
 
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].
<!--
 
=== Fedora 14 x86_64 Hauppauge PVR 150 ===
 
Credit goes to:
 
 
Jarod Wilson
 
 
Mark Weaver
 
http://www.blushingpenguin.com/mark/blog/?p=24
 
 
1:  Get firmware
 
 
Download firmware from:
 
 
http://www.blushingpenguin.com/mark/lmilk/haup-ir-blaster.bin
 
 
and copy to /lib/firmware
 
 
2:  Get lircd.conf
 
 
http://www.blushingpenguin.com/mark/lmilk/lircd.conf
 
and copy to /etc/lirc/lircd.conf
 
 
3:      Probe the modules
 
 
/sbin/modprobe lirc_dev debug=1 && modprobe lirc_zilog
 
 
4:      restart lirc
 
 
/etc/init.d/lirc restart
 
 
5:      Make it permament
 
 
edit rc.local and add to the bottom
 
 
/sbin/modprobe lirc_dev debug=1 && modprobe lirc_zilog
 
 
=== Debian Wheezy amd64 Hauppauge PVR 350 ===
 
 
Lirc configuration on Debian Wheezy (testing) for Hauppauge PVR-350 and A415-HPG-WE remote
 
 
This text is a manual for the configuration. It worked on my machine with the hardware described. Obviously, there is more than one remote out there for the PVR-350, all with slightly different settings. There is also lots of descriptions for older lirc versions. These are almost useless for lirc 0.9.0 as part of the kernel.
 
 
==== Hardware ====
 
AMD Phenom X2 box
 
 
Hauppauge PVR-350 card
 
 
A415-HPG-WE remote (the model as shown in this picture: [http://www.mythtv.org/wiki/File:Pvr350_grey_remote_generic.gif])
 
 
==== Software ====
 
Debian Wheezy (testing / June 2011)
 
 
Kernel: 2.6.38-2-amd64
 
 
lirc: 0.9.0-pre1
 
 
===== Files in /etc/lirc =====
 
hardware.conf 
 
 
lircd.conf
 
 
===== hardware.conf: =====
 
<pre># /etc/lirc/hardware.conf
 
#
 
# Arguments which will be used when launching lircd
 
LIRCD_ARGS=""
 
 
#Don't start lircmd even if there seems to be a good config file
 
#START_LIRCMD=false
 
 
#Don't start irexec, even if a good config file seems to exist.
 
#START_IREXEC=false
 
 
#Try to load appropriate kernel modules
 
LOAD_MODULES=true
 
 
# Run "lircd --driver=help" for a list of supported drivers.
 
DRIVER="devinput"
 
# usually /dev/lirc0 is the correct setting for systems using udev
 
DEVICE="/dev/input/event8"
 
MODULES="ir-kbd-i2c"
 
 
# Default configuration files for your hardware if any
 
LIRCD_CONF=""
 
LIRCMD_CONF=""</pre>
 
 
To find out what to enter into DEVICE="", check out
 
<pre>cat /proc/bus/input/devices</pre>
 
 
Look for section where you can find this information:
 
<pre>I: Bus=0018 Vendor=0000 Product=0000 Version=0000
 
N: Name="i2c IR (Hauppauge WinTV PVR-350"
 
P: Phys=i2c-0/0-0018/ir0
 
S: Sysfs=/devices/virtual/rc/rc0/input10
 
U: Uniq=
 
H: Handlers=kbd event8
 
B: PROP=0
 
B: EV=100013
 
B: KEY=c0010 201080400000000 0 30200a000 18000004801 9e000000000000 ffc
 
B: MSC=10</pre>
 
 
The line starting with H says event8. Meaning that we can find our remote under /dev/input/event8
 
 
===== lircd.conf: =====
 
copy lircd.conf.devinput from /usr/share/lirc/remotes/devinput to /etc/lirc/:
 
<pre>cp /usr/share/lirc/remotes/devinput/lircd.conf.devinput /etc/lirc/lircd.conf</pre>
 
 
===== Set up key map for A415-HPG-WE remote =====
 
I've got the almost correct keymap for the remote from /lib/udev/rc_keymaps
 
and copied it into /etc/rc_keymaps/:
 
<pre>cp /lib/udev/rc_keymaps/haupp /etc/rc_keymaps/</pre>
 
 
The difference is, that all codes start with 0x1e.., while 0x00.. would be correct for my remote.
 
File should though look like this (i've called this file haupp350):
 
<pre># table haupp, type: UNKNOWN
 
0x0000 KEY_0
 
0x0001 KEY_1
 
0x0002 KEY_2
 
0x0003 KEY_3
 
0x0004 KEY_4
 
0x0005 KEY_5
 
0x0006 KEY_6
 
0x0007 KEY_7
 
0x0008 KEY_8
 
0x0009 KEY_9
 
0x000a KEY_KPASTERISK
 
0x000b KEY_RED
 
0x000c KEY_RADIO
 
0x000d KEY_MENU
 
0x000e KEY_GRAVE
 
0x000f KEY_MUTE
 
0x0010 KEY_VOLUMEUP
 
0x0011 KEY_VOLUMEDOWN
 
0x0012 KEY_CHANNEL
 
0x0014 KEY_UP
 
0x0015 KEY_DOWN
 
0x0016 KEY_LEFT
 
0x0017 KEY_RIGHT
 
0x0018 KEY_VIDEO
 
0x0019 KEY_AUDIO
 
0x001a KEY_MEDIA
 
0x001b KEY_EPG
 
0x001c KEY_TV
 
0x001e KEY_NEXT
 
0x001f KEY_BACK
 
0x0020 KEY_CHANNELUP
 
0x0021 KEY_CHANNELDOWN
 
0x0024 KEY_LAST
 
0x0025 KEY_OK
 
0x0029 KEY_BLUE
 
0x002e KEY_GREEN
 
0x0030 KEY_PAUSE
 
0x0032 KEY_REWIND
 
0x0034 KEY_FASTFORWARD
 
0x0035 KEY_PLAY
 
0x0036 KEY_STOP
 
0x0037 KEY_RECORD
 
0x0038 KEY_YELLOW
 
0x003b KEY_GOTO
 
0x003d KEY_POWER</pre>
 
 
 
Then i've edited /etc/rc_maps.cfg to look like the following:
 
<pre>*      *      /etc/rc_keymaps/haupp350</pre>
 
The above is the only uncommented line
 
 
Time for a restart now (or try restarting just udev?)
 
 
Invoke irw, and press buttons on your remote to check if everything is working. You should get an output like this:
 
<pre>0000000080010193 00 KEY_CHANNELDOWN devinput                                   
 
0000000080010071 00 KEY_MUTE devinput
 
00000000800100a7 00 KEY_RECORD devinput</pre>
 
 
Now, we have to adjust ~/.lircrc. The name like KEY_CHANNELDOWN has to be attached to the appropiate keyboard key for mythtv.
 
My .lircrc looks like this (this is an evolved file from other tutorials and howto's):
 
<pre># lircrc Hauppauge PVR-350 with lirc 0.9.0
 
# save it in ~/.lircrc
 
 
# begin mythtv
 
 
begin
 
    prog = mythtv
 
    button = KEY_POWER
 
    config = Esc
 
#    mode = irexec
 
    repeat = 0
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_GOTO
 
# Swap the PiP windows
 
    config = N
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_1
 
    config = 1
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_2
 
    config = 2
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_3
 
    config = 3
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_4
 
    config = 4
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_5
 
    config = 5
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_6
 
    config = 6
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_7
 
    config = 7
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_8
 
    config = 8
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_9
 
    config = 9
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_BACK
 
    config = Esc
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_0
 
    config = 0
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_MENU
 
    config = M
 
end
 
 
begin
 
  prog = mythtv
 
# This is the Red key
 
# We'll use it for "Delete"
 
  button = KEY_RED
 
  config = D
 
end
 
 
begin
 
  prog = mythtv
 
# This is the Green key
 
# We'll use it for "Information"
 
  button = KEY_GREEN
 
  config = I
 
end
 
 
# Note the "repeat =" strings in the volume and channel.
 
# This means that if you hold down the key, every nth instance will be
 
# passed.  This depends on your system, so you may want to increase or
 
# decrease this and see what happens.  repeat = 1 is probably too
 
# fast.
 
 
begin
 
    prog = mythtv
 
    button = KEY_CHANNELUP
 
    repeat = 3
 
    config = Up
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_CHANNELDOWN
 
    repeat = 3
 
    config = Down
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_VOLUMEDOWN
 
    repeat = 3
 
    config = F10
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_VOLUMEUP
 
    repeat = 3
 
    config = F11
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_OK
 
    config = Return
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_MUTE
 
    config = F9
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_REWIND
 
    repeat = 3
 
    config = Left
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_PLAY
 
    config = P
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_FASTFORWARD
 
    repeat = 3
 
    config = Right
 
end
 
 
begin
 
  prog = mythtv
 
  button = KEY_RECORD
 
  config = R
 
end
 
 
begin
 
  prog = mythtv
 
  button = KEY_STOP
 
  config = Esc
 
end
 
 
begin
 
    prog = mythtv
 
    button = KEY_PAUSE
 
    config = P
 
end
 
 
begin
 
  prog = mythtv
 
  button = KEY_LAST
 
# Use for backwards commercial skip
 
    config = Q
 
end
 
 
begin
 
  prog = mythtv
 
  button = KEY_NEXT
 
# Use for forward commercial skip
 
    config = Z
 
end
 
 
begin
 
  prog = mythtv
 
  button = KEY_EPG
 
# Use for showing program
 
    config = S
 
end
 
 
begin
 
  prog = mythtv
 
  button = KEY_UP
 
# Use it
 
    config = Up
 
end
 
 
begin
 
  prog = mythtv
 
  button = KEY_LEFT
 
# Use it
 
    config = Left
 
end
 
 
begin
 
  prog = mythtv
 
  button = KEY_RIGHT
 
# Use it
 
    config = Right
 
end
 
 
begin
 
  prog = mythtv
 
  button = KEY_DOWN
 
# Use it
 
    config = Down
 
end
 
# end mythtv
 
 
</pre>
 
 
==== Hints for trouble shooting ====
 
 
The correct scancodes can be found out using evtest for scancodes:
 
<pre>aptitude install evtest</pre>
 
run evtest and press buttons.
 
Results on my box (pressing all buttons from top left to lower right row after row) key events come from crappy default keytable, not the right one we've already installed above:
 
<pre>
 
Go:
 
  Event: time 1307978095.428942, type 4 (Misc), code 4 (ScanCode), value 3b
 
Power:
 
  Event: time 1307978113.528933, type 4 (Misc), code 4 (ScanCode), value 3d
 
  Event: time 1307978113.780007, type 1 (Key), code 205 (Suspend), value 0
 
TV:
 
  Event: time 1307967746.640939, type 4 (Misc), code 4 (ScanCode), value 1c
 
Videos:
 
  Event: time 1307967769.144944, type 4 (Misc), code 4 (ScanCode), value 18
 
Music:
 
  Event: time 1307967777.144944, type 4 (Misc), code 4 (ScanCode), value 19
 
Pictures:
 
  Event: time 1307967784.248940, type 4 (Misc), code 4 (ScanCode), value 1a
 
Guide:
 
  Event: time 1307967801.752937, type 4 (Misc), code 4 (ScanCode), value 1b
 
Radio:
 
  Event: time 1307979946.568937, type 4 (Misc), code 4 (ScanCode), value 0c
 
  Event: time 1307979946.568956, type 1 (Key), code 116 (Power), value 1
 
Arrow up:
 
  Event: time 1307967842.552948, type 4 (Misc), code 4 (ScanCode), value 14
 
Arrow left:
 
  Event: time 1307967853.560945, type 4 (Misc), code 4 (ScanCode), value 16
 
Arrow right:
 
  Event: time 1307967920.060940, type 4 (Misc), code 4 (ScanCode), value 17
 
Arrow down:
 
  Event: time 1307967934.060943, type 4 (Misc), code 4 (ScanCode), value 15
 
OK:
 
  Event: time 1307967940.960939, type 4 (Misc), code 4 (ScanCode), value 25
 
Back/exit:
 
  Event: time 1307967865.260940, type 4 (Misc), code 4 (ScanCode), value 1f
 
Menu (i):
 
  Event: time 1307968088.664955, type 4 (Misc), code 4 (ScanCode), value 0d
 
  Event: time 1307968088.916003, type 1 (Key), code 113 (Mute), value 0
 
Vol +:
 
  Event: time 1307968120.364935, type 4 (Misc), code 4 (ScanCode), value 10
 
  Event: time 1307968120.364954, type 1 (Key), code 115 (VolumeUp), value 1
 
Vol -:
 
  Event: time 1307968134.164942, type 4 (Misc), code 4 (ScanCode), value 11
 
  Event: time 1307968134.164960, type 1 (Key), code 114 (VolumeDown), value 1
 
Prev. Ch:
 
  Event: time 1307968019.960937, type 4 (Misc), code 4 (ScanCode), value 12
 
  Event: time 1307968019.960956, type 1 (Key), code 225 (Brightness up), value 1
 
Mute:
 
  Event: time 1307968055.860942, type 4 (Misc), code 4 (ScanCode), value 0f
 
  Event: time 1307968055.860958, type 1 (Key), code 377 (TV), value 1
 
Ch. +:
 
  Event: time 1307968156.868936, type 4 (Misc), code 4 (ScanCode), value 20
 
  Event: time 1307968156.868953, type 1 (Key), code 402 (ChannelUp), value 1
 
Ch. -:
 
  Event: time 1307968167.068941, type 4 (Misc), code 4 (ScanCode), value 21
 
  Event: time 1307968167.320005, type 1 (Key), code 403 (ChannelDown), value 0
 
Rec:
 
  Event: time 1307968178.968940, type 4 (Misc), code 4 (ScanCode), value 37
 
  Event: time 1307968179.220008, type 1 (Key), code 167 (Record), value 0
 
Stop:
 
  Event: time 1307968191.568940, type 4 (Misc), code 4 (ScanCode), value 36
 
  Event: time 1307968191.568959, type 1 (Key), code 128 (Stop), value 1
 
Search backwards:
 
  Event: time 1307968199.768944, type 4 (Misc), code 4 (ScanCode), value 32
 
  Event: time 1307968199.768963, type 1 (Key), code 168 (Rewind), value 1
 
Play:
 
  Event: time 1307968210.568949, type 4 (Misc), code 4 (ScanCode), value 35
 
  Event: time 1307968210.568968, type 1 (Key), code 207 (Play), value 1
 
Search forward:
 
  Event: time 1307968218.072942, type 4 (Misc), code 4 (ScanCode), value 34
 
Replay:
 
  Event: time 1307968228.672937, type 4 (Misc), code 4 (ScanCode), value 24
 
Pause:
 
  Event: time 1307968237.072939, type 4 (Misc), code 4 (ScanCode), value 30
 
  Event: time 1307968237.072957, type 1 (Key), code 119 (Pause), value 1
 
Skip:
 
  Event: time 1307968246.672941, type 4 (Misc), code 4 (ScanCode), value 1e
 
  Event: time 1307968246.672961, type 1 (Key), code 217 (Search), value 1
 
1:
 
  Event: time 1307968260.273040, type 4 (Misc), code 4 (ScanCode), value 01
 
  Event: time 1307968260.273060, type 1 (Key), code 2 (1), value 1
 
2:
 
  Event: time 1307968279.976939, type 4 (Misc), code 4 (ScanCode), value 02
 
  Event: time 1307968279.976960, type 1 (Key), code 3 (2), value 1
 
3:
 
  Event: time 1307968292.876941, type 4 (Misc), code 4 (ScanCode), value 03
 
  Event: time 1307968292.876956, type 1 (Key), code 4 (3), value 1
 
4:
 
  Event: time 1307968305.976937, type 4 (Misc), code 4 (ScanCode), value 04
 
  Event: time 1307968305.976959, type 1 (Key), code 5 (4), value 1
 
5:
 
  Event: time 1307968314.676946, type 4 (Misc), code 4 (ScanCode), value 05
 
  Event: time 1307968314.676965, type 1 (Key), code 6 (5), value 1
 
6:
 
  Event: time 1307968384.076945, type 4 (Misc), code 4 (ScanCode), value 06
 
  Event: time 1307968384.076966, type 1 (Key), code 7 (6), value 1
 
7:
 
  Event: time 1307968351.376944, type 4 (Misc), code 4 (ScanCode), value 07
 
  Event: time 1307968351.376964, type 1 (Key), code 8 (7), value 1
 
8:
 
  Event: time 1307968412.776940, type 4 (Misc), code 4 (ScanCode), value 08
 
  Event: time 1307968412.776959, type 1 (Key), code 9 (8), value 1
 
9:
 
  Event: time 1307968422.576950, type 4 (Misc), code 4 (ScanCode), value 09
 
  Event: time 1307968422.576970, type 1 (Key), code 10 (9), value 1
 
*:
 
  Event: time 1307968435.376937, type 4 (Misc), code 4 (ScanCode), value 0a
 
0:
 
  Event: time 1307968443.176924, type 4 (Misc), code 4 (ScanCode), value 00
 
  Event: time 1307968443.427990, type 1 (Key), code 11 (0), value 0
 
#:
 
  Event: time 1307968452.976938, type 4 (Misc), code 4 (ScanCode), value 0e
 
Red:
 
  Event: time 1307968459.980935, type 4 (Misc), code 4 (ScanCode), value 0b
 
  Event: time 1307968459.980954, type 1 (Key), code 363 (Channel), value 1
 
Green:
 
  Event: time 1307968474.584948, type 4 (Misc), code 4 (ScanCode), value 2e
 
  Event: time 1307968474.584969, type 1 (Key), code 139 (Menu), value 1
 
Yellow:
 
  Event: time 1307968484.284916, type 4 (Misc), code 4 (ScanCode), value 38
 
Blue:
 
  Event: time 1307968492.884941, type 4 (Misc), code 4 (ScanCode), value 29
 
</pre> 
 
-->
 
  
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]
  
 
[[Category:Remote Control|1200]]
 
[[Category:Remote Control|1200]]

Revision as of 20:03, 25 October 2015


Software-update-available.png This page is up-to-date as of MythTV version 0.27.6, the current release is 30.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:

  • The receiver that comes with your TV card. For example, the HD-PVR series from Hauppauge sometimes have a receiver.
  • 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). 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 evdev.
  • A USB receiver you can make yourself.
  • A Parallel Port transmitter and/or receiver you can make yourself.
  • 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
  • Refer to http://www.lirc.org/ where there is a list of available devices that work with LIRC.

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.

./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

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.