From 34afe3ba1ceb22f7f59285292e208b1b67265411 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 24 Jun 2019 12:49:33 +1000 Subject: [PATCH] tools: improve the error messages for measure touch-size/touchpad-pressure Signed-off-by: Peter Hutterer --- tools/libinput-measure-touch-size.py | 5 +++-- tools/libinput-measure-touchpad-pressure.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/libinput-measure-touch-size.py b/tools/libinput-measure-touch-size.py index d57ba1c..4b2201e 100755 --- a/tools/libinput-measure-touch-size.py +++ b/tools/libinput-measure-touch-size.py @@ -190,7 +190,7 @@ class Device(libevdev.Device): print("Using {}: {}\n".format(self.name, self.path)) if not self.has(libevdev.EV_ABS.ABS_MT_TOUCH_MAJOR): - raise InvalidDeviceError("device does not have ABS_MT_TOUCH_MAJOR") + raise InvalidDeviceError("Device does not have ABS_MT_TOUCH_MAJOR") self.has_minor = self.has(libevdev.EV_ABS.ABS_MT_TOUCH_MINOR) self.has_orientation = self.has(libevdev.EV_ABS.ABS_MT_ORIENTATION) @@ -345,7 +345,8 @@ def main(args): except (PermissionError, OSError): print("Error: failed to open device") except InvalidDeviceError as e: - print("Error: {}".format(e)) + print("This device does not have the capabilities for size-based touch detection."); + print("Details: {}".format(e)) if __name__ == "__main__": diff --git a/tools/libinput-measure-touchpad-pressure.py b/tools/libinput-measure-touchpad-pressure.py index 8a66a91..bba834c 100755 --- a/tools/libinput-measure-touchpad-pressure.py +++ b/tools/libinput-measure-touchpad-pressure.py @@ -167,7 +167,7 @@ class Device(libevdev.Device): absinfo = self.absinfo[libevdev.EV_ABS.ABS_PRESSURE] self.has_mt_pressure = False if absinfo is None: - raise InvalidDeviceError("device does not have ABS_PRESSURE/ABS_MT_PRESSURE") + raise InvalidDeviceError("Device does not have ABS_PRESSURE or ABS_MT_PRESSURE") prange = absinfo.maximum - absinfo.minimum @@ -320,7 +320,8 @@ def main(args): except (PermissionError, OSError): print("Error: failed to open device") except InvalidDeviceError as e: - print("Error: {}".format(e)) + print("This device does not have the capabilities for pressure-based touch detection."); + print("Details: {}".format(e)) if __name__ == "__main__": -- 2.7.4