Remote controlling the media center is a major application of Linux Infrared Remote Control (LIRC). There are quite a number of tutorial on how to implement infrared remote control with XMBC/KODI. After following the excellent tutorial published by adafruit.com, my DVD remote control unit can do the basic stuff well. However, as you can see from the picture, it does not have a volume control button. Therefore I had to adjust the volume by the long way, which was a major irritation for me. So I need to customize the remote control to extend its functionality.
This instructable will cover the following:
Modify the existing LIRC's remote control configuration to enable volume control
This instructable will NOT show how to create a new LIRC remote control configuration
Anyone with a Raspberry Pi running Raspbmc and currently using a remote control to remote control the XBMC/KODI.
Step 1: Configure a Basic Working Remote Control
Follow the steps in adafruit's tutorial.
Step 2: Understand the Relationship Between LIRC and XBMC/KODI
LIRC represents the "hardware" remote control unit. It generates LIRC events such as button pressed events This is implemented in lircd.conf
XBMC/KODI responds to XBMC events such as play video, play music and the like. This is implemented in remote.xml.
The lircd.conf and remote.xml are implemented differently thereby making it necessary for XBMC/KODI to map remote control button pressed (LIRC) events with XBMC events. This mapping function is implemented in Lircmap.xml
The picture depicts the above relationship.
Step 3: Find XBMC/KODI Events That Increase and Decrease the Volume
Open the terminal emulator
Remote login to Raspbmc
ssh XXX.XXX.XXX.XXX -l pi
Type commands shown in the screen shot.
The volumeplus event triggers Volume Up
The volumeminus event triggers the Volume Down
Step 4: Find the Mapping Between LIRC Events and XBMC/KODI Events
The mapping is implemented in Lircmap.xml.
Find the path to the above Lircmap.xml
$sudo find / -name Lircmap.xml
In lircd.conf, the remote device name is "Toshiba XXXX". However, it may have a different name in XBMC/KODI
Find the device name of my remote control in XBMC/KODI.
Point the remote control at the XBMC's Raspberry Pi and press any one key.
Look at the output of irw command
173 0 KEY_ANGLE devinput
173 0 KEY_ANGLE_UP devinput
My remote control device name is "devinput" in XBMC/KODI. (Note: Yours might be different)
Find how XBMC/KODI maps "devinput" eventsutton's to XBMC/KODI events.
pi@raspbmc:~$ grep -i devinput -A 70 -B 2 /opt/xbmc-bcm/xbmc-bin/share/kodi/system/Lircmap.
Look at the screenshot.
XBMC /KODI maps its internal volumeplus and volumeminus to LIRC's KEY_VOLUMEUP and KEY_VOLUMEDOWN event respectively
Step 5: Modify LIRC's Event Configuration
My existing lircd.conf as shown in the screen shot does not specify KEY_VOLUMEDOWN and KEY_VOLUMEUP.
"KEY_SETUP" and "progressive" events are specified but these two do not trigger any events in XMBC/KODI. I know this because when I pressed these 2 buttons, nothing happens in XBMC/KODI. To solve my problem, I rename "KEY_SETUP" and "progressive" to "KEY_VOLUMEDOWN" and "KEY_VOLUMEUP respectively.
Make the changes.
KEY_VOLUMEDOWN 0x04FB # Was: KEY_SETUP
KEY_VOLUMEUP 0x728D # Was: progressive
Save the changes.
Reboot the XBMC/KODI
When I press the SETUP button on the remote control, XBMC decrease its volume. Pressing the "PROGRESSIVE" buttons causes XBMC/KODI to increase the volume.