summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2018-06-18 08:38:58 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2018-06-18 08:52:21 +1000
commita5700dcf433e621ec699c1f9e76d3a283da31de6 (patch)
tree821df9e7010b32a8619e2ede8212bc744b9a2c37 /tools
parent734496d972152dc9998f884c840550dc34c7088a (diff)
tools: measure touchpad-pressure: prevent division by zero
And make sure the equivalent entry in the measure touch-size is long enough to overwrite the current status line https://gitlab.freedesktop.org/libinput/libinput/issues/42 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/libinput-measure-touch-size2
-rwxr-xr-xtools/libinput-measure-touchpad-pressure3
2 files changed, 4 insertions, 1 deletions
diff --git a/tools/libinput-measure-touch-size b/tools/libinput-measure-touch-size
index 46beb154..8387eb67 100755
--- a/tools/libinput-measure-touch-size
+++ b/tools/libinput-measure-touch-size
@@ -138,7 +138,7 @@ class TouchSequence(object):
def _str_summary(self):
if not self.points:
- return "Sequence: no major/minor values recorded"
+ return "{:78s}".format("Sequence: no major/minor values recorded")
s = "Sequence: major: [{:3d}..{:3d}] ".format(
self.major_range.min, self.major_range.max
diff --git a/tools/libinput-measure-touchpad-pressure b/tools/libinput-measure-touchpad-pressure
index 9f6a9f24..25be07b5 100755
--- a/tools/libinput-measure-touchpad-pressure
+++ b/tools/libinput-measure-touchpad-pressure
@@ -105,6 +105,9 @@ class TouchSequence(object):
return self._str_state() if self.is_active else self._str_summary()
def _str_summary(self):
+ if not self.points:
+ return "{:78s}".format("Sequence: no pressure values recorded")
+
s = "Sequence {} pressure: "\
"min: {:3d} max: {:3d} avg: {:3d} median: {:3d} tags:" \
.format(