summaryrefslogtreecommitdiff
path: root/tools/libinput-analyze-recording.py
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2022-05-06 13:15:25 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2022-05-06 14:05:13 +1000
commit4ac5fd9e2441cc753ecfb069dac6854b0dd75977 (patch)
tree3d778976c293b976e7653b0fd1f33cf475308236 /tools/libinput-analyze-recording.py
parent200bc920ac5b770baea3796acf5cd634f8703545 (diff)
downloadlibinput-4ac5fd9e2441cc753ecfb069dac6854b0dd75977.tar.gz
tools/analyze-recording: add --print-state to always print values
Helpful in comparing values that update frequently - without this the last printed value may be way off the page when some other value comes in that it needs to be compared to. Values not seen yet default to zero - we can't query those from a recording but it'll be good enough this way. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools/libinput-analyze-recording.py')
-rwxr-xr-xtools/libinput-analyze-recording.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/libinput-analyze-recording.py b/tools/libinput-analyze-recording.py
index c95e393b..9df8cc9a 100755
--- a/tools/libinput-analyze-recording.py
+++ b/tools/libinput-analyze-recording.py
@@ -87,6 +87,12 @@ def main(argv):
default="",
help="A comma-separated list of axis names to print, ignoring all others",
)
+ parser.add_argument(
+ "--print-state",
+ action="store_true",
+ default=False,
+ help="Always print all axis values, even unchanged ones",
+ )
args = parser.parse_args()
if args.ignore and args.only:
@@ -148,6 +154,7 @@ def main(argv):
print(header_line)
print("-" * len(header_line))
+ current_codes = []
current_frame = {} # {evdev-code: value}
axes_in_use = {} # to print axes never sending events
last_fields = [] # to skip duplicate lines
@@ -164,12 +171,16 @@ def main(argv):
keystate_changed = True
elif is_tracked_axis(e.code, only_axes, ignored_axes):
current_frame[e.code] = e.value
+ current_codes.append(e.code)
elif e.code == libevdev.EV_SYN.SYN_REPORT:
fields = []
for a in axes:
- s = format_value(a, current_frame[a]) if a in current_frame else " "
+ if args.print_state or a in current_codes:
+ s = format_value(a, current_frame.get(a, 0))
+ else:
+ s = ""
fields.append(s.rjust(max(MIN_FIELD_WIDTH, axes[a])))
- current_frame = {}
+ current_codes = []
if last_fields != fields or keystate_changed:
last_fields = fields.copy()