Reuse Unwanted Infrared Remote Control to Use With XMMS2 Music Player
by mirza irwan osman in Circuits > Raspberry Pi
3615 Views, 29 Favorites, 0 Comments
Reuse Unwanted Infrared Remote Control to Use With XMMS2 Music Player
Introduction
It's a good idea to remote control XMMS2 media player via infrared for the same reason one does it with XBMC/KODI. I rummaged in my box of parts and found this infrared remote control of a Home Theatre DVD system which I threw away many years ago.
Scope
This instructable will show:
1. Install a LIRC client called lxmms2 whose job is to bind LIRC to XMMS2
2. Configure lxmms2 to listen for specific LIRC events and inform XMMS2 to respond accordingly
Target Reader
Anyone with a Raspberry Pi running Raspbian OS.
Install XMMS2 Music Player
Complete the steps in "Play Music on Raspberry Pi Using XMMS2" instructable. Ensure that all the steps are successfully completed.
Record and Map the Infrared Remote Control Unit With LIRC Daemon
Complete the steps in "Record Infrared Codes of Any Remote Control Unit for Usage with Linux Infrared Remote Control (LIRC) on Raspberry Pi" instructable.
Install and Deploy Lxmms2 Package
Open terminal emulator in Raspberry Pi.
Install lxmms2 package
<p>sudo apt-get update</p>sudo apt-get install lxmms2
lxmms2 program requires XMMS2 server to be running in order to start.
XMMS2 server will auto start any script that is placed in ~/.config/xmms2/startup.d directory after it finishes loading.
Write a script to start lxmms2 in the backgound.
$vim ~/start_lxmms2.sh
Place the script start_lxmms2.sh script in ~/.config/xmms2/startup.d directory
$cp ~/start_lxmms2.sh ~/.config/xmms2/startup.d/ <p>An illustration of my simple script is shown in the screenshot.</p>
Bind LIRC Events With XMMS2 Events
Open terminal emulator in Raspberry Pi.
Disable the system lircrc configuration file
$cd /etc/lirc $mv lircrc lircrc.bk
Create a .lircrc configuration file in the home directory
$vi ~/.lircrc
Enter the necessary values that binds the LIRC events (eg. KEY_PLAY) to xmms2 events (eg. play). I have a screenshot of my .lircrc for illustration.
Test
Reboot the Raspberry Pi
Point infrared remote control unit at the Raspberry Pi and press PLAY.
If nothing happens, it's time to debug.