xorgproto: missing _EVDEVK() entries for some keys
Peter Hutterer
peter.hutterer at who-t.net
Tue Dec 17 01:15:10 UTC 2024
On Sun, Dec 15, 2024 at 07:00:12PM +0100, Oliver Gerlich wrote:
> Hello,
>
> in xorgproto project in include/X11/XF86keysym.h file there are some
> keys for which no _EVDEVK(...) line exists. E.g. for the subtitle key
> there is only this line:
>
> > #define XF86XK_Subtitle 0x1008ff9a /* cycle through subtitle */
>
> But there is no line like this:
>
> > #define XF86XK_Subtitle _EVDEVK(0x172) /* KEY_SUBTITLE */
>
> My understanding is that the XF86keysym.h file is used to generate the
> "evdev" section in
> https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/blob/master/symbols/inet
> ; but only lines with an _EVDEVK() entry are regarded by the generator.
For years we added things manually to the keysyms whenever the kernel
added new key codes but that was mostly pointless busywork and keysyms
easily got forgotten. The _EVDEVK macro exists so we can automate this
but one drawback is that any keysyms that were added before this macro
still need to be tended to manually. XF86XK_Subtitle was added in 2008,
well before the automation with the macro so it'll need manual attention
everywhere, including any mappings in xkeyboard-config.
Having a normal define and an _EVDEVK define would be a bug.
> I want to use XKB to map some keys from infrared remote controls, to
> improve out-of-the-box support for remote controls in Kodi media center
> (for https://github.com/xbmc/xbmc/issues/16834). Since these keys are
> not listed in the symbols/inet file, XKB cannot map them, and therefore
> Kodi cannot handle them.
>
> I have now run scripts/keysym-generator.py without a --kernel-versions
> parameter, to generate an XF86keysym.h file that contains _EVDEVK()
> entries for _all_ keys, regardless of the kernel version. The script was
> run on a system with libevdev 1.12.1+dfsg-1 and python-libevdev 0.11.
> The diff to
> https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/blob/e312ab76c4d93f2e637ac0c73987b22cd43420c7/include/X11/XF86keysym.h
> is attached.
ftr, libevdev uses kernel headers from its own tree so you should always
use the most recent libevdev to ensure you have all symbols available.
> In the diff I see that additional _EVDEVK() lines were generated for 132
> keys.
>
> Would it be possible and sensible to add _EVDEVK() lines for all of
> these keys, so that XF86keysym.h supports all evdev keys?
Theoretically yes but they'll have to be filtered for
duplicates/existing mappings. When I originally added this I went back
all the way to kernels 2.6.11, see the commits leading up to
ea9cf61a1097ae2c8bebb5e967999a252f696835. There's of course the chance I
missed a few though.
IMO any additions of keysyms should be done per-kernel version so it's
easier to review.
> Alternatively, would it be possible to add _EVDEVK() lines for keys that
> are related to media controls? The table at
> https://www.kernel.org/doc/html/v6.11/userspace-api/media/rc/rc-tables.html
> shows which keys would be interesting.
>
> Should I just submit a merge request for one of these approaches?
Yes, an MR would be much appreciated, much easier to review than patches
on a list. Thanks.
Cheers,
Peter
>
> Thanks,
> Oliver Gerlich
> --- include/X11/XF86keysym.h 2024-12-09 21:02:07.297023228 +0100
> +++ include/X11/XF86keysym.h.new1 2024-12-09 21:09:20.526311394 +0100
> @@ -272,10 +272,66 @@
> */
> #define _EVDEVK(_v) (0x10081000 + _v)
> /* Use: XF86XK_Eject _EVDEVK(0x0a2) KEY_EJECTCLOSECD */
> +#define XF86XK_Nextsong _EVDEVK(0x0a3) /* KEY_NEXTSONG */
> +#define XF86XK_Playpause _EVDEVK(0x0a4) /* KEY_PLAYPAUSE */
> +#define XF86XK_Previoussong _EVDEVK(0x0a5) /* KEY_PREVIOUSSONG */
> +#define XF86XK_Stopcd _EVDEVK(0x0a6) /* KEY_STOPCD */
> +#define XF86XK_Record _EVDEVK(0x0a7) /* KEY_RECORD */
> +#define XF86XK_Rewind _EVDEVK(0x0a8) /* KEY_REWIND */
> +#define XF86XK_Phone _EVDEVK(0x0a9) /* KEY_PHONE */
> +#define XF86XK_Iso _EVDEVK(0x0aa) /* KEY_ISO */
> +#define XF86XK_Config _EVDEVK(0x0ab) /* KEY_CONFIG */
> +#define XF86XK_Homepage _EVDEVK(0x0ac) /* KEY_HOMEPAGE */
> +#define XF86XK_Refresh _EVDEVK(0x0ad) /* KEY_REFRESH */
> +#define XF86XK_Exit _EVDEVK(0x0ae) /* KEY_EXIT */
> +#define XF86XK_Move _EVDEVK(0x0af) /* KEY_MOVE */
> +#define XF86XK_Edit _EVDEVK(0x0b0) /* KEY_EDIT */
> +#define XF86XK_Scrollup _EVDEVK(0x0b1) /* KEY_SCROLLUP */
> +#define XF86XK_Scrolldown _EVDEVK(0x0b2) /* KEY_SCROLLDOWN */
> +#define XF86XK_Kpleftparen _EVDEVK(0x0b3) /* KEY_KPLEFTPAREN */
> +#define XF86XK_Kprightparen _EVDEVK(0x0b4) /* KEY_KPRIGHTPAREN */
> /* Use: XF86XK_New _EVDEVK(0x0b5) v2.6.14 KEY_NEW */
> /* Use: XK_Redo _EVDEVK(0x0b6) v2.6.14 KEY_REDO */
> /* KEY_DASHBOARD has been mapped to LaunchB in xkeyboard-config since 2011 */
> +#define XF86XK_F13 _EVDEVK(0x0b7) /* KEY_F13 */
> +#define XF86XK_F14 _EVDEVK(0x0b8) /* KEY_F14 */
> +#define XF86XK_F15 _EVDEVK(0x0b9) /* KEY_F15 */
> +#define XF86XK_F16 _EVDEVK(0x0ba) /* KEY_F16 */
> +#define XF86XK_F17 _EVDEVK(0x0bb) /* KEY_F17 */
> +#define XF86XK_F18 _EVDEVK(0x0bc) /* KEY_F18 */
> +#define XF86XK_F19 _EVDEVK(0x0bd) /* KEY_F19 */
> +#define XF86XK_F20 _EVDEVK(0x0be) /* KEY_F20 */
> +#define XF86XK_F21 _EVDEVK(0x0bf) /* KEY_F21 */
> +#define XF86XK_F22 _EVDEVK(0x0c0) /* KEY_F22 */
> +#define XF86XK_F23 _EVDEVK(0x0c1) /* KEY_F23 */
> +#define XF86XK_F24 _EVDEVK(0x0c2) /* KEY_F24 */
> +#define XF86XK_Playcd _EVDEVK(0x0c8) /* KEY_PLAYCD */
> +#define XF86XK_Pausecd _EVDEVK(0x0c9) /* KEY_PAUSECD */
> +#define XF86XK_Prog3 _EVDEVK(0x0ca) /* KEY_PROG3 */
> +#define XF86XK_Prog4 _EVDEVK(0x0cb) /* KEY_PROG4 */
> /* Use: XF86XK_LaunchB _EVDEVK(0x0cc) v2.6.28 KEY_DASHBOARD */
> +#define XF86XK_Suspend _EVDEVK(0x0cd) /* KEY_SUSPEND */
> +#define XF86XK_Close _EVDEVK(0x0ce) /* KEY_CLOSE */
> +#define XF86XK_Play _EVDEVK(0x0cf) /* KEY_PLAY */
> +#define XF86XK_Fastforward _EVDEVK(0x0d0) /* KEY_FASTFORWARD */
> +#define XF86XK_Bassboost _EVDEVK(0x0d1) /* KEY_BASSBOOST */
> +#define XF86XK_Print _EVDEVK(0x0d2) /* KEY_PRINT */
> +#define XF86XK_Hp _EVDEVK(0x0d3) /* KEY_HP */
> +#define XF86XK_Camera _EVDEVK(0x0d4) /* KEY_CAMERA */
> +#define XF86XK_Sound _EVDEVK(0x0d5) /* KEY_SOUND */
> +#define XF86XK_Question _EVDEVK(0x0d6) /* KEY_QUESTION */
> +#define XF86XK_Email _EVDEVK(0x0d7) /* KEY_EMAIL */
> +#define XF86XK_Chat _EVDEVK(0x0d8) /* KEY_CHAT */
> +#define XF86XK_Search _EVDEVK(0x0d9) /* KEY_SEARCH */
> +#define XF86XK_Connect _EVDEVK(0x0da) /* KEY_CONNECT */
> +#define XF86XK_Finance _EVDEVK(0x0db) /* KEY_FINANCE */
> +#define XF86XK_Sport _EVDEVK(0x0dc) /* KEY_SPORT */
> +#define XF86XK_Shop _EVDEVK(0x0dd) /* KEY_SHOP */
> +#define XF86XK_Alterase _EVDEVK(0x0de) /* KEY_ALTERASE */
> +#define XF86XK_Cancel _EVDEVK(0x0df) /* KEY_CANCEL */
> +#define XF86XK_Brightnessdown _EVDEVK(0x0e0) /* KEY_BRIGHTNESSDOWN */
> +#define XF86XK_Brightnessup _EVDEVK(0x0e1) /* KEY_BRIGHTNESSUP */
> +#define XF86XK_Media _EVDEVK(0x0e2) /* KEY_MEDIA */
> /* Use: XF86XK_Display _EVDEVK(0x0e3) v2.6.12 KEY_SWITCHVIDEOMODE */
> /* Use: XF86XK_KbdLightOnOff _EVDEVK(0x0e4) v2.6.12 KEY_KBDILLUMTOGGLE */
> /* Use: XF86XK_KbdBrightnessDown _EVDEVK(0x0e5) v2.6.12 KEY_KBDILLUMDOWN */
> @@ -289,6 +345,7 @@
> /* Use: XF86XK_Bluetooth _EVDEVK(0x0ed) v2.6.19 KEY_BLUETOOTH */
> /* Use: XF86XK_WLAN _EVDEVK(0x0ee) v2.6.19 KEY_WLAN */
> /* Use: XF86XK_UWB _EVDEVK(0x0ef) v2.6.24 KEY_UWB */
> +#define XF86XK_Unknown _EVDEVK(0x0f0) /* KEY_UNKNOWN */
> /* Use: XF86XK_Next_VMode _EVDEVK(0x0f1) v2.6.23 KEY_VIDEO_NEXT */
> /* Use: XF86XK_Prev_VMode _EVDEVK(0x0f2) v2.6.23 KEY_VIDEO_PREV */
> /* Use: XF86XK_MonBrightnessCycle _EVDEVK(0x0f3) v2.6.23 KEY_BRIGHTNESS_CYCLE */
> @@ -297,18 +354,70 @@
> /* Use: XF86XK_WWAN _EVDEVK(0x0f6) v3.13 KEY_WWAN */
> /* Use: XF86XK_RFKill _EVDEVK(0x0f7) v2.6.33 KEY_RFKILL */
> /* Use: XF86XK_AudioMicMute _EVDEVK(0x0f8) v3.1 KEY_MICMUTE */
> +#define XF86XK_Ok _EVDEVK(0x160) /* KEY_OK */
> +#define XF86XK_Select _EVDEVK(0x161) /* KEY_SELECT */
> +#define XF86XK_Goto _EVDEVK(0x162) /* KEY_GOTO */
> +#define XF86XK_Clear _EVDEVK(0x163) /* KEY_CLEAR */
> +#define XF86XK_Power2 _EVDEVK(0x164) /* KEY_POWER2 */
> +#define XF86XK_Option _EVDEVK(0x165) /* KEY_OPTION */
> #define XF86XK_Info _EVDEVK(0x166) /* KEY_INFO */
> +#define XF86XK_Time _EVDEVK(0x167) /* KEY_TIME */
> +#define XF86XK_Vendor _EVDEVK(0x168) /* KEY_VENDOR */
> +#define XF86XK_Archive _EVDEVK(0x169) /* KEY_ARCHIVE */
> +#define XF86XK_Program _EVDEVK(0x16a) /* KEY_PROGRAM */
> +#define XF86XK_Channel _EVDEVK(0x16b) /* KEY_CHANNEL */
> +#define XF86XK_Favorites _EVDEVK(0x16c) /* KEY_FAVORITES */
> +#define XF86XK_Epg _EVDEVK(0x16d) /* KEY_EPG */
> +#define XF86XK_Pvr _EVDEVK(0x16e) /* KEY_PVR */
> +#define XF86XK_Mhp _EVDEVK(0x16f) /* KEY_MHP */
> +#define XF86XK_Language _EVDEVK(0x170) /* KEY_LANGUAGE */
> +#define XF86XK_Title _EVDEVK(0x171) /* KEY_TITLE */
> +#define XF86XK_Subtitle _EVDEVK(0x172) /* KEY_SUBTITLE */
> /* Use: XF86XK_CycleAngle _EVDEVK(0x173) KEY_ANGLE */
> /* Use: XF86XK_FullScreen _EVDEVK(0x174) v5.1 KEY_FULL_SCREEN */
> +#define XF86XK_Mode _EVDEVK(0x175) /* KEY_MODE */
> +#define XF86XK_Keyboard _EVDEVK(0x176) /* KEY_KEYBOARD */
> #define XF86XK_AspectRatio _EVDEVK(0x177) /* v5.1 KEY_ASPECT_RATIO */
> +#define XF86XK_Pc _EVDEVK(0x178) /* KEY_PC */
> +#define XF86XK_Tv _EVDEVK(0x179) /* KEY_TV */
> +#define XF86XK_Tv2 _EVDEVK(0x17a) /* KEY_TV2 */
> +#define XF86XK_Vcr _EVDEVK(0x17b) /* KEY_VCR */
> +#define XF86XK_Vcr2 _EVDEVK(0x17c) /* KEY_VCR2 */
> +#define XF86XK_Sat _EVDEVK(0x17d) /* KEY_SAT */
> +#define XF86XK_Sat2 _EVDEVK(0x17e) /* KEY_SAT2 */
> +#define XF86XK_Cd _EVDEVK(0x17f) /* KEY_CD */
> +#define XF86XK_Tape _EVDEVK(0x180) /* KEY_TAPE */
> +#define XF86XK_Radio _EVDEVK(0x181) /* KEY_RADIO */
> +#define XF86XK_Tuner _EVDEVK(0x182) /* KEY_TUNER */
> +#define XF86XK_Player _EVDEVK(0x183) /* KEY_PLAYER */
> +#define XF86XK_Text _EVDEVK(0x184) /* KEY_TEXT */
> #define XF86XK_DVD _EVDEVK(0x185) /* KEY_DVD */
> +#define XF86XK_Aux _EVDEVK(0x186) /* KEY_AUX */
> +#define XF86XK_Mp3 _EVDEVK(0x187) /* KEY_MP3 */
> #define XF86XK_Audio _EVDEVK(0x188) /* KEY_AUDIO */
> /* Use: XF86XK_Video _EVDEVK(0x189) KEY_VIDEO */
> +#define XF86XK_Directory _EVDEVK(0x18a) /* KEY_DIRECTORY */
> +#define XF86XK_List _EVDEVK(0x18b) /* KEY_LIST */
> +#define XF86XK_Memo _EVDEVK(0x18c) /* KEY_MEMO */
> /* Use: XF86XK_Calendar _EVDEVK(0x18d) KEY_CALENDAR */
> +#define XF86XK_Red _EVDEVK(0x18e) /* KEY_RED */
> +#define XF86XK_Green _EVDEVK(0x18f) /* KEY_GREEN */
> +#define XF86XK_Yellow _EVDEVK(0x190) /* KEY_YELLOW */
> +#define XF86XK_Blue _EVDEVK(0x191) /* KEY_BLUE */
> #define XF86XK_ChannelUp _EVDEVK(0x192) /* KEY_CHANNELUP */
> #define XF86XK_ChannelDown _EVDEVK(0x193) /* KEY_CHANNELDOWN */
> +#define XF86XK_First _EVDEVK(0x194) /* KEY_FIRST */
> +#define XF86XK_Last _EVDEVK(0x195) /* KEY_LAST */
> +#define XF86XK_Ab _EVDEVK(0x196) /* KEY_AB */
> +#define XF86XK_Next _EVDEVK(0x197) /* KEY_NEXT */
> +#define XF86XK_Restart _EVDEVK(0x198) /* KEY_RESTART */
> +#define XF86XK_Slow _EVDEVK(0x199) /* KEY_SLOW */
> /* Use: XF86XK_AudioRandomPlay _EVDEVK(0x19a) KEY_SHUFFLE */
> #define XF86XK_Break _EVDEVK(0x19b) /* KEY_BREAK */
> +#define XF86XK_Previous _EVDEVK(0x19c) /* KEY_PREVIOUS */
> +#define XF86XK_Digits _EVDEVK(0x19d) /* KEY_DIGITS */
> +#define XF86XK_Teen _EVDEVK(0x19e) /* KEY_TEEN */
> +#define XF86XK_Twen _EVDEVK(0x19f) /* KEY_TWEN */
> #define XF86XK_VideoPhone _EVDEVK(0x1a0) /* v2.6.20 KEY_VIDEOPHONE */
> /* Use: XF86XK_Game _EVDEVK(0x1a1) v2.6.20 KEY_GAMES */
> /* Use: XF86XK_ZoomIn _EVDEVK(0x1a2) v2.6.20 KEY_ZOOMIN */
> @@ -339,8 +448,31 @@
> #define XF86XK_NotificationCenter _EVDEVK(0x1bc) /* v5.10 KEY_NOTIFICATION_CENTER */
> #define XF86XK_PickupPhone _EVDEVK(0x1bd) /* v5.10 KEY_PICKUP_PHONE */
> #define XF86XK_HangupPhone _EVDEVK(0x1be) /* v5.10 KEY_HANGUP_PHONE */
> +#define XF86XK_DelEol _EVDEVK(0x1c0) /* KEY_DEL_EOL */
> +#define XF86XK_DelEos _EVDEVK(0x1c1) /* KEY_DEL_EOS */
> +#define XF86XK_InsLine _EVDEVK(0x1c2) /* KEY_INS_LINE */
> +#define XF86XK_DelLine _EVDEVK(0x1c3) /* KEY_DEL_LINE */
> #define XF86XK_Fn _EVDEVK(0x1d0) /* KEY_FN */
> #define XF86XK_Fn_Esc _EVDEVK(0x1d1) /* KEY_FN_ESC */
> +#define XF86XK_FnF1 _EVDEVK(0x1d2) /* KEY_FN_F1 */
> +#define XF86XK_FnF2 _EVDEVK(0x1d3) /* KEY_FN_F2 */
> +#define XF86XK_FnF3 _EVDEVK(0x1d4) /* KEY_FN_F3 */
> +#define XF86XK_FnF4 _EVDEVK(0x1d5) /* KEY_FN_F4 */
> +#define XF86XK_FnF5 _EVDEVK(0x1d6) /* KEY_FN_F5 */
> +#define XF86XK_FnF6 _EVDEVK(0x1d7) /* KEY_FN_F6 */
> +#define XF86XK_FnF7 _EVDEVK(0x1d8) /* KEY_FN_F7 */
> +#define XF86XK_FnF8 _EVDEVK(0x1d9) /* KEY_FN_F8 */
> +#define XF86XK_FnF9 _EVDEVK(0x1da) /* KEY_FN_F9 */
> +#define XF86XK_FnF10 _EVDEVK(0x1db) /* KEY_FN_F10 */
> +#define XF86XK_FnF11 _EVDEVK(0x1dc) /* KEY_FN_F11 */
> +#define XF86XK_FnF12 _EVDEVK(0x1dd) /* KEY_FN_F12 */
> +#define XF86XK_Fn1 _EVDEVK(0x1de) /* KEY_FN_1 */
> +#define XF86XK_Fn2 _EVDEVK(0x1df) /* KEY_FN_2 */
> +#define XF86XK_FnD _EVDEVK(0x1e0) /* KEY_FN_D */
> +#define XF86XK_FnE _EVDEVK(0x1e1) /* KEY_FN_E */
> +#define XF86XK_FnF _EVDEVK(0x1e2) /* KEY_FN_F */
> +#define XF86XK_FnS _EVDEVK(0x1e3) /* KEY_FN_S */
> +#define XF86XK_FnB _EVDEVK(0x1e4) /* KEY_FN_B */
> #define XF86XK_FnRightShift _EVDEVK(0x1e5) /* v5.10 KEY_FN_RIGHT_SHIFT */
> /* Use: XK_braille_dot_1 _EVDEVK(0x1f1) v2.6.17 KEY_BRL_DOT1 */
> /* Use: XK_braille_dot_2 _EVDEVK(0x1f2) v2.6.17 KEY_BRL_DOT2 */
More information about the xorg
mailing list