Skip to content

Commit b06662e

Browse files
authored
Merge pull request systemd#4778 from whot/xkb-fixed-layout
Xkb fixed layout
2 parents dc68fed + 086c001 commit b06662e

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

hwdb/60-keyboard.hwdb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# scan codes to add to the AT keyboard's 'force-release' list.
55
#
66
# The lookup keys are composed in:
7-
# 60-keyboard.rules
7+
# 60-evdev.rules
88
#
99
# Note: The format of the "evdev:" prefix match key is a
1010
# contract between the rules file and the hardware data, it might
@@ -42,6 +42,13 @@
4242
#
4343
# To debug key presses and access scan code mapping data of
4444
# an input device use the commonly available tool: evtest(1).
45+
46+
# A device with a fixed keyboard layout that must not be changed by
47+
# the desktop environment may specify that layout as:
48+
# XKB_FIXED_LAYOUT="us"
49+
# XKB_FIXED_VARIANT=""
50+
# Examples of such devices: the Yubikey or other key-code generating
51+
# devices.
4552
#
4653
# To update this file, create a new file
4754
# /etc/udev/hwdb.d/70-keyboard.hwdb
@@ -1244,3 +1251,14 @@ evdev:atkbd:dmi:bvn*:bvr*:bd*:svnDIXONSP:pnDIXON*:pvr*
12441251
KEYBOARD_KEY_a0=! # mute
12451252
KEYBOARD_KEY_ae=! # volume down
12461253
KEYBOARD_KEY_b0=! # volume up
1254+
1255+
###########################################################
1256+
# Fixed layout devices
1257+
###########################################################
1258+
1259+
# Yubico Yubico Yubikey II"
1260+
evdev:input:b0003v1050p0010*
1261+
# Yubico Yubikey NEO OTP+CCID
1262+
evdev:input:b0003v1050p0111*
1263+
XKB_FIXED_LAYOUT="us"
1264+
XKB_FIXED_VARIANT=""

hwdb/parse_hwdb.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
LineStart, LineEnd,
3838
ZeroOrMore, OneOrMore, Combine, Or, Optional, Suppress, Group,
3939
nums, alphanums, printables,
40-
stringEnd, pythonStyleComment,
40+
stringEnd, pythonStyleComment, QuotedString,
4141
ParseBaseException)
4242
except ImportError:
4343
print('pyparsing is not available')
@@ -59,6 +59,7 @@
5959
EMPTYLINE = LineEnd()
6060
COMMENTLINE = pythonStyleComment + EOL
6161
INTEGER = Word(nums)
62+
STRING = QuotedString('"')
6263
REAL = Combine((INTEGER + Optional('.' + Optional(INTEGER))) ^ ('.' + INTEGER))
6364
UDEV_TAG = Word(string.ascii_uppercase, alphanums + '_')
6465

@@ -76,7 +77,7 @@ def hwdb_grammar():
7677
for category, conn in TYPES.items())
7778
matchline = Combine(prefix + Word(printables + ' ' + '®')) + EOL
7879
propertyline = (White(' ', exact=1).suppress() +
79-
Combine(UDEV_TAG - '=' - Word(alphanums + '_=:@*.! ') - Optional(pythonStyleComment)) +
80+
Combine(UDEV_TAG - '=' - Word(alphanums + '_=:@*.! "') - Optional(pythonStyleComment)) +
8081
EOL)
8182
propertycomment = White(' ', exact=1) + pythonStyleComment + EOL
8283

@@ -103,6 +104,8 @@ def property_grammar():
103104
('POINTINGSTICK_SENSITIVITY', INTEGER),
104105
('POINTINGSTICK_CONST_ACCEL', REAL),
105106
('ID_INPUT_TOUCHPAD_INTEGRATION', Or(('internal', 'external'))),
107+
('XKB_FIXED_LAYOUT', STRING),
108+
('XKB_FIXED_VARIANT', STRING)
106109
)
107110
fixed_props = [Literal(name)('NAME') - Suppress('=') - val('VALUE')
108111
for name, val in props]

0 commit comments

Comments
 (0)