LIRC
From ArchWiki
LIRC stands for "Linux Infrared Remote Control", a program to use infrared devices (like your remote control from your TV) with linux.
This article covers using lirc with serial or USB infrared devices.
Contents |
Installation
First install lirc with pacman:
# pacman -S lirc
It's also recommended that you install the utils package:
# pacman -S lirc-utils
Serial receivers
Now there might be a problem: the module lirc_serial is build to use ttyS0 (COM1), if your device isn't connected to ttyS0, you'll have to either change the module-options or rebuild the lirc module. If your device is connected to ttyS0, you can skip this step
To change the options for the lirc_serial module, you edit /etc/modprobe.conf and add this line:
options lirc_serial io=0x2f8 irq=3
You should change the values after io and irq to reflect you serial port settings, the values above may work for you if you are using ttyS1 (COM2) to connect your IR-device. But you will find the correct values by checking dmesg:
$ dmesg | grep ttyS
Building the lirc_serial module for another ttySx
Update abs
# abs
Copy the lirc files to a directory you choose yourself:
$ cp /var/abs/extra/system/lirc /some/dir
$ cd /some/dir
Edit the PKGBUILD in that directory.
Replace the line:
./configure --enable-sandboxed --prefix=/usr \
--with-driver=all \\
return 1[/code]
with:
./configure --enable-sandboxed --prefix=/usr \
--with-driver=com2 \
|| return 1[/code]
Where you replace com2 with the com-port you need.
Build and install the package:
$ makepkg # pacman -U lirc-version.pkg.tar.gz
Loading
Now try to load the serial module:
# modprobe lirc_serial
If this produces an error which says your serial port is not ready, you have the problem that your serial port support is build into the kernel and not as a module (in the default arch kernel it is build into the kernel)
If it's build into the kernel you'll have to do the following (remember that it is build into the kernel, you will need to make some changes later too)
You'll have to release the serial port:
# setserial /dev/ttySx uart none
(Replace x with your port number)
Load the module again:
# modprobe lirc_serial
Now it shouldn't show any errors, and the modules lirc_serial should be listed in lsmod
USB devices
Newer devices may be using the mceusb2 module you should change mceusb2 to mceusb if you are using the old version of the remote. To manually load the USB receiver:
# modprobe lirc_mceusb2
then load lirc
$ lirc
Test it with irw. irw will output the commands received by the IR receiver that match your lircd.conf file. So start irw, point your remote and start pressing buttons.
# irw 000000037ff07bfe 00 One mceusb 000000037ff07bfd 00 Two mceusb 000000037ff07bfd 01 Two mceusb 000000037ff07bf2 00 Home mceusb 000000037ff07bf2 01 Home mceusb
The above procedure however has been simplified and probably won't work that easily. If you get errors in the above try the following:
One of the reasons the lircd daemon may not be working is because it expects to be run at startup and needs root permissions because it will create device nodes in /dev. Try "man lircd" for more information.
To run lircd at startup, add it to the DAEMONS line in /etc/rc.conf. eg:
DAEMONS=(syslog-ng network netfs crond lircd)
Also, if needed add your receivers kernel module to the MODLUES line of /etc/rc.conf eg (for the MCE Remote control):
MODULES=(lirc-mceusb2)
Next, you need to put your remotes .config file into /etc/lirc.config. These files can be found either in your directory /usr/share/lirc/remotes/ or you may be able to find them here http://lirc.sourceforge.net/remotes/
If you're copying it locally here's an example of what you would do for the mceusb remote
# cp /usr/share/lirc/remotes/mceusb/lircd.conf.mceusb /etc/lircd.conf
upon rebooting the remote should work. Test it with irw. irw will output the commands received by the IR receiver that match your lircd.conf file. So start irw, point your remote and start pressing buttons
# irw 000000037ff07bfe 00 One mceusb 000000037ff07bfd 00 Two mceusb 000000037ff07bfd 01 Two mceusb 000000037ff07bf2 00 Home mceusb 000000037ff07bf2 01 Home mceusb
Setup a HID device with lirc
For lirc version 0.8.5 and previous
Nowadays there are some cheap HID devices on the market. They are looks like a MCE USB remote, but they aren't.If you plug those devices into you computer, system will automatically recognize them as USB keyboard, it can be used even without lirc. Every button on the device is recognize as a key or a combination of some keys. If you want to get a more customized setting, here is the solution:
Because the HID remote actually simulates a USB infrared Keyboard and an mouse, there are two devices, so you need to create two lirc daemon instead just one in default setting.
Fisrt we need the find out our HID device in /proc/bus/input/device:
$ cat /proc/bus/input/device
You should find some info like this "Name="HID xxxx:xxxx", here first "xxxx" is the id of the vendor, second one is product id.For example, in my case it's
Name="HID 3353:3713"
Remember it,those info is import, we will use them late.
then go to /dev/input/by-id
$ ls -l /dev/input/by-id
You shold find two files named with vendor id and product id, in my case
lrwxrwxrwx 1 root root 9 10月 14 06:43 usb-3353_3713-event-if00 -> ../event9 lrwxrwxrwx 1 root root 10 10月 14 06:43 usb-3353_3713-event-if01 -> ../event10
Here 'usb-3353_3713-event-if00' and 'usb-3353_3713-event-if01' are the Linux input device event for our HID device, one for the keyboard, another for the mouse.
Then, we need to edit /etc/conf.d/lircd,this file contains the parameters for lirc daemon
# #Parameters for daemon # PIDFILE0="/var/run/lircd0.pid" PIDFILE1="/var/run/lircd1.pid" LIRC_DEVICE0="/dev/input/by-id/usb-3353_3713-event-if00" LIRC_DEVICE1="/dev/input/by-id/usb-3353_3713-event-if01" LIRC_DRIVER="devinput" LIRC_EXTRAPTS="" LIRC_CONFIGFILE="/etc/lircd.conf"
At the last line we set up the lirc config file, there is a exists lirc configuration file for HID remote. Simply save it as /etc/lircd.conf.
begin remote
name linux-input-layer
gap 199979
bits 32
begin codes
ESC 0x10001
1 0x10002
2 0x10003
3 0x10004
4 0x10005
5 0x10006
6 0x10007
7 0x10008
8 0x10009
9 0x1000a
0 0x1000b
MINUS 0x1000c
EQUAL 0x1000d
BACKSPACE 0x1000e
TAB 0x1000f
Q 0x10010
W 0x10011
E 0x10012
R 0x10013
T 0x10014
Y 0x10015
U 0x10016
I 0x10017
O 0x10018
P 0x10019
LEFTBRACE 0x1001a
RIGHTBRACE 0x1001b
ENTER 0x1001c
LEFTCTRL 0x1001d
A 0x1001e
S 0x1001f
D 0x10020
F 0x10021
G 0x10022
H 0x10023
J 0x10024
K 0x10025
L 0x10026
SEMICOLON 0x10027
APOSTROPHE 0x10028
GRAVE 0x10029
LEFTSHIFT 0x1002a
BACKSLASH 0x1002b
Z 0x1002c
X 0x1002d
C 0x1002e
V 0x1002f
B 0x10030
N 0x10031
M 0x10032
COMMA 0x10033
DOT 0x10034
SLASH 0x10035
RIGHTSHIFT 0x10036
KPASTERISK 0x10037
LEFTALT 0x10038
SPACE 0x10039
CAPSLOCK 0x1003a
F1 0x1003b
F2 0x1003c
F3 0x1003d
F4 0x1003e
F5 0x1003f
F6 0x10040
F7 0x10041
F8 0x10042
F9 0x10043
F10 0x10044
NUMLOCK 0x10045
SCROLLLOCK 0x10046
KP7 0x10047
KP8 0x10048
KP9 0x10049
KPMINUS 0x1004a
KP4 0x1004b
KP5 0x1004c
KP6 0x1004d
KPPLUS 0x1004e
KP1 0x1004f
KP2 0x10050
KP3 0x10051
KP0 0x10052
KPDOT 0x10053
103RD 0x10054
F13 0x10055
102ND 0x10056
F11 0x10057
F12 0x10058
F14 0x10059
F15 0x1005a
F16 0x1005b
F17 0x1005c
F18 0x1005d
F19 0x1005e
F20 0x1005f
KPENTER 0x10060
RIGHTCTRL 0x10061
KPSLASH 0x10062
SYSRQ 0x10063
RIGHTALT 0x10064
LINEFEED 0x10065
HOME 0x10066
UP 0x10067
PAGEUP 0x10068
LEFT 0x10069
RIGHT 0x1006a
END 0x1006b
DOWN 0x1006c
PAGEDOWN 0x1006d
INSERT 0x1006e
DELETE 0x1006f
MACRO 0x10070
MUTE 0x10071
VOLUMEDOWN 0x10072
VOLUMEUP 0x10073
POWER 0x10074
KPEQUAL 0x10075
KPPLUSMINUS 0x10076
PAUSE 0x10077
F21 0x10078
F22 0x10079
F23 0x1007a
F24 0x1007b
KPCOMMA 0x1007c
LEFTMETA 0x1007d
RIGHTMETA 0x1007e
COMPOSE 0x1007f
STOP 0x10080
AGAIN 0x10081
PROPS 0x10082
UNDO 0x10083
FRONT 0x10084
COPY 0x10085
OPEN 0x10086
PASTE 0x10087
FIND 0x10088
CUT 0x10089
HELP 0x1008a
MENU 0x1008b
CALC 0x1008c
SETUP 0x1008d
SLEEP 0x1008e
WAKEUP 0x1008f
FILE 0x10090
SENDFILE 0x10091
DELETEFILE 0x10092
XFER 0x10093
PROG1 0x10094
PROG2 0x10095
WWW 0x10096
MSDOS 0x10097
COFFEE 0x10098
DIRECTION 0x10099
CYCLEWINDOWS 0x1009a
MAIL 0x1009b
BOOKMARKS 0x1009c
COMPUTER 0x1009d
BACK 0x1009e
FORWARD 0x1009f
CLOSECD 0x100a0
EJECTCD 0x100a1
EJECTCLOSECD 0x100a2
NEXTSONG 0x100a3
PLAYPAUSE 0x100a4
PREVIOUSSONG 0x100a5
STOPCD 0x100a6
RECORD 0x100a7
REWIND 0x100a8
PHONE 0x100a9
ISO 0x100aa
CONFIG 0x100ab
HOMEPAGE 0x100ac
REFRESH 0x100ad
EXIT 0x100ae
MOVE 0x100af
EDIT 0x100b0
SCROLLUP 0x100b1
SCROLLDOWN 0x100b2
KPLEFTPAREN 0x100b3
KPRIGHTPAREN 0x100b4
INTL1 0x100b5
INTL2 0x100b6
INTL3 0x100b7
INTL4 0x100b8
INTL5 0x100b9
INTL6 0x100ba
INTL7 0x100bb
INTL8 0x100bc
INTL9 0x100bd
LANG1 0x100be
LANG2 0x100bf
LANG3 0x100c0
LANG4 0x100c1
LANG5 0x100c2
LANG6 0x100c3
LANG7 0x100c4
LANG8 0x100c5
LANG9 0x100c6
PLAYCD 0x100c8
PAUSECD 0x100c9
PROG3 0x100ca
PROG4 0x100cb
SUSPEND 0x100cd
CLOSE 0x100ce
PLAY 0x100cf
FASTFORWARD 0x100d0
BASSBOOST 0x100d1
PRINT 0x100d2
HP 0x100d3
CAMERA 0x100d4
SOUND 0x100d5
QUESTION 0x100d6
EMAIL 0x100d7
CHAT 0x100d8
SEARCH 0x100d9
CONNECT 0x100da
FINANCE 0x100db
SPORT 0x100dc
SHOP 0x100dd
ALTERASE 0x100de
CANCEL 0x100df
BRIGHTNESSDOWN 0x100e0
BRIGHTNESSUP 0x100e1
MEDIA 0x100e2
UNKNOWN 0x100f0
BTN_MISC 0x10100
BTN_0 0x10100
BTN_1 0x10101
BTN_2 0x10102
BTN_3 0x10103
BTN_4 0x10104
BTN_5 0x10105
BTN_6 0x10106
BTN_7 0x10107
BTN_8 0x10108
BTN_9 0x10109
BTN_MOUSE 0x10110
BTN_LEFT 0x10110
BTN_RIGHT 0x10111
BTN_MIDDLE 0x10112
BTN_SIDE 0x10113
BTN_EXTRA 0x10114
BTN_FORWARD 0x10115
BTN_BACK 0x10116
BTN_TASK 0x10117
BTN_JOYSTICK 0x10120
BTN_TRIGGER 0x10120
BTN_THUMB 0x10121
BTN_THUMB2 0x10122
BTN_TOP 0x10123
BTN_TOP2 0x10124
BTN_PINKIE 0x10125
BTN_BASE 0x10126
BTN_BASE2 0x10127
BTN_BASE3 0x10128
BTN_BASE4 0x10129
BTN_BASE5 0x1012a
BTN_BASE6 0x1012b
BTN_DEAD 0x1012f
BTN_GAMEPAD 0x10130
BTN_A 0x10130
BTN_B 0x10131
BTN_C 0x10132
BTN_X 0x10133
BTN_Y 0x10134
BTN_Z 0x10135
BTN_TL 0x10136
BTN_TR 0x10137
BTN_TL2 0x10138
BTN_TR2 0x10139
BTN_SELECT 0x1013a
BTN_START 0x1013b
BTN_MODE 0x1013c
BTN_THUMBL 0x1013d
BTN_THUMBR 0x1013e
BTN_DIGI 0x10140
BTN_TOOL_PEN 0x10140
BTN_TOOL_RUBBER 0x10141
BTN_TOOL_BRUSH 0x10142
BTN_TOOL_PENCIL 0x10143
BTN_TOOL_AIRBRUSH 0x10144
BTN_TOOL_FINGER 0x10145
BTN_TOOL_MOUSE 0x10146
BTN_TOOL_LENS 0x10147
BTN_TOUCH 0x1014a
BTN_STYLUS 0x1014b
BTN_STYLUS2 0x1014c
BTN_WHEEL 0x10150
BTN_GEAR_DOWN 0x10150
BTN_GEAR_UP 0x10151
OK 0x10160
SELECT 0x10161
GOTO 0x10162
CLEAR 0x10163
POWER2 0x10164
OPTION 0x10165
INFO 0x10166
TIME 0x10167
VENDOR 0x10168
ARCHIVE 0x10169
PROGRAM 0x1016a
CHANNEL 0x1016b
FAVORITES 0x1016c
EPG 0x1016d
PVR 0x1016e
MHP 0x1016f
LANGUAGE 0x10170
TITLE 0x10171
SUBTITLE 0x10172
ANGLE 0x10173
ZOOM 0x10174
MODE 0x10175
KEYBOARD 0x10176
SCREEN 0x10177
PC 0x10178
TV 0x10179
TV2 0x1017a
VCR 0x1017b
VCR2 0x1017c
SAT 0x1017d
SAT2 0x1017e
CD 0x1017f
TAPE 0x10180
RADIO 0x10181
TUNER 0x10182
PLAYER 0x10183
TEXT 0x10184
DVD 0x10185
AUX 0x10186
MP3 0x10187
AUDIO 0x10188
VIDEO 0x10189
DIRECTORY 0x1018a
LIST 0x1018b
MEMO 0x1018c
CALENDAR 0x1018d
RED 0x1018e
GREEN 0x1018f
YELLOW 0x10190
BLUE 0x10191
CHANNELUP 0x10192
CHANNELDOWN 0x10193
FIRST 0x10194
LAST 0x10195
AB 0x10196
NEXT 0x10197
RESTART 0x10198
SLOW 0x10199
SHUFFLE 0x1019a
BREAK 0x1019b
PREVIOUS 0x1019c
DIGITS 0x1019d
TEEN 0x1019e
TWEN 0x1019f
DEL_EOL 0x101c0
DEL_EOS 0x101c1
INS_LINE 0x101c2
DEL_LINE 0x101c3
end codes
end remote
At last, we need to edit our lirc daemon script:
# vim /etc/rc.d/lircd
Here is what it looks like after the edit.
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/lircd
PID=$(pidof -o %PPID /usr/sbin/lircd)
case "$1" in
start)
stat_busy "Starting LIRC Daemon"
[ -n "$LIRC_DRIVER" ] && LIRC_EXTRAOPTS="-H $LIRC_DRIVER $LIRC_EXTRAOPTS"
[ -z "$PID" ] &&
if [ -n "$LIRC_DEVICE0" ] && [ -n "$LIRC_DEVICE1" ] ; then
/usr/sbin/lircd -d "$LIRC_DEVICE0" $LIRC_EXTRAOPTS $LIRC_CONFIGFILE --pidfile=$PIDFILE0 --output=/dev/lircd0 --listen
/usr/sbin/lircd -d "$LIRC_DEVICE1" $LIRC_EXTRAOPTS $LIRC_CONFIGFILE --pidfile=$PIDFILE1 --output=/dev/lircd --connect=localhost:8765
else
/usr/sbin/lircd $LIRC_EXTRAOPTS $LIRC_CONFIGFILE --pidfile=$PIDFILE0 --output=/dev/lircd0 --listen
/usr/sbin/lircd $LIRC_EXTRAOPTS $LIRC_CONFIGFILE --pidfile=$PIDFILE1 --output=/dev/lircd --connect=localhost:8765
fi
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon lircd
stat_done
fi
;;
stop)
stat_busy "Stopping LIRC Daemon"
[ ! -z "$PID" ] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon lircd
stat_done
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0
In order to launch the lirc daemon for HID remote, You must enable evdev module first
# modprobe evdev
Then you can launch the lric daemon.
# /etc/rc.d/lircd start
You can test the setting with irw command
$ irw
You should see something like this on you screen when you click the remote button.
0000000000010067 00 UP linux-input-layer 000000000001006c 00 DOWN linux-input-layer 0000000000010069 00 LEFT linux-input-layer 000000000001006a 00 RIGHT linux-input-layer 000000000001001c 00 ENTER linux-input-layer 000000000001009e 00 BACK linux-input-layer 000000000001000f 00 TAB linux-input-layer
If you like start lirc daemon at the boot ,simply put evden and lircd to your /etc/rc.conf
MODULES=(... evdev ...) DAEMONS=(... lircd ...)
For Lirc version 0.8.6 and above
According the changes in Lirc version 0.8.6, we need do some tiny change in order to make HID works with latest verson of lirc.
1. Changes in config files
The content of these config file do not need to do any change, so you can still use the example in lirc 0.8.5. The only thing you need to do is change where the file shoud to be put at. The config file that contains the parameters for /etc/rc.d/lircd has been move from /etc/conf.d/(in lirc 0.8.5) to /etc/lirc/lircd.conf. The config file of HID device itself remains the same postion with old version, ie, /etc/licd.conf
2. Changes in /etc/rc.d/lircd
Though of lirc 0.8.6 had changed the default socket from /dev/lircd to /var/run/lirc/lircd, but most applications still recognize the old socket. So I strongly recommend that you should make a soft link with the name '/etc/rc.d/lircd', like this:
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
. /etc/lirc/lircd.conf
PID=$(pidof -o %PPID /usr/sbin/lircd)
case "$1" in
start)
stat_busy "Starting LIRC Daemon"
[ -n "$LIRC_DRIVER" ] && LIRC_EXTRAOPTS="-H $LIRC_DRIVER $LIRC_EXTRAOPTS"
[ -z "$PID" ] &&
if [ -n "$LIRC_DEVICE0" ] && [ -n "$LIRC_DEVICE1" ] ; then
/usr/sbin/lircd -d "$LIRC_DEVICE0" $LIRC_EXTRAOPTS $LIRC_CONFIGFILE --pidfile=/var/run/lirc/lircd0.pid --output=/var/run/lirc/lircd0 --listen
/usr/sbin/lircd -d "$LIRC_DEVICE1" $LIRC_EXTRAOPTS $LIRC_CONFIGFILE --pidfile=/var/run/lirc/lircd.pid --output=/var/run/lirc/lircd --connect=localhost:8765
ln -s /var/run/lirc/lircd /dev/lircd
else
/usr/sbin/lircd $LIRC_EXTRAOPTS $LIRC_CONFIGFILE --pidfile=/var/run/lirc/lircd0.pid --output=/var/run/lirc/lircd0 --listen
/usr/sbin/lircd $LIRC_EXTRAOPTS $LIRC_CONFIGFILE --pidfile=/var/run/lirc/lircd.pid --output=/var/run/lirc/lircd --connect=localhost:8765
ln -s /var/run/lirc/lircd /dev/lircd
fi
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon lircd
stat_done
fi
;;
stop)
stat_busy "Stopping LIRC Daemon"
[ ! -z "$PID" ] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon lircd
stat_done
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0
You can file all these codes in my github page
Using a X10
Making a configuration file
You'll need a configuration file for your remote control. The easiest way is to look on the lirc site and hope your device has already a config file: list of remotes on the lirc site
If so, download your file and save it as /etc/lircd.conf
If your device doesn't have already a config file, you'll have to create the file yourself with the command:
# irrecord -d /dev/lirc0 /tmp/my_remote
Just follow the instructions. The resulting file, /tmp/my_remote, should then be copied to /etc/lircd.conf. If you want to use several remotes, you repeat the irrecord step with each remote and different filenames, and then concatenate all the resulting files into /etc/lircd.conf:
# cat /tmp/my_remote /tmp/my_remote2 /tmp/my_remote3 >/etc/lircd.conf
Testing
First start the lircd daemon:
# /etc/rc.d/lircd start
A good way to see if lirc is running is to run irw.
$ irw
When you press a button, you should get something like this:
0000000000000001 00 play sony2 0000000000000001 01 play sony2 0000000000000001 02 play sony2 0000000000000001 03 play sony2
In this case my remote is called sony2, the button is called play, and lirc has seen it 4 times.
Run lirc at bootup
Remember if you had to execute the setserial command while loading the module?
If so, your serial port support is compiled into the kernel
Your serial port support is compiled as a module in the kernel
This is rather easy: you'll just have to add lirc_serial to the modules list and lircd to the daemons list in /etc/rc.conf
Your serial port support is compiled into the kernel
This is more complicated, you can't just add the lirc_serial to the modules list in /etc/rc.conf, as the serial port should be released first.
So I created a custom startup script to fix this problem.
In /etc/rc.d/start_lirc:
#!/bin/bash
#/etc/rc.d/start_lirc
#releases ttySx and loads lirc_serial module
. /etc/rc.conf
. /etc/rc.d/functions
case "$1" in
start)
stat_busy "release ttySx"
setserial /dev/ttySx uart none
#load lirc module
modprobe lirc_serial
stat_done
;;
stop)
stat_busy "unload lirc module"
rmmod lirc_serial
stat_done
;;
restart)
$0 stop
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0
Now load the daemons: add "start_lirc" and "lircd" to the daemons list in /etc/rc.conf
Program specific
Enable lirc support in xine
Now lirc works, but you have no program that can communicate with lirc. This section will explain how to make xine work, but you can use xmms and mplayer (and probably a lot of other programs too) to work with lirc.
Compile xine with lirc support
Download the xine-ui pkgbuild from the cvs tree.
Add " --enable-lirc" to the "./configure" line
Compile:
$ makepkg
Uninstall old xine-ui and install the new one
# pacman -R xine-ui # pacman -U xine-filename.pkg.tar.gz
Configure xine to use lirc
Let xine produce a default .lircrc file. In your home directory, type:
$ xine --keymap=lirc>.lircrc
Now, in order to have a functioning xine+lirc, edit the .lircrc file to your preferences.
However, you may choose to configure lirc to control more than just xine. If this is the case, you will need to manually edit the .lircrc file, and add elements.
Xine-ui Mplayer Totem Vlc Rhythmbox
All work with lirc, but you must enable lirc support in the program in some cases, such as VLC. Simply copy the vlc packagebuild and edit it so that "--enable-lirc" is one of the compile options for VLC not FFMPEG!
Configure Amarok2 to use Lirc
Depending on your controller model, the following configuration works with Amarok2-svn. This configuration file will work with the MCEUSB controller.
##amarok2 begin button = Play prog = irexec repeat = 0 config = qdbus org.mpris.amarok /Player Play end begin button = Pause prog = irexec repeat = 0 config = qdbus org.mpris.amarok /Player Pause end begin button = Stop prog = irexec repeat = 0 config = qdbus org.mpris.amarok /Player Stop end begin button = Skip prog = irexec repeat = 0 config = qdbus org.mpris.amarok /Player Next end begin button = Replay prog = irexec repeat = 0 config = qdbus org.mpris.amarok /Player Prev end
Configure Audacious(2) to use Lirc
Depending on your controller model, the following configuration works with all versions of Audacious, including the mercurial builds. This configuration file will work with the MCEUSB controller.
##audacious
begin
prog = audacious
button = Play
config = PLAY
repeat = 0
end
begin
prog = audacious
button = Pause
config = PAUSE
repeat = 0
end
begin
prog = audacious
button = Stop
config = STOP
repeat = 0
end
begin
prog = audacious
button = Skip
config = NEXT
repeat = 0
end
begin
prog = audacious
button = Replay
config = PREV
repeat = 0
end
begin
prog = audacious
button = VolUp
config = VOL_UP
repeat = 1
end
begin
prog = audacious
button = VolDown
config = VOL_DOWN
repeat = 1
end
Additionally, there are other values that may be set according to the model set forth above. This was taken from the lirc.c file from audacious-plugins source code:
PLAY STOP PAUSE PLAYPAUSE NEXT PREV SHUFFLE REPEAT FWD BWD VOL_UP VOL_DOWN QUIT MUTE BAL_LEFT BAL_RIGHT BAL_CENTER LIST PLAYLIST_CLEAR PLAYLIST_ADD
Specific Examples
Streamzap PC Remote (USB)
- Install both packages (lirc lirc-utils)
- Modprobe both kernel mods (lirc_dev and lirc_streamzap) (add these to your MODULES array in /etc/rc.conf to survive a reboot)
- Create your /etc/lirc/lircd.conf (for this remote, copy /usr/share/lirc/remotes/streamzap/lircd.conf.streamzap to /etc/lirc/lircd.conf)
- Start lircd via /etc/rc.d/lircd start (add lircd to your DAEMONS array in /etc/rc.conf to survive a reboot)
- Test the remote/lirc with irw
$ irw 00000000000028cc 00 CH_UP Streamzap_PC_Remote 00000000000028ce 00 CH_DOWN Streamzap_PC_Remote 00000000000028c8 00 8 Streamzap_PC_Remote 00000000000028c5 00 5 Streamzap_PC_Remote 00000000000028d2 00 OK Streamzap_PC_Remote 00000000000028d1 00 LEFT Streamzap_PC_Remote 00000000000028d1 01 LEFT Streamzap_PC_Remote 00000000000028d1 00 LEFT Streamzap_PC_Remote 00000000000028d3 00 RIGHT Streamzap_PC_Remote 00000000000028d3 00 RIGHT Streamzap_PC_Remote 00000000000028d3 00 RIGHT Streamzap_PC_Remote 00000000000028d3 00 RIGHT Streamzap_PC_Remote 00000000000028d4 00 DOWN Streamzap_PC_Remote 00000000000028d4 00 DOWN Streamzap_PC_Remote 00000000000028d4 00 DOWN Streamzap_PC_Remote
External Resources
http://www.mythtv.org/wiki/Category:Remote_Controls -- MythTV wiki main LIRC article
http://www.mythtv.org/wiki/MCE_Remote -- MythTV wiki on MCE remotes
http://en.gentoo-wiki.com/wiki/LIRC -- Gentoo wiki LIRC how-to