[mythtv-users] Foiled by lirc - yet again

Bryan Bennetts bryan.bennetts at gmail.com
Tue Mar 25 14:39:51 UTC 2008


On Tuesday 25 March 2008 13:25, Phill Edwards wrote:
> > That's very weird.  What happens if you go to a text console and press
> >  the same key there?
>
> It doesn't print "m" on the screen. I get what looks like a carriage
> return. This is really weird. I'm going to bed now to have nightmares
> about remote controls :(

Hey,

(Caveat - there's loads of 'thinks' and 'believes' in here as the last time I 
looked as such things was a *long* time ago and it wasn't in much detail 
then.)

I *believe* the reason you cannot use this 'keyboard' straight out of the box 
is that the kernel 'knows about' more types of key than X can handle.  So...I 
*think* you should be able to get this working using the inputdev driver in 
lirc. 

Bear with me, I'm going to describe how I think my Nova-t lircd config works, 
and then move onto your 'keyboard', note I haven't got a complete solution 
but this *may* get you part of the way there.

My nova-t lircd cofig file contains lines such as :

<snip>
begin codes
	Go			0x0161
	Power		0x0074
<snip>

Now, in the nova-t driver there is a list of key 
configs, /usr/src/linux/drivers/media/common/ir-keymaps.c contains :

<snip>
/* Hauppauge: the newer, gray remotes (seems there are multiple
 * slightly different versions), shipped with cx88+ivtv cards.
 * almost rc5 coding, but some non-standard keys */
IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE] = {
        /* Keys 0 to 9 */
        [ 0x00 ] = KEY_0,
<snip>
        [ 0x3b ] = KEY_SELECT,          /* top right button */
        [ 0x3c ] = KEY_ZOOM,            /* full */
        [ 0x3d ] = KEY_POWER,           /* system power (green button) */
<snip>

Now, the 'KEY_SELECT' and 'KEY_POWER', for example, are defined 
in /usr/src/linux/include/linux/input.h (note how one is in hex, the other in 
decimal) :

<snip>
#define KEY_SELECT              0x161
#define KEY_POWER               116     /* SC System Power Down */
<snip>

So, KEY_SELECT is my 'Go' key, and KEY_POWER is my 'Power' key (116 decimal == 
0x074 in hex).

So your task, should you choose to accept it.  Is to 

1) Find out what table is being used for you keyboard.
2) Work out which #defines (e.g. KEY_POWER) it's using.
3) Tinker with a lircd.conf using these #defines and the inputdev lirc driver, 
to find out which relates to which button.
4) Share your new config with the world, sit back and bask in the glory of 
providing a config for this remote.

I'm guessing for #1 and #2 you need to look in /usr/src/linux/drivers/hid/* - 
certainly your dmesg stuff looked like it came from there.  I took a brief 
look but its kinda complicated so you may get more mileage contacting the 
author than trying to work it out for yourself.

For #3 I'm afraid I haven't a clue what other parameters you'll need for the 
lircd.conf file (e.g. pre_data_bits etc) contacting the lirc guys would be 
your best bet.

Two alternatives to the above are :

1) Try using xmodmap to convert the keypresses into what you want - I didn't 
have much luck with this due to the limitation of X I stated above.
2) Wait for someone else to work it out (but that'd be cheating :P )

HTH,

Bryan.


More information about the mythtv-users mailing list