HOWTO Setup LIRC for MythTV
From Gentoo Linux Wiki
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
|
|
|
Installation
Tips/Tweaking Usage |
| edit |
[edit] lirc (getting the remote to work)
First, we need to make sure the proper versions will be installed, and compiled with the proper options. If you've done this already you can skip this and go directly to "Emerging". Also see: HOWTO LIRC
[edit] Options and unmasking
If you're emerging LIRC < 0.8.0-r1
echo 'LIRC_OPTS="--with-driver=hauppauge"' >> /etc/make.conf
Otherwise add the lirc_devices_hauppauge to your use flag
echo 'LIRC_DEVICES="hauppauge"' >> /etc/make.conf
Then do:
[ ! -d /etc/portage ] && mkdir -p /etc/portage echo 'app-misc/lirc ~x86' >> /etc/portage/package.keywords
(note: If the first line is omitted the package will only compile the lirc_serial driver. In order to get the lirc_i2c driver needed for the Hauppauge cards this line must be included. If you have one of the hauppauge dvb cards like the Nova you will need --with-driver=hauppauge_dvb. In case you have an hauppauge mce card with usb connection for the ir blaster, you will need the mceusb or mceusb2 driver, so --with-driver=mceusb or --with-driver=mceusb2. The module will then be called lirc_mceusb or lirc_mceusb2. For example, the PVR150 MCE works with the mceusb2 driver.)
[edit] Emerging lirc
Now we need to emerge lirc and copy some config files:
emerge lirc rc-update add lircd default
[edit] Setting up /etc/conf.d/lircd
Check the name of your lirc socket and character device:
localhost ~ # ls -la /dev/lirc* crw-rw---- 1 root root 61, 0 Apr 10 02:57 /dev/lirc crw-rw---- 1 root root 61, 0 Apr 10 02:57 /dev/lirc0 srw-rw-rw- 1 root root 0 Apr 10 03:34 /dev/lircd
Verify that /etc/conf.d/lircd is set to the character device.
# If socket is /dev/lirc0 LIRCD_OPTS="-d /dev/lirc0"
If you're using udev (version > 2.4), the device will be:
LIRCD_OPTS="-d /dev/lirc/0"
[edit] Running lircd
Run this.
/etc/init.d/lircd start
If you change /etc/lircd.conf, you'll need to do this to use the new configuration.
/etc/init.d/lircd restart
Make sure the appropriate modules have been inserted. I'm using the pvr-250 IR remote and it needs the lirc-i2c module. To insert the proper modules, type:
modprobe lirc-i2c
and that should insert the module for you.
If you want to load the module automatically after a reboot, don't forget to add the module to /etc/modules.autoload/kernel-2.<your version here>, i.e: /etc/modules.autoload.d/kernel-2.6 or /etc/modules.autoload.d/kernel-2.4 depending on your kernel version.
[edit] Setting up /etc/lircd.conf
Now we need the configuration file for your remote.
If you are not using a Hauppauge remote, check http://lirc.sourceforge.net/remotes/ or http://lircconfig.commandir.com/lircd.conf/ to see if there is one available for your remote otherwise you will need to create the /etc/lircd.conf file using irrecord.
There appear to be 3 versions of the hauppage remote. If you have the newer versions of the hauppage remote which is grey on top and black on the bottom then you can get a replacement for the /etc/lircd.conf file here After you've replaced the file re/start lircd. If you have either the pure black or gray remote, apparently the included lircd.conf file works fine but I don't own one so I can't test it.
or try here: http://lirc.sourceforge.net/remotes/hauppauge/ for more remote control configuration options. (Carter) I have a gray top, black bottom remote from the WinTV PVR 350. I used the lircd.conf.hauppauge file from the sourceforge link and things are working fine for me. (DeKay) I also have a gray top, black bottom remote but it is from a WinTV PVR 150 MCE. It has "RC6" printed on the back and did not work with any of the configurations in the default /etc/lircd.conf file. I had to use the version from here
To create your own /etc/lircd.conf file: (use the character device for the --device option)
irrecord --device=/dev/lirc0 /etc/lircd.conf
The irrecord program will record the signals from your remote control and create a config file for lircd. A proper config file for lircd is maybe the most vital part of this package, so you should invest some time to create a working config file. Check out http://www.lirc.org/html/irrecord.html for more information on how to use irrecord.
[edit] Testing the remote
Run
irw
And push some buttons. You should see output. If you don't make sure you have the proper /etc/lircd.conf file for your remote.
[edit] Specially for av7110 (Hauppauge Nexus-s) cards
You have to do some special things to get this RC working:
Do:
av7110_loadkeys <location>/hauppauge_grey.rc5 > /proc/av7110_ir
The loadkeys-script and the rc5-file can be found in the linuxtv-dvb-apps package at linuxtv.org
[edit] Power button to turn on mythfrontend
If you wish to use your Power button to turn on mythfrontend incase of crash you can do so by adding 'irexec --daemon' to your startup and add the following to your ~/.lircrc (this applies to hauppauge remotes, adjust as needed)
| File: ~/.lircrc |
begin
button = Power
prog = irexec
repeat = 0
config = mythfrontend
end
|
[edit] Remote config - Custom Remote Configurations
A free tool for configuring remotes for MythTV can be found at http://lircconfig.commandir.com/.
[edit] Remote config hauppauge
Basically, there are two ways to run mythtv with a remote, you can:
1) compile lirc support into mythtv and create a ~/.mythtv/lircrc file. NOTE: This requires setting the USE variable: lirc
or
2) create a ~/.lircrc file, and run irxevent to map IR signals to x-events while mythtv is running.
Option #1
A sample config for your remote. This uses mythtv as its backend. This file should be ~/.mythtv/lircrc (note lack of .) for the user that runs mythfrontend.
Unfortunately, at the moment it doesn't seem to be possible to map ctrl-key keypresses using lirc. The syntax to map Ctrl-Q to the Off button should be the following, however it doesn't currently work.
begin
prog = mythtv
button = Off
config = \Q
end
This is because mythtv uses QT key names. This works:
begin
prog = mythtv
button = Off
config = Ctrl+Q
end
See the Hauppage .mythtv/lircrc example
Option #2
A sample config for your remote. This uses irxevent as its backend (as in you should include irxevent & in your .xinitrc). This file should be ~/.lircrc for the user that runs mythfrontend. Hauppage .lircrc example
NOTE: If you are seeing an error when you start MythTV (mythfrontend) complaining about an invalid file format for .mythtv/lircrc, it may be because the file has DOS/Windows-style line breaks. You can confirm this by opening the file in vi (you may need to emerge vim) as a binary file:
vi -b ~/.mythtv/lircrc
If you see an extra ^M at the end of every line, then you have DOS-style line breaks. To fix this in vim, enter the following in command mode before saving:
:set ff=unix
Alternatively, you can use flip, or emerge dos2unix if you do not use vim.

