serial_wait_for
Block until a serial line matches a custom regex or built-in event (error, boot, panic), then return the match with preceding context. Eliminates polling when watching boot logs.
Instructions
Block until a line matches a custom regex ('pattern') and/or built-in event presets ('events': error/hardfault/assert/panic/boot), then return once with the hit and preceding context. Ideal for watching boot logs without polling.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | No | Serial port name, e.g. COM5 or /dev/ttyUSB0 | |
| events | No | Built-in event presets to watch | |
| pattern | No | Custom regular expression | |
| timeout_ms | No | Give up after this long (default 30000) | |
| context_lines | No | Lines of context before the match (default 5) |