Skip to content

Commit d7d3169

Browse files
swickpoettering
authored andcommitted
hwdb: add XKB_FIXED_MODEL to the keyboard hwdb
Chromebook keyboards have a top row which generates f1-f10 key codes but the keys have media symbols printed on them. A simple scan code to key code mapping to the correct media keys makes the f1-f10 inaccessible. To properly use the keyboard a custom key code to symbol mapping in xbk is required (a variant of the chromebook xkb model is already upstream). Other devices have similar problems. This commit makes it possible to specify which xkb model should be used for a specific device by setting XKB_FIXED_MODEL.
1 parent d36b573 commit d7d3169

2 files changed

Lines changed: 18 additions & 16 deletions

File tree

hwdb.d/60-keyboard.hwdb

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,13 @@
7575
# XKB_FIXED_VARIANT=""
7676
# Examples of such devices: the Yubikey or other key-code generating
7777
# devices.
78-
#
78+
79+
# A device where the scan code to key code mapping is insufficient and
80+
# requires a special key code to symbol configuration may specify that with:
81+
# XKB_FIXED_MODEL="xkbmodel"
82+
# Examples of such devices: Chromebooks where the top row is used for both
83+
# media and F1-F10 keys.
84+
7985
# To update this file, create a new file
8086
# /etc/udev/hwdb.d/70-keyboard.hwdb
8187
# and add your rules there. To load the new rules execute (as root):
@@ -569,21 +575,6 @@ evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pnHDX9494NR:pvr*
569575
KEYBOARD_KEY_d8=!f23 # touchpad off
570576
KEYBOARD_KEY_d9=!f22 # touchpad on
571577

572-
# Chromebook 14
573-
# Top row keys (between ESC and power button)
574-
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pnFalco:pvr*
575-
KEYBOARD_KEY_3b=back
576-
KEYBOARD_KEY_3c=forward
577-
KEYBOARD_KEY_3d=refresh
578-
KEYBOARD_KEY_3f=switchvideomode
579-
KEYBOARD_KEY_40=brightnessdown
580-
KEYBOARD_KEY_41=brightnessup
581-
KEYBOARD_KEY_42=mute
582-
KEYBOARD_KEY_43=volumedown
583-
KEYBOARD_KEY_44=volumeup
584-
KEYBOARD_KEY_db=search # Same position as caps lock key on most keyboards
585-
# KEYBOARD_KEY_3e=fullscreen, no defined key sym
586-
587578
# HP EliteBook 725 G2
588579
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pnHPLicrice:pvr*
589580
# HP ProBook 440 G2
@@ -1733,3 +1724,13 @@ evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO:pn*:pvrThinkPadT560s
17331724
# Lenovo ThinkPad X1 Carbon 3rd Gen
17341725
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO:pn*:pvrThinkPadX1Carbon3rd
17351726
KEYBOARD_LED_CAPSLOCK=0
1727+
1728+
######################### FIXED MODEL DEVICES #############################
1729+
# This section lists devices which require special handling in their key
1730+
# code to keysym mapping by setting the xkb model.
1731+
# The model must be an xkb compatible model (defined with XKB_FIXED_MODEL).
1732+
1733+
# Chromebooks
1734+
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pnFalco:pvr*
1735+
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnAcer*:pnPeppy:pvr*
1736+
XKB_FIXED_MODEL="chromebook"

hwdb.d/parse_hwdb.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def property_grammar():
123123
('ID_INPUT_TOUCHPAD_INTEGRATION', Or(('internal', 'external'))),
124124
('XKB_FIXED_LAYOUT', STRING),
125125
('XKB_FIXED_VARIANT', STRING),
126+
('XKB_FIXED_MODEL', STRING),
126127
('KEYBOARD_LED_NUMLOCK', Literal('0')),
127128
('KEYBOARD_LED_CAPSLOCK', Literal('0')),
128129
('ACCEL_MOUNT_MATRIX', mount_matrix),

0 commit comments

Comments
 (0)