summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-04-28 17:43:54 +0200
committerGitHub <noreply@github.com>2019-04-28 17:43:54 +0200
commit8b6cd93044a9f9148bead149a3d49157829928f5 (patch)
tree8ab96f9426355376d7cffb9f0a2340ddcebe15b5
parentd8974757c44f6888ce38022d31e8162e0eb34ed8 (diff)
parentccf478417455ab1191571923fa640363d4c4b7a6 (diff)
downloadsystemd-8b6cd93044a9f9148bead149a3d49157829928f5.tar.gz
Merge pull request #12322 from ljmf00/hwdb-accel-location-patch
Add support for ACCEL_LOCATION udev property to deal with 2 sensors
-rw-r--r--hwdb/60-sensor.hwdb6
-rwxr-xr-xhwdb/parse_hwdb.py7
2 files changed, 13 insertions, 0 deletions
diff --git a/hwdb/60-sensor.hwdb b/hwdb/60-sensor.hwdb
index 11d5e8349d..02bae3e765 100644
--- a/hwdb/60-sensor.hwdb
+++ b/hwdb/60-sensor.hwdb
@@ -57,6 +57,12 @@
# automatically flip their output for an upside-down display when the device
# is held upright.
#
+# ACCEL_LOCATION=<location>
+#
+# where <location> is the location of the sensor. This value could be 'base'
+# or 'display'. The default, when unset, is equivalent to:
+# ACCEL_LOCATION=display
+#
# Sort by brand, model
#########################################
diff --git a/hwdb/parse_hwdb.py b/hwdb/parse_hwdb.py
index d84fba2221..fcc9a65e2b 100755
--- a/hwdb/parse_hwdb.py
+++ b/hwdb/parse_hwdb.py
@@ -126,6 +126,7 @@ def property_grammar():
('KEYBOARD_LED_NUMLOCK', Literal('0')),
('KEYBOARD_LED_CAPSLOCK', Literal('0')),
('ACCEL_MOUNT_MATRIX', mount_matrix),
+ ('ACCEL_LOCATION', STRING),
)
fixed_props = [Literal(name)('NAME') - Suppress('=') - val('VALUE')
for name, val in props]
@@ -177,6 +178,10 @@ def check_one_default(prop, settings):
if len(defaults) > 1:
error('More than one star entry: {!r}', prop)
+def check_one_accel_location(prop, value):
+ if value not in ['base', 'display']:
+ error('Wrong accel location: {!r}', prop)
+
def check_one_mount_matrix(prop, value):
numbers = [s for s in value if s not in {';', ','}]
if len(numbers) != 9:
@@ -219,6 +224,8 @@ def check_properties(groups):
check_one_default(prop, parsed.VALUE.SETTINGS)
elif parsed.NAME == 'ACCEL_MOUNT_MATRIX':
check_one_mount_matrix(prop, parsed.VALUE)
+ elif parsed.NAME == 'ACCEL_LOCATION':
+ check_one_accel_location(prop, parsed.VALUE)
elif parsed.NAME.startswith('KEYBOARD_KEY_'):
check_one_keycode(prop, parsed.VALUE)