diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2021-03-10 09:44:35 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2021-03-10 00:24:51 +0000 |
commit | fe30bea36e50ed2d61a0c0343f3605d108ada6e6 (patch) | |
tree | 55996b4d5a3e072d03bf6c4684fe98fbfaffea1c /tools/libinput-analyze-per-slot-delta.py | |
parent | 40b83b11058bcc4c02ea3e7b631c8777c01b4291 (diff) | |
download | libinput-fe30bea36e50ed2d61a0c0343f3605d108ada6e6.tar.gz |
tools/per-slot-delta: print the button state too while analyzing
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools/libinput-analyze-per-slot-delta.py')
-rwxr-xr-x | tools/libinput-analyze-per-slot-delta.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tools/libinput-analyze-per-slot-delta.py b/tools/libinput-analyze-per-slot-delta.py index 8379ff19..081b777a 100755 --- a/tools/libinput-analyze-per-slot-delta.py +++ b/tools/libinput-analyze-per-slot-delta.py @@ -220,6 +220,11 @@ def main(argv): libevdev.EV_KEY.BTN_TOOL_QUADTAP: 0, libevdev.EV_KEY.BTN_TOOL_QUINTTAP: 0, } + btn_state = { + libevdev.EV_KEY.BTN_LEFT: 0, + libevdev.EV_KEY.BTN_MIDDLE: 0, + libevdev.EV_KEY.BTN_RIGHT: 0, + } nskipped_lines = 0 @@ -235,6 +240,8 @@ def main(argv): if e.code in tool_bits: tool_bits[e.code] = e.value + if e.code in btn_state: + btn_state[e.code] = e.value if args.use_st: # Note: this relies on the EV_KEY events to come in before the @@ -338,6 +345,17 @@ def main(argv): else: tool_state = " " + buttons = [ + (libevdev.EV_KEY.BTN_LEFT, "L"), + (libevdev.EV_KEY.BTN_MIDDLE, "M"), + (libevdev.EV_KEY.BTN_RIGHT, "R"), + ] + + button_state = ( + "".join([string for bit, string in buttons if btn_state[bit]]) + or "." + ) + fmt = SlotFormatter( is_absolute=args.use_absolute, resolution=(xres, yres) if args.use_mm else None, @@ -360,8 +378,8 @@ def main(argv): print("") nskipped_lines = 0 print( - "{:2d}.{:06d} {:+5d}ms {}: {}".format( - e.sec, e.usec, tdelta, tool_state, fmt + "{:2d}.{:06d} {:+5d}ms {} {} {}".format( + e.sec, e.usec, tdelta, tool_state, button_state, fmt ) ) elif fmt.filtered: |