serial_download
Download binary files from a device over serial using ZMODEM. Uses idle and overall timeouts to detect stalled transfers and avoid indefinite hangs.
Instructions
Download a binary file from the device over ZMODEM via an existing serial session. The device must have lrzsz installed (sz command). Blocks until transfer completes, fails, or times out; progress is logged to stderr. Two timeouts: idle_timeout aborts on stalled transfer (real failure); timeout caps total duration and reports a suggested value if still progressing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| timeout | No | Overall timeout in seconds as a safety cap against indefinite hangs (default: 300). If reached while the transfer is still progressing (no idle), reports the timeout as too small with a suggested value instead of silently truncating. | |
| send_cmd | No | Device send command template (default: 'sz {remote}'). {remote} is replaced by remote_path | |
| local_path | Yes | Local destination file path | |
| session_id | Yes | The session ID returned by serial_open | |
| remote_path | Yes | Remote source file path on the device | |
| idle_timeout | No | Idle timeout in seconds: if no data flows for this long, the transfer is treated as a real failure (link/device stalled) and aborted. Independent of file size (default: 15, min: 3). |