serial_upload
Upload a binary file to a device over a serial session via ZMODEM. Monitors transfer progress and aborts on idle or timeout to prevent hangs.
Instructions
Upload a binary file to the device over ZMODEM via an existing serial session. The device must have lrzsz installed (rz 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. | |
| recv_cmd | No | Device receive command (default: 'rz'). e.g. 'rz -e' to escape control chars | |
| local_path | Yes | Local source file path | |
| remote_dir | No | Remote directory hint (the rz command writes to its current dir by default; cd before rz if needed) | |
| session_id | Yes | The session ID returned by serial_open | |
| remote_name | No | Remote file name (default: basename of local_path). The device rz will name the file accordingly. | |
| 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). |