How to add new custom remote control buttons?
#1
Hello

I am using Ubuntu 12.10 minimal / XBMC 12.1 with a IMON IR receiver that is inside my OrigenAE M10 HTPC case.

I am not using LIRC (As when that was installed I had issues with double commands / presses being sent to XBMC)

I am using IR-KEYTABLE and the inbuilt kernel modules for IR.

I am using a Harmony 895 universal remote control setup as a MCE remote.

I have all the basic MCE buttons working just fine following this guide here

My question is how do I add additional custom buttons ?

For example I wanted a button to bring up the Codec Info - Keyboard shortcut O

I have gotten this working by using an existing MCE remote button that was not in use (The Red button).

This is my /etc/rc_keymaps/imon_mce file

Code:
# table imon_mce, type: RC6
0x800ff415 KEY_R        #Rewind
0x800ff414 KEY_F        #FastForward
0x800ff41b KEY_F2        #Previous button
0x800ff41a KEY_F1        #Next button
0x800ff416 KEY_PLAY        #Play
0x800ff418 KEY_PLAYPAUSE    #Pause
0x800ff419 KEY_X        #Stop
0x800ff417 KEY_RECORD        #Record
0x02000052 KEY_UP        #Up Direction
0x02000051 KEY_DOWN        #Down Direction
0x0200004f KEY_RIGHT        #Right Direction
0x02000050 KEY_LEFT        #Left Direction
0x02000028 KEY_ENTER        #OK/Enter
0x0200002a KEY_BACK        #Back/Exit
0x02000029 KEY_BACKSPACE    #Delete button - Backspace
0x800ff40e KEY_MUTE        #Mute
0x800ff410 KEY_VOLUMEUP        #Volume Up
0x800ff411 KEY_VOLUMEDOWN    #Volume Down
0x800ff412 KEY_PAGEUP        #ChannelUp button - PageUp
0x800ff413 KEY_PAGEDOWN        #ChannelDown button - PageDown
0x0200001e KEY_1        #Numeric_1 button
0x0200001f KEY_2        #Numeric_2 button
0x02000020 KEY_3        #Numeric_3 button
0x02000021 KEY_4        #Numeric_4 button
0x02000022 KEY_5        #Numeric_5 button
0x02000023 KEY_6        #Numeric_6 button
0x02000024 KEY_7        #Numeric_7 button
0x02000025 KEY_8        #Numeric_8 button
0x02000026 KEY_9        #Numeric_9 button
0x02000027 KEY_0        #Numeric_0 button
0x02200025 KEY_NUMERIC_STAR    #* button    
0x02200020 KEY_NUMERIC_POUND    ## button
0x800ff446 KEY_TV        #Unknown button on remote control handset
0x800ff447 KEY_F3        #AUDIO button - F3 - XBMC Music
0x800ff448 KEY_PVR        #Not Working Record TV button
0x800ff449 KEY_F4        #CAMERA button - F4 XBMC Pictures
0x800ff44a KEY_F5        #VIDEO button - F5 XBMC Videos
0x800ff424 KEY_F6        #DVD button - F6 ShowVideoMenu
0x800ff425 KEY_TUNER        #Not Working Live TV button
0x800ff450 KEY_RADIO        #Not Working Radio button
0x800ff44c KEY_LANGUAGE        #Unknown button on remote control handset
0x800ff427 KEY_ZOOM        #Unknown button on remote control handset
0x800ff45b KEY_O        #Red button - O Diagnostic Codec Info
0x800ff45c KEY_GREEN        #Green button
0x800ff45d KEY_YELLOW        #Yellow button
0x800ff45e KEY_BLUE        #Blue button
0x800ff40f KEY_I        #Info button - Information
0x800ff426 KEY_C        #EPG/Guide button - Context Menu
0x800ff45a KEY_T        #Subtitle button - Toggle Subtitles (Teletext Button in Harmony)
0x800ff44d KEY_TITLE        #Not Assigned
0x800ff40c KEY_SUSPEND        #Power button - XBMC Shutdown function
0x800ff40d KEY_ESC        #MCE Green button - Home

I changed KEY_RED to be KEY_O instead

0x800ff45b KEY_O #Red button - O Diagnostic Codec Info

I did not need to edit the Keyboard.xml file as there is already a line in there that says:

<o>CodecInfo</o>

This works now when I press the Red button whilst a movie is playing the Codec Info is shown on screen.

However my real question is this, how can you add new custom buttons without using existing MCE buttons / hex codes ?

I initially tried to teach my Harmony remote the actual keyboard key of: O using a IR MCE keyboard. But when I pressed this new custom button nothing in ir-keytable -t is detected.

Also I cannot seem to get the discrete PowerOn / PowerOff commands working only PowerToggle.

Thanks
Reply
#2
When I run ir-keytable -t and press the discrete PowerOn button on the Harmony remote it returns:

1367237866.629620: event MSC: scancode = 800ff429
1367237866.629620: event sync

