[mythtv-users] updating a keymap

Vincent McIntyre vincent.mcintyre at gmail.com
Tue Nov 15 11:04:34 UTC 2016


On Mon, Nov 14, 2016 at 12:49:43PM -0500, R. G. Newbury wrote:
> On 11/13/2016 07:26 AM, Vincent McIntyre wrote:
> 
> 
> > I need to remap a few keys to scancodes less than 255.
> > The wiki page above refers to /usr/src/<linux>/input.h
> > but I can't find any header files that have that kind
> > of data in it.
> 
> On Fedora you would need to install 'kernel-devel' and 'kernel-headers'
> Fedora puts the file at:
> /usr/src/kernels/`uname -r`/include/uapi/linux/input-event-codes.h.

Thanks for that, I had to install the full kernel source to get the
content of the file (the -headers package has a placeholder 0 bytes
in size).

> 
> > # evtest
> > /dev/input/event4:	iMON Panel, Knob and Mouse(15c2:ffdc)
> > /dev/input/event10:	iMON Remote (15c2:ffdc)
> 
> I think you are testing the wrong event: the iMon remote is event4
> and 10 not 15
> 
> My system is using what you have as event10. My event4 gives
> a smaller key list than the one for what you have as event10, But
> the keys which do not work as all listed as  >255 in both lists.
> evtest wants to use event 4. Now I have to figure out how to change
> that mapping... from the 'Panel, Knob' to the 'Remote'.
> 

I am pretty sure I have the right one because it's the only one that
evtest shows responses for when I press keys on the remote.

> So are close. You just need to find the correct input-event-codes.h
> file.  Note that I posted the top section of my
> /etc/rc_keymaps/imon_pad on this list a couple of days ago.
> But yell if you need help.

I found your post, as ever, shortly after sending my message.
It helped a lot.
 
But - there is something here that I am still missing.
evtest and ir-keytable agree that PLAYPAUSE is event code 164.

evtest reports (on a keypress):
Event: time 1479202974.374812, -------------- SYN_REPORT ------------
Event: time 1479202979.778827, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 1
Event: time 1479202979.778827, -------------- SYN_REPORT ------------
Event: time 1479202979.778843, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 0
Event: time 1479202979.778843, -------------- SYN_REPORT ------------

ir-keytable -r reports:
scancode 0xfe47 = KEY_PLAYPAUSE (0xa4)

This also dovetails with input-event-codes.h
#define KEY_PLAYPAUSE       164

According to the wiki page the system will only respond to codes
that are less than 255 (0xff). Here we have a code well under that
limit, to which mythtv is not responding. I worked my way down and
found the highest-numbered keycode that works is
KEY_VOLUMEUP (116, 0x73). KEY_STOP (128, 0x80) doesn't.
I haven't been game to test KEY_POWER (116, 0x74) which is the only
one in between for my remote.
I assume that the top bit is being masked (bug?) and that only codes
of 127 or less will be listened to.

So I tried this:
  # cat >testfile
  0xfe47 KEY_PAUSE
  ^D

  # ir-keytable -v -d /dev/input/event15 -w testfile
  Parsing testfile keycode file
  parsing 0xfe47=KEY_PAUSE:   value=119
  Opening /dev/input/event15
  Input Protocol version: 0x00010001
       fe47=0077
  Wrote 1 keycode(s) to driver
  
So far so good, it seems. But then I tried to see if the change 'took':
  # evtest
  <select device 15>
  <press PLAYPAUSE key on remote>
  Event: time 1479206112.262746, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 1
  Event: time 1479206112.262746, -------------- SYN_REPORT ------------
  Event: time 1479206112.262760, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 0
  Event: time 1479206112.262760, -------------- SYN_REPORT ------------

  # irkeytable -r -d /dev/input/event15 |grep PAUSE
  Enabled protocols: unknown rc-5 sony nec sanyo mce-kbd rc-6 sharp xmp 
  scancode 0xfe02 = KEY_PAUSE (0x77)
  scancode 0xfe47 = KEY_PLAYPAUSE (0xa4)

and playback does not pause or resume, jes' keeps rollin'.

I also tried KEY_P (25, 0x19), with the same result.

So next set of questions:
1. what precise format is ir-keytable -w expecting?
   a) From the manual page I would expect
   0xfe47 = KEY_PLAYPAUSE

   b) it would be natural to expect feeding back -r would work
   scancode 0xfe47 = KEY_PLAYPAUSE (0xa4)

   c) Geoff showed the format used in /lib/udev/rc_keymaps works
   0xfe47 KEY_PLAYPAUSE

   d) any of the above?

2. must I give ir-keytable the protocol(s) I want? (-p argument)

3. do I need to avoid having two mappings for KEY_PAUSE ?

4. I am doing these tests (for reasons of FAF) doing these tests
   sshed into the system, but I run them as root.
   Do I need to restart X after fiddling with the keymapping,
   to get myth to change its behaviour?

Thanks to all who have responded, I'm learning a lot.

Cheers
Vince


More information about the mythtv-users mailing list