I've recently rebuilt my MythTV box using Mythbuntu 12.04, to take advantage of newer hardware (Ivy Bridge).

On my previous build I used lirc to manage the remote, i.e. the mapping of key codes -> keypresses -> application keys; it was quite a journey to learn it all, and I ended up fairly comfortable with how it all worked.

What I have:

How it is right now
When I plug this in, it 'just works'. Which is great, except that Ubuntu uses it natively, and prevents some of the button presses from getting through to Myth. For example, I can send a button from the remote that equates to Ctrl-Alt-A (which I assume Ubuntu isn't interested in), and then trap that in Mythfrontend, but the remote's Play button is caught by Ubuntu (which displays a large circle with a line though it, as there's no media player loaded).
I understand that this is because lirc is merged into the kernel now, and I like that.

What I've done so far:

Found the device using lsusb:

$ lsusb  
Bus 001 Device 004: ID 073a:2230 Chaplet Systems, Inc. infrared dongle for remote

Found the event device number:

$ cat /proc/bus/input/devices  
I: Bus=0003 Vendor=073a Product=2230 Version=0110
N: Name="HID 073a:2230"
P: Phys=usb-0000:00:1a.0-1.2/input0
S: Sysfs=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/input/input5
U: Uniq=
H: Handlers=sysrq kbd mouse1 event5 js0 
B: EV=10001f
B: KEY=4c37fff072ff32d bf54445600000000 ffffffffff 30c100b17c007 ffa67bfad951dfff febeffdfffefffff fffffffffffffffe
B: REL=343
B: ABS=100030000
B: MSC=10

Tested the input with evtest (I pressed Play):

$ sudo evtest /dev/input/event5  
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x73a product 0x2230 version 0x110
Input device name: "HID 073a:2230"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 1 (KEY_ESC)
    Event code 2 (KEY_1)
    Event code 3 (KEY_2)
    Event code 4 (KEY_3)
    Event code 5 (KEY_4)
    Event code 6 (KEY_5)
    Event code 7 (KEY_6)
<------------snipped lots of 'Event code' lines------------>
Testing ... (interrupt to exit)
Event: time 1336435683.230656, -------------- SYN_REPORT ------------
Event: time 1336435683.246648, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00cd
Event: time 1336435683.246652, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 0
Event: time 1336435683.246655, -------------- SYN_REPORT ------------

Tested showkey, again for the Play key:

$ sudo showkey -s
kb mode was RAW
[ if you are trying this under X, it might not work
since the X server is also reading /dev/console ]

press any key (program terminates 10s after last keypress)...
0xe0 0x22 0xe0 0xa2 

What I want:

  • I'd like a way to scan the incoming button presses, if the above method isn't correct.
  • I'd like to either remap each button press to something that Ubuntu/Unity will ignore, or even better pass the keypress directly to Myth (I suspect this later is only possible with lirc, but I could be wrong).
  • I would really like to do this with the in-kernel drivers, i.e. without explicitly loading lirc; if that's the way the world is going, I'd rather find a way to map the current behaviour to what I want, rather than forcing the 'old' arrangement of loading lirc outside the kernel. Learning something new is also worthwhile!

My guess:
I'm assuming that this will require using setkeycodes, but have had trouble finding enough information to configure this.

Any help greatly appreciated!

2 Answers 2


Remote's Play button is consumed by media-keys plugin for gnome-settings-daemon. To disable it and allow MythTV receiving the event, do:

$ gsettings set org.gnome.settings-daemon.plugins.media-keys active false

Also you will want to disable/uninstall xfce4-volumed to prevent it from trapping XF86AudioLowerVolume, XF86AudioRaiseVolume and XF86AudioMute.

You may want to re-map some window manager keys too (e.g. in my case Ctrl+Alt+D is used to start Live TV, while xfwm4 uses that for show_desktop action). This can be done in "Settings > Window Manager", "Keyboard" tab.

Additionally you can enable the "Mouse" control to send keyboard events using the mythtv-mouse2kbd.py script I described in my blog post.


I've just been down a similar path of discovering the new in-kernel lirc, for me the ah ha moment was when I realized an ir remote is now just another keyboard.

As an alternative to showkey/evtest you can run sudo ir-keytable -t to detect remote button presses. Though I don't think it offers too much new information.

To adjust the mapping of remote scancodes to keys, you need create your own config file based off one from /lib/udev/rc_keymaps/.

Using the evtest output you can use KEY_X and value fields to help identify which rc_keymaps file is being used. Copy that matching file and edit to remap the keys as you desire. You can load your modified configuration with sudo ir-keytable -c -w newfile. Now you can test your new configuration with evtest.

If you can't get enough flexibility from modifying the keymaps you can still use the the userspace lirc daemon. You can configure lircd to pull from the in-kernel driver and then configure lircd as normal.

These two links, http://forum.xbmc.org/showthread.php?tid=104541 and http://ubuntuforums.org/showthread.php?t=1754719, have lots of information about how to configure and debug either setup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.