I thought I could then edit the imon_mce keymap file and add my own new custom key ? So I added the following line:

0x800ff429 KEY_POWERON #Discrete PowerOn

I then reloaded the keymap and ran ir-keytable -t again and pressed PowerOn button on the Harmony again, expecting it now to say KEY_POWERON but it does not and still just looks like this:

Code:
1367238174.179852: event MSC: scancode = 800ff429
1367238174.179852: event sync
1367238174.547852: event MSC: scancode = 800ff429
1367238174.547852: event sync
1367238174.659850: event MSC: scancode = 800ff429

Is it possible to add new scan codes / keys in to the imon_mce keymap file ?

If I press a standard MCE button whilst ir-keytable -t is running is outputs something like:

Code:
1367238176.003819: event key down: KEY_ESC (0x0001)
1367238176.003819: event sync
1367238176.106847: event key up: KEY_ESC (0x0001)
1367238176.106847: event sync
1367238176.107842: event MSC: scancode = 800ff40d
1367238176.107842: event key down: KEY_ESC (0x0001)
1367238176.107842: event sync
1367238176.359745: event key up: KEY_ESC (0x0001)
1367238176.359745: event sync

800ff40d is the scancode that is in the imon_mce keymap file, but where does 0x0001 come from?


Thanks
Reply
#3
This is the original un-modified imon_mce keymap file from the /lib/udev/rc_keymaps/ folder.

There are 77 predefined scancodes / keys, which it seems I cannot add my own new custom codes / keys in to this file?

If that is the case, then I am limited in the number of custom buttons I can add, using the existing predefined scancodes that are not being used, like Red button etc.

Can anyone shed more light on how this is meant to work?

Code:
# table imon_mce, type: RC6
0x800ff415 KEY_REWIND
0x800ff414 KEY_FASTFORWARD
0x800ff41b KEY_PREVIOUS
0x800ff41a KEY_NEXT
0x800ff416 KEY_PLAY
0x800ff418 KEY_PAUSE
0x800ff419 KEY_STOP
0x800ff417 KEY_RECORD
0x02000052 KEY_UP
0x02000051 KEY_DOWN
0x0200004f KEY_RIGHT
0x02000050 KEY_LEFT
0x800ff41e KEY_UP
0x800ff41f KEY_DOWN
0x800ff420 KEY_LEFT
0x800ff421 KEY_RIGHT
0x800ff40b KEY_ENTER
0x02000028 KEY_ENTER
0x02000028 KEY_OK
0x800ff422 KEY_OK
0x0200002a KEY_EXIT
0x800ff423 KEY_EXIT
0x02000029 KEY_DELETE
0x800ff40a KEY_DELETE
0x800ff40e KEY_MUTE
0x800ff410 KEY_VOLUMEUP
0x800ff411 KEY_VOLUMEDOWN
0x800ff412 KEY_CHANNELUP
0x800ff413 KEY_CHANNELDOWN
0x0200001e KEY_NUMERIC_1
0x0200001f KEY_NUMERIC_2
0x02000020 KEY_NUMERIC_3
0x02000021 KEY_NUMERIC_4
0x02000022 KEY_NUMERIC_5
0x02000023 KEY_NUMERIC_6
0x02000024 KEY_NUMERIC_7
0x02000025 KEY_NUMERIC_8
0x02000026 KEY_NUMERIC_9
0x02000027 KEY_NUMERIC_0
0x800ff401 KEY_NUMERIC_1
0x800ff402 KEY_NUMERIC_2
0x800ff403 KEY_NUMERIC_3
0x800ff404 KEY_NUMERIC_4
0x800ff405 KEY_NUMERIC_5
0x800ff406 KEY_NUMERIC_6
0x800ff407 KEY_NUMERIC_7
0x800ff408 KEY_NUMERIC_8
0x800ff409 KEY_NUMERIC_9
0x800ff400 KEY_NUMERIC_0
0x02200025 KEY_NUMERIC_STAR
0x02200020 KEY_NUMERIC_POUND
0x800ff41d KEY_NUMERIC_STAR
0x800ff41c KEY_NUMERIC_POUND
0x800ff446 KEY_TV
0x800ff447 KEY_AUDIO
0x800ff448 KEY_PVR
0x800ff449 KEY_CAMERA
0x800ff44a KEY_VIDEO
0x800ff424 KEY_DVD
0x800ff425 KEY_TUNER
0x800ff450 KEY_RADIO
0x800ff44c KEY_LANGUAGE
0x800ff427 KEY_ZOOM
0x800ff45b KEY_RED
0x800ff45c KEY_GREEN
0x800ff45d KEY_YELLOW
0x800ff45e KEY_BLUE
0x800ff466 KEY_RED
0x800ff425 KEY_GREEN
0x800ff468 KEY_YELLOW
0x800ff41d KEY_BLUE
0x800ff40f KEY_INFO
0x800ff426 KEY_EPG
0x800ff45a KEY_SUBTITLE
0x800ff44d KEY_TITLE
0x800ff40c KEY_POWER
0x800ff40d KEY_MEDIA

