Expand description
tag-stop: stop a running tag and print the resulting status.
Port of host/commandline/tag-stop.cc. Waits for the tag to report a
definite state after the attach reset, sends the stop, then polls until
the tag reaches FINISHED or ABORTED: a stop is posted and acknowledged
before the state machine acts on it, so an immediate status read can
still say RUNNING.
Exits 0 once the tag is stopped, with its status printed; 1 if the
attach, a status read or the stop fails, the tag never settles, or it
does not stop within --stop-timeout.
Usage: tag-stop [-d] [-b BUS:DEVICE] [--stop-timeout S] [--settle-timeout S] (defaults 30 and 10 s). Status is polled every 2 s,
ceil(stop-timeout / 2) times; with --stop-timeout 0 it is not polled
at all and the tool fails. Option errors exit 2 (clap).
§Hardware side effects
The attach resets the tag, and the stop ends its run, leaving the stored data in place for a download. A tag that is not acquiring (IDLE, for example) refuses the stop and the tool exits 1. The status is printed even when the tag fails to stop, for diagnosis.
Structs§
- Cli 🔒
- stop a running tag and print the resulting status
Functions§
- eprint_
line 🔒 - Writes
messageto stderr, adding a newline unless it ends with one. - fail 🔒
- Prints
messageto stderr and returns exit status 1. - main 🔒
- Attaches, settles, stops the tag and polls for FINISHED or ABORTED.
- settle 🔒
- Polls status a second apart until the tag reports a state other than STATE_UNSPECIFIED. A booting tag refuses a stop (“Monitor request not permitted in current tag state”), so the stop waits for this.