From 494d16aa0c50df4bafa4f2c885756a5babc1ad45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 22 Jul 2017 19:23:19 -0400 Subject: [PATCH 1/3] hwdb: disallow acceleration matrices with trivial rows All zeros means that we cannot detect acceleration in that direction. Related to #6430. --- hwdb/parse_hwdb.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hwdb/parse_hwdb.py b/hwdb/parse_hwdb.py index c7b49b83df6..a25ac8d9042 100755 --- a/hwdb/parse_hwdb.py +++ b/hwdb/parse_hwdb.py @@ -168,6 +168,20 @@ def check_one_default(prop, settings): if len(defaults) > 1: error('More than one star entry: {!r}', prop) +def check_one_mount_matrix(prop, value): + numbers = [s for s in value if s not in {';', ','}] + if len(numbers) != 9: + error('Wrong accel matrix: {!r}', prop) + try: + numbers = [abs(float(number)) for number in numbers] + except ValueError: + error('Wrong accel matrix: {!r}', prop) + bad_x, bad_y, bad_z = max(numbers[0:3]) == 0, max(numbers[3:6]) == 0, max(numbers[6:9]) == 0 + if bad_x or bad_y or bad_z: + error('Mount matrix is all zero in {} row: {!r}', + 'x' if bad_x else ('y' if bad_y else 'z'), + prop) + def check_one_keycode(prop, value): if value != '!' and ecodes is not None: key = 'KEY_' + value.upper() @@ -194,6 +208,8 @@ def check_properties(groups): prop_names.add(parsed.NAME) if parsed.NAME == 'MOUSE_DPI': check_one_default(prop, parsed.VALUE.SETTINGS) + elif parsed.NAME == 'ACCEL_MOUNT_MATRIX': + check_one_mount_matrix(prop, parsed.VALUE) elif parsed.NAME.startswith('KEYBOARD_KEY_'): check_one_keycode(prop, parsed.VALUE) From 8a8b33eeb0f46f739a5fb1029a49c36e551249e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 25 Jul 2017 09:08:21 -0400 Subject: [PATCH 2/3] hwdb: temporarily drop accelerometer entry for Winbook TW100 It shouldn't have all 0s. Added in 1f886b50f6cf17af12bf74049fb4e8031a33f40d. --- hwdb/60-sensor.hwdb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/hwdb/60-sensor.hwdb b/hwdb/60-sensor.hwdb index ee94de9a85e..1b7d5a8ec1f 100644 --- a/hwdb/60-sensor.hwdb +++ b/hwdb/60-sensor.hwdb @@ -158,12 +158,6 @@ sensor:modalias:acpi:BMA250E*:dmi:bvnAmericanMegatrendsInc.:bvr3BAIR1013:bd08/22 sensor:modalias:acpi:BMA250*:dmi:*:bvrTREK.G.WI71C.JGBMRBA*:*:svnInsyde:pnST70416-6:* ACCEL_MOUNT_MATRIX=0, 1, 0; 1, 0, 0; 0, 0, 1 -######################################### -# Winbook -######################################### -sensor:modalias:acpi:BMA250*:dmi:*svn*WinBook*:*pn*TW100* - ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 0 - ######################################### # Cytrix (Mytrix) ######################################### From 8727b86d503d9e6f8d49148a426caebba69543a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 25 Jul 2017 09:10:15 -0400 Subject: [PATCH 3/3] Revert "hwdb: Asus TP500LB accelerometer support" This reverts commit e8e4f5d970e79d7d76bb2938bd5ddf135a559426. It shouldn't have a row of all 0s. --- hwdb/60-sensor.hwdb | 3 --- 1 file changed, 3 deletions(-) diff --git a/hwdb/60-sensor.hwdb b/hwdb/60-sensor.hwdb index 1b7d5a8ec1f..67cfc4a4597 100644 --- a/hwdb/60-sensor.hwdb +++ b/hwdb/60-sensor.hwdb @@ -56,9 +56,6 @@ sensor:modalias:acpi:INVN6500*:dmi:*svnASUSTeK*:*pnT100CHI* sensor:modalias:acpi:INVN6500*:dmi:*svnASUSTeK*:*pnT100TA* ACCEL_MOUNT_MATRIX=1, 0, 0; 0, -1, 0; 0, 0, 1 -sensor:modalias:acpi:SMO8500*:dmi:*svn*ASUSTeK*:*pn*TP500LB* - ACCEL_MOUNT_MATRIX=0, 1, 0; 1, 0, 0; 0, 0, 0 - sensor:modalias:acpi:SMO8500*:dmi:*svn*ASUSTeK*:*pn*TP300LJ* ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 1