Configure LIRC v0.9.1a on CentOS v7.1 for MythTV v27.5 with a Microsoft MCE remote control
Old notes from Jun 2015.
Steps:
- Install LIRC
- Verify Linux device
- Disable keyboard input device in X11
- Install LIRC configuration
- Install MythTV configuration
Install
Add Linux device input support
# yum install v4l-utils lirc lirc-remotes iguanaIR libcecNote: 'iguanaIR' is an unexpressed library dependency.
/bin/cp /usr/share/lirc-remotes/devinput/lircd.conf.devinput /etc/lirc/lircd.conf systemctl enable lircd systemctl start lircd
Linux driver support
Verify that the remote control device driver is loaded. Verify that the ir-keytable is loaded for the device. The 'v4l-utils' package should have provided the keymaps in the directory '/usr/lib/udev/rc_keymaps/rc6_mce'. The configuration file '/etc/rc_maps.cfg' provides the linking between the kernel mode driver and the keymap file. Use ir-keytable to verify the keymap is loaded.
LIRC
Configuration file
Install the latest lircd.conf.devinput file from sourceforge. Initially the disbution devinput file ('/usr/share/lirc-remotes/devinput/lircd.conf.devinput' was used but a warning message indicated the newer version was required).
$ wget http://lirc.sourceforge.net/remotes/devinput/lircd.conf.devinput # mv lircd.conf.devinput /etc/lirc/lircd.conf
Service configuration
Change the systemd service configuration file to support configuring the driver and the device. Edit '/usr/lib/systemd/system/lircd.service' with default values and a configuration file:
[Unit] Description=LIRC Infrared Signal Decoder After=network.target [Service] Environment=LIRC_DRIVER=devinput Environment=LIRC_DEVICE=/dev/input/input0 EnvironmentFile=-/etc/sysconfig/lircd Type=simple ExecStart=/usr/sbin/lircd --nodaemon --driver=${LIRC_DRIVER} --device=${LIRC_DEVICE} /etc/lirc/lircd.conf [Install] WantedBy=multi-user.target
Add a configuration file to configure the lircd service '/etc/sysconfig/lircd':
LIRC_DRIVER=devinput LIRC_DEVICE=/dev/input/by-id/usb-Philips_eHome_Infrared_Transceiver_PH00PEzs-event-if00
Reload the configuration, and start the lircd service:
# systemctl daemon-reload # systemctl enable lircd # systemctl start lircd
Verify
Use irw to check that lircd is getting the remote control keypress events:
$ irw 0000000080010067 00 KEY_UP devinput 00000000800100cf 00 KEY_PLAY devinput 0000000080010077 00 KEY_PAUSE devinput 0000000080010077 00 KEY_PAUSE devinput 0000000080010080 00 KEY_STOP devinput
X11
# # Ignore remote controls that are handled by LIRC # Section "InputClass" Identifier "Ignore IR remote as Keyboard input" MatchProduct "Media Center Ed. eHome Infrared Remote Transceiver (147a:e017)| Media Center Ed. eHome Infrared Remote Transceiver (0471:0815)| TopSeed Tech Corp. USB IR Combo Device" MatchIsKeyboard "true" Option "Ignore" "true" EndSection
irexec
[Desktop Entry] Version=1.0 Name=Irexec daemon Comment=Handle IR command server Name[se]=Hantera IR-kommandon Exec=run-irexec Icon=applications-system Terminal=false Type=Application Categories=AudioVideo;Application;X-Fedora-Extra
MythTV Frontend
Add a lircrc configuration to the frontend user (mythttv) as '~/.lircrc'. Customise this as required. e.g.
# Channel Up
begin
prog = mythtv
button = KEY_UP
repeat = 3
config = Up
end
# Channel Down
begin
prog = mythtv
button = KEY_DOWN
repeat = 3
config = Down
end
# OK/Select
begin
prog = mythtv
button = KEY_OK
config = Space
end
Links
Appendices
ir-keytable
$ ir-keytable Found /sys/class/rc/rc0/ (/dev/input/event8) with: Driver mceusb, table rc-rc6-mce Supported protocols: NEC RC-5 RC-6 JVC SONY SANYO LIRC other Enabled protocols: NEC RC-5 RC-6 JVC SONY SANYO LIRC other Extra capabilities: <access denied>
rc protocols
"If more than one item is enclosed in square brackets, then something other than LIRC is getting those signals."
# cat /sys/class/rc/rc0/protocols rc-5 nec rc-6 jvc sony sanyo mce_kbd [lirc]
Input Device Names
Get a fancy list of names with:
for i in /sys/class/input/input* ; do echo -n "$(basename "$i"): "; cat "$i/name"; done
# grep . /sys/class/input/input*/name /sys/class/input/input0/name:Power Button /sys/class/input/input10/name:HDA NVidia HDMI/DP,pcm=3 /sys/class/input/input11/name:HDA NVidia HDMI/DP,pcm=7 /sys/class/input/input1/name:Power Button /sys/class/input/input2/name:USB USB Keykoard /sys/class/input/input3/name:USB USB Keykoard /sys/class/input/input4/name:PC Speaker /sys/class/input/input5/name:Microsoft Microsoft Wheel Mouse Optical® /sys/class/input/input6/name:TopSeed Tech Corp. USB IR Combo Device /sys/class/input/input7/name:TopSeed Tech Corp. USB IR Combo Device /sys/class/input/input8/name:Media Center Ed. eHome Infrared Remote Transceiver (0471:0815) /sys/class/input/input9/name:MCE IR Keyboard/Mouse (mceusb)
xinput list
# xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ TopSeed Tech Corp. USB IR Combo Device id=10 [slave pointer (2)] ⎜ ↳ MCE IR Keyboard/Mouse (mceusb) id=14 [slave pointer (2)] ⎜ ↳ USB USB Keykoard id=12 [slave pointer (2)] ⎜ ↳ Microsoft Microsoft Wheel Mouse Optical® id=13 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Power Button id=6 [slave keyboard (3)] ↳ Power Button id=7 [slave keyboard (3)] ↳ TopSeed Tech Corp. USB IR Combo Device id=9 [slave keyboard (3)] ↳ Media Center Ed. eHome Infrared Remote Transceiver (0471:0815) id=11 [slave keyboard (3)] ↳ USB USB Keykoard id=8 [slave keyboard (3)]
/usr/share/X11/xorg.conf.d/90-IgnoreIrRemote.conf
# # Ignore remote controls that are handled by LIRC # Section "InputClass" Identifier "Ignore IR remote as Keyboard input" MatchProduct "Media Center Ed. eHome Infrared Remote Transceiver (147a:e017)| Media Center Ed. eHome Infrared Remote Transceiver (0471:0815)| TopSeed Tech Corp. USB IR Combo Device" MatchIsKeyboard "true" Option "Ignore" "true" EndSection
Note: the MatchProduct line is word wrapped for ease of reading.
Modules
$ lsmod | egrep "lirc|mce|ir_|rc_core" ir_lirc_codec 13021 0 lirc_dev 19980 1 ir_lirc_codec ir_mce_kbd_decoder 13214 0 ir_sanyo_decoder 12839 0 ir_sony_decoder 12713 0 ir_jvc_decoder 12751 0 ir_rc6_decoder 12874 0 ir_rc5_decoder 12710 0 ir_nec_decoder 12915 0 rc_rc6_mce 12502 0 mceusb 21980 0 rc_core 27767 11 ir_lirc_codec,ir_rc5_decoder,ir_nec_decoder,ir_sony_decoder,mceusb, ir_mce_kbd_decoder,ir_jvc_decoder,ir_rc6_decoder,ir_sanyo_decoder,rc_rc6_mce
lirc service
# systemctl status lircd lircd.service - LIRC Infrared Signal Decoder Loaded: loaded (/usr/lib/systemd/system/lircd.service; enabled) Active: active (running) since Fri 2015-07-03 12:31:33 NZST; 3s ago Main PID: 22133 (lircd) CGroup: /system.slice/lircd.service └─22133 /usr/sbin/lircd --nodaemon --driver=devinput --device=/dev/input/by-id/usb-Philips_eHome_Infrared_Transceiver_PH00PEzs-event-if00 /etc/lirc/lircd.conf Jul 03 12:31:33 cobalt.lucidsolutions.co.nz systemd[1]: Started LIRC Infrared Signal Decoder. Jul 03 12:31:33 cobalt.lucidsolutions.co.nz lircd[22133]: lircd-0.9.1a[22133]: lircd(devinput) ready, using /var/run/lirc/lircd Jul 03 12:31:33 cobalt.lucidsolutions.co.nz lircd-0.9.1a[22133]: lircd(devinput) ready, using /var/run/lirc/lircd Jul 03 12:31:33 cobalt.lucidsolutions.co.nz lircd[22133]: lircd-0.9.1a[22133]: accepted new client on /var/run/lirc/lircd Jul 03 12:31:33 cobalt.lucidsolutions.co.nz lircd[22133]: lircd-0.9.1a[22133]: initializing '/dev/input/by-id/usb-Philips_eHome_Infrared_Transceiver_PH00PEzs-event-if00' Jul 03 12:31:33 cobalt.lucidsolutions.co.nz lircd-0.9.1a[22133]: accepted new client on /var/run/lirc/lircd Jul 03 12:31:33 cobalt.lucidsolutions.co.nz lircd-0.9.1a[22133]: initializing '/dev/input/by-id/usb-Philips_eHome_Infrared_Transceiver_PH00PEzs-event-if00'