Thanks
Reply
#4
(2013-04-29, 14:21)cw-kid Wrote: 800ff40d is the scancode that is in the imon_mce keymap file, but where does 0x0001 come from?

I found where the other values such as 0x0001 come from:-

http://tomoyo.sourceforge.jp/cgi-bin/lxr...put.h#L550

For example from ir-keytable -t:

1367251776.107384: event MSC: scancode = 200002a
1367251776.107384: event key down: KEY_BACK (0x009e)
1367251776.107384: event sync

From the Tomoyo page on Sourceforge:

371 #define KEY_BACK 158 /* AC Back */

158 in DEC is 0x009e HEX

But still no closer though to adding new custom commands.

So presumably I can add in any Keyname from the list on the Tomoyo page in to the imon_mce keymap file? I have tried this for KEY_POWER2 and I assigned the scancode: 0x800f042a which is the discrete PowerOff on the Harmony.

Now when I run ir-keytable -t and press the PowerOff button it looks like this:

Code:
1367251579.909691: event MSC: scancode = 800ff42a
1367251579.909691: event key down: KEY_POWER2 (0x0164)
1367251579.909691: event sync

But I am unsure what to put in to the keyboard.xml I tried <power2>XBMC.ShutDown()</power2> but doesnt seem to work.
So I guess the question would be what Keynames can be used in the Keyboard.xml file?

EDIT: Looks like these are the only keynames you can use in the keyboard.xml file. Although this might work:

Note that even keys that aren't in the list can be used in keyboard.xml with the syntax:
<key id="xxx">Action</key>


There is no entry in the XBMC log for keynames that are not already in the keyboard.xml file, so how the heck are you meant to work out what the key ID is ?

Just tried: <key id="0164">XBMC.ShutDown()</key> and <key id="356">XBMC.ShutDown()</key> in the keyboard.xml file which don't work.

Got a big head ache now, can anyone help?
Reply
#5
From memory, I needed to add custom key entries (KEY_POWER2 for you) to lircmap.XML, but as your using just ir-keytable this may not apply to you.
Reply
#6
(2013-04-30, 00:03)teeedubb Wrote: From memory, I needed to add custom key entries (KEY_POWER2 for you) to lircmap.XML, but as your using just ir-keytable this may not apply to you.

Hi

I couldn't get it working properly with LIRC installed I had double commands / presses being sent to XBMC. Which is why I had to uninstall LIRC and do in all in kernel with the newer IR-keytable and in kernel IR module.

All the guides seem to be older ones for LIRC, going round in circles now!

Cheers
Reply
#7
Have you tried adding keypower2 to lircmap.xml without using lirc? Just a stabb in the dark...
Reply
#8
Maybe what I am trying to do is just not possible with ir-keytable / in kernel IR module. For those of you using LIRC how did you disable the in kernel stuff ? To stop the double commands / presses ?

Thanks
Reply
#9
There is quite a bit about remotes here, I have found it helpful in the past.

http://linhes.org/projects/linhes/wiki/A...tomization

By the way that file at the tomoyo site is part of the kernel, take a look in

/usr/src/linux-headers-3.2.0-39/include/linux/input.h

Substituting 3.2.0-39 for your kernel version of course.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#10
Hi there,

I have just the same question http://forum.xbmc.org/showthread.php?tid=164262

When you start reading http://wiki.xbmc.org/index.php?title=Keyboard you'll get the intention to edit /.xbmc/userdata/keyboard.xml

But I have no luck neither, but somewhere these keyboard presses need to be translated to proper xbmc commands

Please help
Kind Regards
Reply
#11
I too am wondering how to do this. I am in the exact same situation as you. See my post here:

http://forum.xbmc.org/showthread.php?tid...pid1420796

There has to be a way to map IR-Keytable names to XBMC commands, otherwise none of the standard keys would work!
Reply
#12
(2013-05-14, 16:49)NinjaMonkeyUK Wrote: I too am wondering how to do this. I am in the exact same situation as you. See my post here:

http://forum.xbmc.org/showthread.php?tid...pid1420796

There has to be a way to map IR-Keytable names to XBMC commands, otherwise none of the standard keys would work!

I read your post seems you have the same questions as myself, if you figure it out please let us know!

Cheers
Reply
#13
Unfortunately I haven't had any free time over the last few weeks to do any more work on this, which means I'm gradually falling even further behind on my TV shows and films!

I've had a few websites to build lately so haven't had much free time, but hopefully I'll be able to get back on it over the coming weeks. There must be information somewhere on how IR-Keytable names are mapped into XBMC - once we find that I think we are good to go!
Reply

Logout Mark Read Team Forum Stats Members Help
How to add new custom remote control buttons?0
This forum uses Lukasz Tkacz MyBB addons.