[mythtv-users] Programming remote button bindings (WAS: What major features are planned for 0.27?)

Michael T. Dean mtdean at thirdcontact.com
Wed Nov 28 17:32:09 UTC 2012

On 11/28/2012 11:18 AM, Mark Greenwood wrote:
> On Wednesday 28 Nov 2012 09:52:01 Michael T. Dean wrote:
>> On 11/28/2012 02:59 AM, Simon Hobson wrote:
>>> I wrote:
>>>>> Summary:  There's a systemic issue (any key with code>  256 is
>>>>> filtered by X),
>>>> BINGO !
>>>> ir-keytable tells me that all the keys I can't get to work have codes
>>>> greater than 0xff.
>>>> So I'm off to make a copy of the rc6_mce keymap and fix some of these.
>>> Well I now have Back, Pause, Info, Commercial skip forwards/back, and
>>> Menu working, plus the numeric digits. Along with the keys that
>>> already worked, that covers almost all my usage :)
>>> Gary Buhrmaster wrote:
>>>> There was some work being discussed (Jarod may have been part of it?)
>>>> to allow
>>>> the linux kernel ir codes>255 to be able to be used via X, but it
>>>> was stated
>>>> to be major work, and unlikely to be seen any time soon.  You can
>>>> probably find
>>>> the list archives regarding this if you search the various X11 lists,
>>>> and maybe
>>>> find the status of any work and/or possible schedules for work.
>>> To me that seems the logical place to fix the problem - it doesn't
>>> seem to make sense to me capturing IR buttons and then sending
>>> keycodes through into a system that's going to filter most of them !
>>> Presumably (other than using LIRC) there's no way for Myth to access
>>> the codes before they get filtered ?
>>> In the meantime, I guess the easiest thing to do is find the header
>>> file where all the keycodes are defined, pick a bunch of codes
>>> (probably all those>=128) and modify my IR code table to use those.
>>> Then back to figuring out what is what in the very long list of Myth
>>> keybindings.
>> I still don't get why people think doing this (and repeating it with
>> each upgrade--and on each system) is easier than creating (or, likely,
>> downloading) a single LIRC configuration file for the remote
>> (lircd.conf) and a LIRC configuration for MythTV (~/.lircrc) and any
>> other application you want to use with the remote, which can then be
>> backed up with your other configuration files and just dropped in place
>> whenever you upgrade your distro or set up a new system or...
>> Sure, getting LIRC working once took some learning, but once I finished,
>> I forgot /everything/ I ever knew about configuring LIRC and haven't
>> worried about it since I first set it up in 2004.  All I remember at
>> this point is just how sensible LIRC's abstraction is--allowing me to
>> configure applications individually independent of the specific remote
>> I'm using and without having to remap remote buttons for a specific
>> application (and make them crazy mappings for other apps) or without
>> having to remap application buttons (and mess up keyboard mappings at
>> the same time).
> Because, with the in-kernel drivers now producing sensible keypress names for our remote buttons *without* doing *any* configuration *at all*, all it needs is for mythtv to support those keypress names and we'd have a system that worked out of the box. (Like my xbmc setup did when I installed it. I was very impressed by that.)

No, for the case I questioned--Simon's case--it's sending keys that are 
eaten by X and, therefore, unusable in any X-based application.  So, 
Simon *reconfigured* his kernel's keymap for the remote.  This is *not* 
"without doing any configuration at all."

> As it is I have to use a file that maps 'KEY_VOLUMEDOWN' to '[', KEY_UP' to 'Up', 'KEY_PLAY' to 'P'. This is ridiculous. All because mythtv refuses to recognise 'KEY_PLAY' as meaning 'I have pressed the PLAY button' or 'KEY_VOLUMEDOWN' as meaning 'Please reduce the volume'. And apparently this is because doing this would be confusing. Yes, definitely less confusing than the current method a newcomer is presented with, which is to ignore all the buttons on his remote. That's baffling.

FWIW, the defaults for volume in MythTV are:

|TV Frontend/VOLUMEDOWN:||[,{,F10,Volume Down
||TV Frontend/VOLUMEUP:||],},F11,Volume Up|
|TV Frontend/MUTE:|||,\\,F9,Volume Mute|

where the last are keys someone added to allow the multimedia 
volume/mute keys to work out of the box ( 
https://github.com/MythTV/mythtv/commit/26893b2ab0 ).

And, FWI(also)W, you don't need to use a file to map 'KEY_VOLUMEDOWN' to 
'['--you just need to go to Edit Keys and set up your remote using 
whatever random key bindings the kernel developers decided to send for 
each of your remote buttons.

And, I've been asking if the multimedia keys should actually be 
VolumeDown/VolumeUp/VolumeMute (no spaces) since it went in--based 
purely on the Qt key names--but no one has ever cared to test in 5 
years, which made me assume it must actually work, so I haven't changed 
it.  I haven't actually tested it, either (probably because a. I don't 
care since I'm not affected by it/don't care to use multimedia keys in 
MythTV, and b. I'm too busy repeating myself on the list when people 
just don't get that any valid key that's sent through X can be used in 
MythTV simply by using Edit Keys to map it appropriately).  But now that 
you're saying it doesn't work out of the box, if you were to actually 
test mapping your volume keys and report back what key is actually 
mapped for your remote buttons and keyboard multimedia volume, I'd be 
happy to fix it if I am, indeed, correct that it was improperly mapped 
years ago.

>> And since modern distros that are a good choice for MythTV (i.e. *buntu
>> and Fedora and possibly others with excellent repo/configuration support
>> for MythTV) actually allow you to just select a remote so it can set it
>> up for you, things should be a lot easier now than they were in 2004.
> Yeah it would be nice if it worked. It's good for you that you have no trouble with LIRC. You must have a different remote than I do. Mine's apparently supported by the mythbuntu control centre but it has never created a functional hardware.conf for me, nor does it choose anything like a sensible mapping.
>> But, hey, at least you can say, "I finally set up my system and I don't
>> /have/ to use Linux Infrared Remote Control to, support my, er, ...
>> infrared remote control in ... Linux."
> Yes, I can also say 'Hey, I just installed a new media centre and it basically just worked without me having to spend hours fiddling with it. Let's go to the pub'. I like it when technology doesn't fight with me.

Again, you're not talking about the same thing I was.  Remapping kernel 
keymaps is not, "It Just Works, so let's have a beer."  Since the kernel 
must--by necessity--use key codes > 255 for new "remote-only" "keys" 
(neigh, buttons) because key codes <= 255 are already used, those keys 
aren't usable in X or X applications, so if you have a remote with those 
buttons you /must/ remap those key codes to repeat already-used codes.


More information about the mythtv-users mailing list