Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advice with --timeout / -t when using P4wnP1_cli #296

Closed
jonathancraddock opened this issue Apr 25, 2021 · 1 comment
Closed

Advice with --timeout / -t when using P4wnP1_cli #296

jonathancraddock opened this issue Apr 25, 2021 · 1 comment

Comments

@jonathancraddock
Copy link

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.

timeout-example-1

Maybe I've misunderstood the purpose of that -t switch. But, any thoughts are very welcome. :-)

Thanks,
J.

@jonathancraddock
Copy link
Author

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.

usb-timeout

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant