I have an HTPC running Kodi (Formerly XMBC) and I’ve been trying to get an old IR remote working with it. I’ve got Kore on android currently controlling Kodi, but I wanted to see if I could get an old Microsoft Media Center PC’s IR receiver to work.
I used one of these receivers:
I couldn’t find the actual MCE remote that went with the receiver, so I used this Sony DVD player remote, but any remote should work.
This took entirely too long for me to figure out. The last three days have been spent with the remote working one minute and then not for seemingly no reason and then it seemed to remap the buttons out of nowhere. It was a serious pain in the ass, but it seems to be working correctly now.
Here is what I did:
First, install lirc. I am running arch, so pacman -S lirc
.
Edit /etc/lirc/lircd.conf
to:
1 2 3 |
include "usr/share/lirc/configs/devinput.conf" |
Next edit your keymap. I copied /lib/udev/rc_keymaps/rc6_mce
to /etc/rc_keymaps/rc6_mce
. You can run ir-keytable -t -p SONY,RC6 -w /etc/rc_keymaps/rc6_mce
to figure out what codes your remote is using for each button. You can then edit /etc/rc_keymaps/rc6_mce
with the correct codes that your remote is using.
Here is my rc6_mce:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
1 # table rc6_mce, type: RC6 2 3 0x1a490b KEY_ENTER 4 0x1a491b KEY_MEDIA 5 0x1a4964 KEY_MUTE 6 0x10012 KEY_VOLUMEUP 7 0x10013 KEY_VOLUMEDOWN 8 0x1a4923 KEY_FASTFORWARD 9 0x1a4922 KEY_REWIND 10 0x1a4932 KEY_PLAY 11 0x1a4939 KEY_PAUSE 12 0x1a4938 KEY_STOP 13 0x1a4931 KEY_NEXT 14 0x1a4930 KEY_PREVIOUS 15 0x1a4979 KEY_UP 16 0x1a497a KEY_DOWN 17 0x1a497b KEY_LEFT 18 0x1a497c KEY_RIGHT 19 0x1a490b KEY_OK 20 0x1a490e KEY_EXIT 21 0x1a4939 KEY_PLAYPAUSE |
Then edit the lircd unit (systemctl edit --full lircd.service
) to:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
1 [Unit] 2 Description=LIRC Daemon 3 After=network.target 4 5 [Service] 6 Type=forking 7 8 9 PIDFile=/run/lirc/lircd.pid 10 ExecStartPre=/bin/mkdir -p /run/lirc 11 ExecStartPre=/bin/rm -f /dev/lircd 12 ExecStartPre=/bin/rm -f /run/lirc/lircd 13 ExecStartPre=/bin/ln -s /run/lirc/lircd /dev/lircd 14 15 ExecStartPre=/usr/bin/ir-keytable -c 16 ExecStartPre=/usr/bin/ir-keytable -p SONY,RC6 -w /etc/rc_keymaps/rc6_mce 17 18 ExecStart=/usr/sbin/lircd 19 ExecStopPost=/bin/rm -f /dev/lircd 20 ExecStopPost=/bin/rm -fR /run/lirc 21 22 23 [Install] 24 WantedBy=multi-user.target |
You should be able to start the lircd service with no errors. The arrow keys on the remote should work just like the arrow keys on the keyboard. Hitting the up button should scroll up through the history on the command line.
I am using this remote with Kodi standalone, so I need to add a Lircmap.xml to /var/lib/kodi/.kodi/userdata/Lircmap.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
1 <lircmap> 2 <remote device="remote"> 3 <up>KEY_UP</up> 4 <down>KEY_DOWN</down> 5 <left>KEY_LEFT</left> 6 <right>KEY_RIGHT</right> 7 <play>KEY_PLAY</play> 8 <pause>KEY_PAUSE</pause> 9 <stop>KEY_STOP</stop> 10 <enter>KEY_ENTER</enter> 11 <back>KEY_BACK</back> 12 </remote> 13 </lircmap> |
This will map the remote buttons to Kodi actions.
You should be able to reboot and everything should work.
Comments closed