Gentoo Wiki ArchivesGentoo Wiki

HOWTO_Setup_LIRC_for_MythTV


Please improve it in any way that you see fit, and remove this notice {{Cleanup}} from the article. For tips on cleaning and formatting see Cleanup process


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

MythTV Series

MythTV

Installation

Tips/Tweaking

Usage

edit

If your remote responds on screen with irw but not inside MythTV, you may not have finished the entire setup. First of all, if you're using irexec, I wanted to say that irexec only translates your button signals into a command. This means that you may very easily use irexec to start MythTV with a single button, because starting MythTV is as easy as typing mythfrontend in a terminal. But programming your entire MythTV controls with irexec is a bit of a challenge. Perhaps, it may be as difficult as having to assign each remote keys to a macro of keyboard commands while considering the window session focus. I'd say this method is not impossible, but a challenge. I haven't tried, of course.

The following method is one that I find to be easier, but not yet well documented (neither is the one mentioned above, really):

As stated above, if you haven't done so already, you'll need to re-compile MythTV with the USE flag lirc.

Believe it or not, you're still not quite finished yet. Now, you need to tell the mythtv-lirc-module (not lirc itself) about your remote control button configuration. This means population of the MythTV LIRC config in $USERNAME/.mythtv/lircrc, where $USERNAME is the user running the mythfrontend interface.

File: ~/.mythtv/lircrc
## repeat = X means repeath every Xth time signal received
## default is 0 => don't repeat
## mythtv config for SBLive/Audigy Platinum Remote RM-900 / RM-1000W
## other remotes may be somehwat similar
## if you have a TV remote rather than a DVD remote you'll probably want
## to change up/down to something like ch+ ch- -- use irw too see what your
## remote calls them

#this bunch are pretty self-explanatory
begin
    remote = *
    button = up
    prog   = mythtv
    config = Up
    repeat = 1
end
begin
    remote = *
    button = down
    prog   = mythtv
    config = Down
    repeat = 1
end
begin
    remote = *
    button = left
    prog   = mythtv
    config = Left
end
begin
    remote = *
    button = right
    prog   = mythtv
    config = Right
end

#stop in mythmusic OR show osd
begin
    remote = *
    button = stop
    prog   = mythtv
    config = O
end
begin
    remote = *
    button = play
    prog   = mythtv
    config = P
end
begin
    remote = *
    button = prev
    prog   = mythtv
    config = Home
end
begin
    remote = *
    button = next
    prog   = mythtv
    config = End
end
begin
    remote = *
    button = vol-
    prog   = mythtv
    config = [
    repeat = 1
end
begin
    remote = *
    button = vol+
    prog   = mythtv
    config = ]
    repeat = 1
end
begin
    remote = *
    button = ok
    prog   = mythtv
    config = Enter
end
begin
    remote = *
    button = mute
    prog   = mythtv
    config = |
end
begin
    remote = *
    button = 1
    prog   = mythtv
    config = 1
end
begin
    remote = *
    button = 2
    prog   = mythtv
    config = 2
end
begin
    remote = *
    button = 3
    prog   = mythtv
    config = 3
end
begin
    remote = *
    button = 4
    prog   = mythtv
    config = 4
end
begin
    remote = *
    button = 5
    prog   = mythtv
    config = 5
end
begin
    remote = *
    button = 6
    prog   = mythtv
    config = 6
end
begin
    remote = *
    button = 7
    prog   = mythtv
    config = 7
end
begin
    remote = *
    button = 8
    prog   = mythtv
    config = 8
end
begin
    remote = *
    button = 9
    prog   = mythtv
    config = 9
end
begin
    remote = *
    button = 0
    prog   = mythtv
    config = 0
end

#Show menu
begin
    remote = *
    button = options
    prog   = mythtv
    config = M
end

#Jump to bookmarked position
begin
    remote = *
    button = return
    prog   = mythtv
    config = K
end

#Cycle through aspect ratios
begin
    remote = *
    button = display
    prog   = mythtv
    config = W    
end

#close/cancel/escape
begin
    remote = *
    button = close
    prog   = mythtv
    config = Esc
    repeat = 3
end

#show teletext / captions
begin
    remote = *
    button = cmss
    prog   = mythtv
    config = T
end

#Show information (OK button is Enter)
begin
    remote = *
    button = start
    prog   = mythtv
    config = I
end

#adjust time stretch
begin
    remote = *
    button = slow
    prog   = mythtv
    config = A
end

#increase play speed
begin
    remote = *
    button = step
    prog   = mythtv
    config = U
end

#cycle through audio streams
begin
    remote = *
    button = eax
    prog   = mythtv
    config = +
end


begin
    remote = *
    button = power
    prog   = mythtv
    config = Esc
end
begin
    remote = *
    button = record
    prog   = mythtv
    config = R
end

#doesn't usually trigger on my remote
begin
    remote = *
    button = pause
    prog   = mythtv
    config = P
end

After you've placed this code into the mentioned file (with enough of specific), try restarting mythfrontend. You may have to enter the LiveTV mode to test if the number buttons actually work. Try channel 2 with the (button 0) (button 2). Try channel 21 with (button 2) (button 1). If it does, then go along and set up the other numbers as well as the MythTV functions. (These can be looked up in the MythTV documentation) Well, I wish you luck. It took me too long to find this out.

Contents

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: LIRC

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

Note: On my system, mceusb2 requires at least lirc 0.8.1. Versions less than this would not create /dev/lirc/0.
Note: You may need to replace 'lirc_devices_hauppauge' by 'lirc_devices_devinput' on newer kernels.
Note: Why not have 'hauppauge' in LIRC_DEVICES in make.conf
Note: For CommandIR Multi-blaster Transceiver, follow this short guide

Emerging lirc

Now we need to emerge lirc and copy some config files:

emerge lirc
rc-update add lircd default

Setting up /etc/conf.d/lircd

Check the name of your lirc socket and character device:

Note: On my system, I didn't see these devices until I'd run the start and modprobe commands below.

Note: Depending on versions, lirc0 could be called lirc/0. If that device node does not show up after loading the modules, chances are you compiled lirc with the wrong driver. Using debug=1 while loading each module will give some more output in [[dmesg]].
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"

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.

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.

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.

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

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


Remote config - Custom Remote Configurations

A free tool for configuring remotes for MythTV can be found at http://lircconfig.commandir.com/.

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.

Retrieved from "http://www.gentoo-wiki.info/MythTV/LIRC"

Last modified: Wed, 20 Aug 2008 07:55:00 +1000 Hits: 37,996

Created by NickStallman.net, Luxury Homes Australia
Real estate agents should list their apartments, townhouses and units in Australia.