mirror of
https://github.com/systemd/systemd.git
synced 2025-03-28 02:50:16 +03:00
Merge pull request #6431 from keszybz/hwdb-trivial-rows
hwdb: disallow acceleration matrices with trivial rows
This commit is contained in:
commit
ef965ed2e1
@ -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
|
||||
|
||||
@ -158,12 +155,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)
|
||||
#########################################
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user