hwdb: add XKB_FIXED_LAYOUT/VARIANT to the keyboard hwdb

Yubikeys and other pseudo keyboards require that they are in the US layout,
otherwise the data they send is invalid. Add two new keys to signal this to
processes that handles (XKB) layouts.
This commit is contained in:
Peter Hutterer 2016-11-22 15:21:24 +10:00
parent cde43c455b
commit 086c001e29
2 changed files with 23 additions and 2 deletions

View File

@ -42,6 +42,13 @@
#
# To debug key presses and access scan code mapping data of
# an input device use the commonly available tool: evtest(1).
# A device with a fixed keyboard layout that must not be changed by
# the desktop environment may specify that layout as:
# XKB_FIXED_LAYOUT="us"
# XKB_FIXED_VARIANT=""
# Examples of such devices: the Yubikey or other key-code generating
# devices.
#
# To update this file, create a new file
# /etc/udev/hwdb.d/70-keyboard.hwdb
@ -1244,3 +1251,14 @@ evdev:atkbd:dmi:bvn*:bvr*:bd*:svnDIXONSP:pnDIXON*:pvr*
KEYBOARD_KEY_a0=! # mute
KEYBOARD_KEY_ae=! # volume down
KEYBOARD_KEY_b0=! # volume up
###########################################################
# Fixed layout devices
###########################################################
# Yubico Yubico Yubikey II"
evdev:input:b0003v1050p0010*
# Yubico Yubikey NEO OTP+CCID
evdev:input:b0003v1050p0111*
XKB_FIXED_LAYOUT="us"
XKB_FIXED_VARIANT=""

View File

@ -37,7 +37,7 @@ try:
LineStart, LineEnd,
ZeroOrMore, OneOrMore, Combine, Or, Optional, Suppress, Group,
nums, alphanums, printables,
stringEnd, pythonStyleComment,
stringEnd, pythonStyleComment, QuotedString,
ParseBaseException)
except ImportError:
print('pyparsing is not available')
@ -59,6 +59,7 @@ EOL = LineEnd().suppress()
EMPTYLINE = LineEnd()
COMMENTLINE = pythonStyleComment + EOL
INTEGER = Word(nums)
STRING = QuotedString('"')
REAL = Combine((INTEGER + Optional('.' + Optional(INTEGER))) ^ ('.' + INTEGER))
UDEV_TAG = Word(string.ascii_uppercase, alphanums + '_')
@ -76,7 +77,7 @@ def hwdb_grammar():
for category, conn in TYPES.items())
matchline = Combine(prefix + Word(printables + ' ' + '®')) + EOL
propertyline = (White(' ', exact=1).suppress() +
Combine(UDEV_TAG - '=' - Word(alphanums + '_=:@*.! ') - Optional(pythonStyleComment)) +
Combine(UDEV_TAG - '=' - Word(alphanums + '_=:@*.! "') - Optional(pythonStyleComment)) +
EOL)
propertycomment = White(' ', exact=1) + pythonStyleComment + EOL
@ -103,6 +104,8 @@ def property_grammar():
('POINTINGSTICK_SENSITIVITY', INTEGER),
('POINTINGSTICK_CONST_ACCEL', REAL),
('ID_INPUT_TOUCHPAD_INTEGRATION', Or(('internal', 'external'))),
('XKB_FIXED_LAYOUT', STRING),
('XKB_FIXED_VARIANT', STRING)
)
fixed_props = [Literal(name)('NAME') - Suppress('=') - val('VALUE')
for name, val in props]