[mythtv-users] different key remappings for different keyboards? [kernel-level SOLUTION]

j2u4 j2u4 j2u44u at gmail.com
Mon Feb 8 23:57:16 UTC 2010

This looks *exactly* like what I was looking for. Thanks for the work and
the explanation David -- I'll try it out tonight!


On Mon, Feb 8, 2010 at 3:06 PM, David Kubicek <foceni at gmail.com> wrote:

> On 02/08/2010 07:50 PM, David Kubicek wrote:
>> On 02/08/2010 06:37 PM, j2u4 j2u4 wrote:
>>> My myth frontend has two keyboards -- the regular one, and a nice
>>> VRC-1100 remote control (all buttons register as keypresses).
>>> I would like the buttons that generate ESC and BACKSPACE remapped on the
>>> remote control, which I can do easily enough with xmodmap. But I'd also
>>> like the buttons on the regular keyboard to *not* be remapped. I don't
>>> think there is any way to do that with xmodmap, since the mappings are
>>> not device-specific. But maybe it can be done lower down, like with
>>> setkeycodes? Has anyone played with this?
> I checked keyfuzz out (I mentioned it earlier) and it works great, I just
> had to find a few things which changed in kernel since then make two changes
> in the source accordingly. Remember, you're changing the runtime translation
> tables in the very heart on the Linux INPUT system, so this mapping is
> completely transparent on all levels. No other configuration is necessary.
> You need to install these packages: xmltoman, gengetopt, gperf, joystick.
> Plus, of course, gcc, autoconf, automake and similar tools (some are in pkg
> "build-essential" in Debian/Ubuntu). Then get the source and apply my
> attached patch:
> # git clone git://git.0pointer.de/keyfuzz.git
> # cd keyfuzz
> # ./bootstrap.sh
> # ./configure
> # cd src
> # patch -p1 < keyfuzz.patch
> # make
> Done. Now find which /dev/input device corresponds to which keyboard (using
> "lsinput" from input-utils) or "lshal" can tell you directly if you don't
> mind searching for a while.
> Now to scancode/keycode mapping. The following will print out the complete
> mapping table. Save it. :)
> # src/keyfuzz -d /dev/input/event4 --get
> You need to find a line like this if you want to remap ESC:
> 0x70029 KEY_ESC
> Think of another mapping you want that scan code (HW button) to map to and
> when ready (let's say ESC key should be TAB), run:
> # echo "0x70029 KEY_TAB" | src/keyfuzz -d /dev/input/event4 --set
> You can include several commands like this in your /etc/rc.local or similar
> location to make them permanent. Possibly copy the keyfuzz binary into
> /usr/local/bin/ (or run "make install" if you don't mind the unnecessary
> mess).
> The complete list of KEY_* values is in /usr/include/linux/input.h
> For testing your results, use "evtest" tool from the joystick package I
> listed.
> That's it, easy. Except this won't work for input devices requiring
> "uinput" module. It's a kernel INPUT driver for user-space daemons (like
> BlueZ) which allows them to plug into kernel INPUT. So most IR and BT
> keyboards cannot be remapped in this way. Uinput doesn't keep a keymap
> table, it's a responsibility of the user-space application. You'd have to
> hack on BlueZ or Lirc daemon sources to change the mapping.
> --
> David Kubicek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20100208/3539ccff/attachment.htm>

More information about the mythtv-users mailing list