]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - hwdb/parse_hwdb.py
hwdb: add XKB_FIXED_LAYOUT/VARIANT to the keyboard hwdb
[thirdparty/systemd.git] / hwdb / parse_hwdb.py
index d94d8d13d8f70a4245f7c1a1d69100c08f6c81c5..97c796863f46d6fbabe85bdc3fc80d6c3d02044c 100755 (executable)
@@ -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]