summaryrefslogtreecommitdiff
path: root/hwdb/parse_hwdb.py
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2016-11-22 15:21:24 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2016-12-01 20:11:54 +1000
commit086c001e29a86287d7b639cb71d1fc6408920c53 (patch)
tree765d6d7b2d04979d1d4b232d8ff28bc9d07f2dbc /hwdb/parse_hwdb.py
parentcde43c455b4d732ad2159c9da0c5568e828571e4 (diff)
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.
Diffstat (limited to 'hwdb/parse_hwdb.py')
-rwxr-xr-xhwdb/parse_hwdb.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/hwdb/parse_hwdb.py b/hwdb/parse_hwdb.py
index d94d8d13d8..97c796863f 100755
--- a/hwdb/parse_hwdb.py
+++ b/hwdb/parse_hwdb.py
@@ -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]