Module rescue

Module rescue 

Source
Expand description

USB-CDC DFU rescue paths.

Two low-level mechanisms for getting the device into DFU mode independent of the CLI session:

  • TouchlessResetWatcher — watches CDC control requests for the 1200-baud touchless reset (host opens port at 1200 baud and then drops DTR). This is how flasher.meshcore.co.uk and adafruit-nrfutil --touch 1200 trigger DFU. The Adafruit nRF52 bootloader does not implement this; firmware is responsible.

  • EscapeWatcher — observes the inbound byte stream and fires when the magic sequence Ctrl-C Ctrl-C Ctrl-C dfu\r appears. Used when the CLI parser is wedged (panicked task, deadlocked channel, mis-parsed mode) so a human at a terminal can still force DFU.

Both mechanisms run below the CLI parser so a hung or mis-configured CLI can’t block them. The escape watcher deliberately observes without consuming, so the CLI parser still sees all bytes — Ctrl-C continues to mean “abort” to the CLI even while the rescue prefix accumulates.

Structs§

EscapeWatcher
Observes inbound CDC bytes for the rescue prefix Ctrl-C Ctrl-C Ctrl-C dfu followed by \r or \n. On match, returns RescueAction::TriggerDfu so the caller can put the device into serial DFU mode independent of the CLI session.
TouchlessResetWatcher
Watcher for the 1200-baud touchless reset.

Enums§

RescueAction
What a watcher decided to do as a result of an input event.