Advice with --timeout / -t when using P4wnP1_cli
jonathancraddock opened this issue · comments
Could anyone offer some advice for using the 'timeout' switch on the command line?
Usage:
P4wnP1_cli hid run [flags]
Flags:
-c, --commands string HIDScript commands to run, given as string
-h, --help help for run
-n, --name string Run a stored HIDScript
-t, --timeout uint32 Interrupt HIDScript after this timeout (seconds)
Should a timeout of 2 seconds abort the command after 2 seconds? For example, the RPi-Zero may be getting power from USB, even thought the host is shutdown. In those circumstances, the command below, via SSH, simply waits forever. I'd thought the -t
would interrupt the command after the specified timeout.
Maybe I've misunderstood the purpose of that -t
switch. But, any thoughts are very welcome. :-)
Thanks,
J.
Not entirely sure why, but the following appears to be achieving the timeout I was looking for:
timeout 1s P4wnP1_cli hid run -c 'press("SHIFT");delay(50);type("01234567890123456789")' -t 1
In the first example below, the host is shutdown, the command times out after 1 second. In the second example below, the host is back up again, and the command is executed as normal.
Without the press("SHIFT");delay(50);
I was finding some inconsistent behaviour the next time the command was run, perhaps some of the keystrokes were cached and causing an issue?
Feels a little 'hacky' but it's working consistently for my current purpose. I'll mark this closed.
Thanks,
J.