summaryrefslogtreecommitdiff
path: root/tools/libinput-measure-fuzz.py
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2020-04-19 15:46:12 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2020-04-19 16:04:58 +1000
commit28e7f623022d00f354d002c5adcf92fa476751cf (patch)
tree9a9f79a315dbacb28b97968e037e563ab6043c83 /tools/libinput-measure-fuzz.py
parenta22137e7fdd42ce073ea278b5389a657bb9e33b9 (diff)
downloadlibinput-28e7f623022d00f354d002c5adcf92fa476751cf.tar.gz
tools: measure-fuzz: fix the tool to work again
Where libinput is installed, checking whether the fuzz is applied to the device will always fail with an error - the udev rules will remove the fuzz and copy its value to the LIBINPUT_FUZZ properties instead. So let's fix this: where the fuzz shows up on the device print a warning because libinput's udev rule isn't working. And where it's missing check the udev properties and compare those to the settings instead. Fixes #472 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools/libinput-measure-fuzz.py')
-rwxr-xr-xtools/libinput-measure-fuzz.py29
1 files changed, 23 insertions, 6 deletions
diff --git a/tools/libinput-measure-fuzz.py b/tools/libinput-measure-fuzz.py
index 6430086c..eab7364f 100755
--- a/tools/libinput-measure-fuzz.py
+++ b/tools/libinput-measure-fuzz.py
@@ -45,6 +45,7 @@ OVERRIDE_HWDB_FILE = '/etc/udev/hwdb.d/99-touchpad-fuzz-override.hwdb'
class tcolors:
GREEN = '\033[92m'
RED = '\033[91m'
+ YELLOW = '\033[93m'
BOLD = '\033[1m'
NORMAL = '\033[0m'
@@ -57,6 +58,10 @@ def print_green(msg, **kwargs):
print(tcolors.BOLD + tcolors.GREEN + msg + tcolors.NORMAL, **kwargs)
+def print_yellow(msg, **kwargs):
+ print(tcolors.BOLD + tcolors.YELLOW + msg + tcolors.NORMAL, **kwargs)
+
+
def print_red(msg, **kwargs):
print(tcolors.BOLD + tcolors.RED + msg + tcolors.NORMAL, **kwargs)
@@ -125,7 +130,7 @@ class Device(libevdev.Device):
(xfuzz is None and yfuzz is not None)):
raise InvalidConfigurationError('fuzz should be set for both axes')
- return (xfuzz, yfuzz)
+ return (int(xfuzz), int(yfuzz))
def check_axes(self):
'''
@@ -284,12 +289,24 @@ def test_hwdb_entry(device, fuzz):
d = Device(device.path)
f = d.check_axes()
- if f is not None and fuzz == f[0] and fuzz == f[1]:
- print_green('Success')
- return True
+ if f is not None:
+ if f == (fuzz, fuzz):
+ print_yellow('Warning')
+ print_bold('The hwdb applied to the device but libinput\'s udev '
+ 'rules have not picked it up. This should only happen'
+ 'if libinput is not installed')
+ return True
+ else:
+ print_red('Error')
+ return False
else:
- print_red('Error')
- return False
+ f = d.check_property()
+ if f is not None and f == (fuzz, fuzz):
+ print_green('Success')
+ return True
+ else:
+ print_red('Error')
+ return False
def check_file_for_lines(path, template):