From: Peter Hutterer Date: Fri, 6 May 2022 03:15:25 +0000 (+1000) Subject: tools/analyze-recording: add --print-state to always print values X-Git-Tag: 1.21.0~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ac5fd9e2441cc753ecfb069dac6854b0dd75977;p=platform%2Fupstream%2Flibinput.git 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 --- diff --git a/tools/libinput-analyze-recording.py b/tools/libinput-analyze-recording.py index c95e393..9df8cc9 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()