Expand description
tag-attach-cycle: repeatedly attach to and detach from a tag.
Port of host/commandline/tag-attach-cycle.cc. Each cycle attaches
(which resets the tag), optionally reads and prints its status, stays
attached for --on-ms, detaches, and stays away for --off-ms. With
--cycles 0 it runs until Ctrl-C, which ends the run between steps
rather than killing the process.
Exits 0 when the cycles complete or Ctrl-C stops them; 1 if an attach fails.
Usage: tag-attach-cycle [-d] [-b BUS:DEVICE] [--on-ms MS] [--off-ms MS] [--cycles N] [--no-status]; both intervals default to 5000 ms.
This is a test of the attach path itself, one of the two legitimate reasons to attach to a running tag: every cycle resets the tag and ends whatever it was doing, so it says nothing about how a run behaves unattended. A status read that fails is reported on stderr and the cycle continues.
Β§Hardware side effects
One target reset per cycle. A tag past its start time is restarted by each reset.
StructsΒ§
- Cli π
- repeatedly attach and detach from a running tag
StaticsΒ§
- STOP_
REQUESTED π - Set by Ctrl-C to end the cycling.
FunctionsΒ§
- interruptible_
sleep π - Sleeps for
ms, in steps of at most 100 ms, returning early on Ctrl-C. - main π
- Installs the Ctrl-C handler, then runs the attach/detach cycles.
- print_
status π - Prints the tagβs state, clock (ms since the Unix epoch) and internal and
external flash page counts for
cycle, and any firmware debug message on stderr.