Expand description
tag-start: program a configuration into an IDLE tag and start it.
Port of host/commandline/tag-start.cc. Waits for the tag to report a
definite state, optionally syncs its clock (--set-rtc), then starts from
the configuration the tag already holds. --config replaces it with a
JSON file, or with --merge overlays the file using
ConfigShape::merge: only fields the tag supports and the file speaks
for are copied, zeros included. --start-now forces start_delay to 0.
It then polls until the tag leaves IDLE and prints the resulting status,
since an acknowledged start is not proof the tag started.
Exits 0 when the tag reached RUNNING or CONFIGURED, was already in one of
them (no start is sent), or accepted the start but answered no status read
within --start-timeout (reported as “not confirmed”); 1 otherwise.
Usage: tag-start [-d] [-b BUS:DEVICE] [-c|--config FILE [--merge]] [--set-rtc] [--start-now] [--start-timeout S] [--settle-timeout S]
(both timeouts default to 10 s; status is polled once a second). The
configuration actually sent is printed as protobuf text before the
start. A non-IDLE tag other than RUNNING or CONFIGURED is refused with
exit 1, as is --set-rtc on a tag that is not IDLE. Option errors exit 2
(clap).
§Hardware side effects
The attach resets the tag. --set-rtc overwrites its clock with the
host’s. The start writes the configuration to the tag and begins a run
(CONFIGURED until start_delay elapses, then RUNNING), which the tool
does not end: the tag is left running when it exits. After an accepted
start, library link errors are silenced unless --debug, because a tag
whose next state sleeps at once drops the debug link.
This does not erase a previous log: a tag holding data is FINISHED or
ABORTED, not IDLE, and must be reset with tag-reset first.
Structs§
- Cli 🔒
- start a configured tag and print the resulting status
Constants§
- POLL 🔒
- Interval between status polls while settling and while waiting for the tag to leave IDLE.
Functions§
- fail 🔒
- Prints
messageto stderr and returns exit status 1. - load_
config_ 🔒json - Loads a Config from a protobuf-JSON file: replacing
cfg, or withmergeoverlaying only the fields the tag supports and the file speaks for (ConfigShape::for_file, so a stated zero is copied). - main 🔒
- Attaches, settles, optionally sets the clock, starts an IDLE tag with the chosen configuration and polls until it leaves IDLE.
- settle 🔒
- Polls status until the tag reports a state other than STATE_UNSPECIFIED, which it can legitimately report while booting after the attach reset.