diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2018-06-18 08:38:58 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2018-07-03 10:22:12 +1000 |
commit | 35cbeb7eac46958046e3af1857447686ebfa5e3c (patch) | |
tree | c468bb98aa174ddb9b3ae6bef2635755689d172a | |
parent | 8347c9b5b9b4ec6f969cceb15907a9a2ebfb3116 (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>
(cherry picked from commit a5700dcf433e621ec699c1f9e76d3a283da31de6)
-rwxr-xr-x | tools/libinput-measure-touch-size | 2 | ||||
-rwxr-xr-x | tools/libinput-measure-touchpad-pressure | 3 |
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( |