[mythtv-users] "media keys" in mythtv-light launched from text console on raspberry pi 3

Stephen Worthington stephen_agent at jsw.gen.nz
Fri Dec 18 16:28:50 UTC 2020


On Fri, 18 Dec 2020 16:04:18 +0100, you wrote:

>I have a logitech bluetooth keyboard (Logitech K810) that has some 
>"media keys", volumeup, volumedown, mute etc. When I try to map theese 
>in the mythtv frontend, myth says something like "unknown key". Mapping 
>has no effect. At the moment I'm launching the frontend from a text 
>console. The keys have keycodes and scancodes in the the console 
>according to showkey(1) from the kbd package. Are there codes I can give 
>to setkeycodes(1) to allow the frontend to understand the media keys, or 
>will I have to get X working? The most convenient option would be if I 
>could just issue "loadkeys <keymap>" I think. Is it possible to create a 
>keymap that mythfrontend would be able to understand?
>
>P.S: Logitech K810 works really well as a media keyboard. Small, 
>backlight that goes to sleep when idle, really fast wake-up.

I am not familiar with mythtv-light or RPis, but in mythfrontend, the
keystrokes need to be normal keyboard keys to be recognised.  For
infrared remotes when using them directly with mythfrontend instead of
via lirc, this means that if you want the Info button to work, it
normally produces a keystroke like KEY_INFO, which mythfrontend does
not recognise.  So you need to remap it to KEY_I which is the normal
keyboard I key.

I would think you are having the same problem with the media keys -
they are producing KEY_ values that mythtv-light does not recognise.
So for example, with mythfrontend the volume up and down default to [
and ] characters, which are KEY_LEFTBRACE and KEY_RIGHTBRACE.  But
your keyboard will likely be producing KEY_VOLUMEDOWN and KEY_VOLUMEUP
for the media volume keys, so you will need to remap them to
KEY_LEFTBRACE and KEY_RIGHTBRACE.  Be aware that the media keys are
often already being used by the system.  In Ubuntu, the KEY_VOLUMEDOWN
and KEY_VOLUMEUP keystrokes are captured by the desktop and used to
adjust the system volume.  And if you remap keys, other programs that
do recognise them will no longer work properly.  So you may want to
wrap your frontend program in a script that sets up the keystroke
remappings you want, runs the frontend, then when it exits, remaps the
keystrokes back to their standard values.  The script will probably
need to use a "trap" command to capture Ctrl-C and the like so that
the keycodes get remapped back to standard if the script is killed
with Ctrl-C.

The full list of valid keystrokes and buttons in Ubuntu is found in:

/usr/src/linux-headers-<kernel-version>/include/uapi/linux/input-event-codes.h

If the RPi has the kernel header files available, you may have a copy
of that file or a similar one somewhere.  You can find it by searching
for a unique keystroke name, such as KEY_LEFTBRACE.

If you want to see the exact keystrokes your keyboard uses in KEY_
name format, you may be able to use evtest as described here:

https://askubuntu.com/questions/1197651/ubuntu-show-what-keys-are-pressed-in-real-time


More information about the mythtv-users mailing list