host.embedded_transfer¶
Console file transfer for embedded hosts.
UnixHost’s FileTransfer
dispatches scp/sftp/ftp/netcat — none of which exist on a
bare-metal/RTOS target. EmbeddedFileTransfer is the embedded analogue:
it speaks only the device’s own shell, and an
EmbeddedHost delegates get/put to it exactly as UnixHost delegates
to FileTransfer.
Backends¶
The backend is a typed, declared-per-host choice (the host’s transfer
field), never a fixed mechanism: embedded systems share no universal file
transfer protocol, so otto standardizes on a pluggable backend instead. Adding
a future backend (YMODEM, MCUmgr, a vendor mechanism) is then additive.
console(default) — the Zephyrfsshell.getrunsfs readand decodes the hexdump;putruns chunkedfs writecalls. Requires the target firmware to enableCONFIG_FILE_SYSTEM_SHELLover a mounted filesystem, and the host’sfilesystemfield in lab data to declare a real FS (notNoFileSystem). When the declaration isnone,get/putshort-circuit with a clear error (_NO_FILESYSTEM_MSG) before any shell command runs.tftp— reserved (seeTftpOptions); the body raisesNotImplementedError(deferred).
Why console transfer is slow¶
Every byte crosses the shell as ~3 characters of hex text (fs write) or is
read back inside a hexdump (fs read), one bounded command at a time. That
is fine for test artifacts and configuration files — kilobytes — but it is not
a path for firmware images; use TFTP (once implemented) for bulk data.
show_progress drives the same shared Rich progress bar as the Unix
transfers: put reports genuine per-chunk progress (one event per 32-byte
fs write — finer than asyncssh’s 256 KB SCP block), and get reports a
single completion event at 100% because fs read is monolithic (per-byte GET
progress would need chunked fs read <path> <off> <len>; deferred).
- otto.host.embedded_transfer.EmbeddedTransferType¶
File-transfer backend for an embedded host.
consoleuses the device shell’sfscommands;tftpis reserved and not yet implemented.alias of
Literal[‘console’, ‘tftp’]
-
class otto.host.embedded_transfer.EmbeddedFileTransfer(transfer, name, exec_cmd, filesystem=
None, max_filename_len=255)¶ Bases:
BaseFileTransferFile transfer for an embedded host, over the device shell only.
Subclasses
BaseFileTransfer, inheriting itsput_files/get_filesAPI (filename-length validation, shared Rich progress acquisition). Implements the abstract_run_put/_run_getagainst the device’sfsshell. The shell command runner is injected asexec_cmdso the class is testable against a fake shell with no real connection.