From: Peter Hutterer Date: Fri, 3 Feb 2023 04:16:27 +0000 (+1000) Subject: tools: add --replay-after and --once to libinput replay X-Git-Tag: 1.23.0~29 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=41e7caac4852f2f7ff35a83fe6d40c6138fdf71f;p=platform%2Fupstream%2Flibinput.git tools: add --replay-after and --once to libinput replay For the cases where it's not possible to hit enter to start the replay because e.g. we cannot change focus, etc. Signed-off-by: Peter Hutterer --- diff --git a/tools/libinput-replay.man b/tools/libinput-replay.man index dcae907c..9eae92e1 100644 --- a/tools/libinput-replay.man +++ b/tools/libinput-replay.man @@ -15,6 +15,13 @@ simultaneously. .TP 8 .B \-\-help Print help +.TP 8 +.B \-\-once +Only replay the recording once, then exit. +.TP 8 +.B \-\-replay-after=s +Replay the recording after waiting for s seconds. This replaces the default +interactive prompt to start the replay. .SH NOTES .PP This tool replays events from a recording through the the kernel and is diff --git a/tools/libinput-replay.py b/tools/libinput-replay.py index 63f662fa..1a8fe700 100755 --- a/tools/libinput-replay.py +++ b/tools/libinput-replay.py @@ -269,7 +269,10 @@ def loop(args, recording): return while True: - input("Hit enter to start replaying") + if args.replay_after >= 0: + time.sleep(args.replay_after) + else: + input("Hit enter to start replaying") processes = [] for d in devices: @@ -284,6 +287,9 @@ def loop(args, recording): del processes + if args.once: + break + def create_device_quirk(device): try: @@ -363,6 +369,18 @@ def main(): type=str, help="Path to device recording", ) + parser.add_argument( + "--replay-after", + type=int, + default=-1, + help="Automatically replay once after N seconds", + ) + parser.add_argument( + "--once", + action="store_true", + default=False, + help="Stop and exit after one replay", + ) parser.add_argument("--verbose", action="store_true") args = parser.parse_args()