How topjohnwu/samloader-rs works
samloader combines Samsung firmware lookup/download with device flashing and related PIT, checksum, and device-management commands. The primary workflow starts at the CLI, downloads firmware through FUS, then processes firmware packages and sends partitions over the Odin/Loke protocol to a connected device. The graph also preserves documented capabilities that are not fully visible in the excerpts. Edges without direct source evidence are omitted; the CLI-to-library handoffs are documented at a high level rather than verified in sampled call sites.
Main entry points: flash.rs Flash orchestration · mod.rs Backend selection · main.rs Command router · fusclient.rs FUS client
Components 23
CLI workflows
- Command router
samloader/src/main.rs - Command actions
samloader/src/actions.rs - Download commands
samloader/src/download.rs - Flash commands
samloader/src/flash.rs
Firmware service
- FUS client
fus/src/fusclient.rs - FUS authentication
fus/src/auth.rs - FUS XML parsing
fus/src/xml.rs - Firmware transfer
fus/src/download.rs
Flashing engine
- Flash orchestration
odin/src/flash.rs - Firmware processing
odin/src/firmware.rs - Device information
odin/src/device_info.rs - Progress reporting
odin/src/progress.rs
Device transport
- Odin session
odin/src/odin.rs - LOKE protocol
odin/src/protocol.rs - Backend selection
odin/src/usb/mod.rs - nusb backend
odin/src/usb/nusb.rs - libusb backend
odin/src/usb/rusb.rs - Serial backend
odin/src/usb/serial.rs - Mock backend
odin/src/usb/mock.rs
PIT handling
- PIT parsing
pit/src/lib.rs
Other components
- Operator
- Samsung FUS
- Samsung device
Connections 25
- Operator → Command router: runs commands
README.md - Command router → Command actions: dispatches actions
samloader/src/main.rs - Command router → Download commands: dispatches downloads
samloader/src/main.rs - Command router → Flash commands: dispatches flashing
samloader/src/main.rs - Command actions → Flash commands: uses flash commands
samloader/src/actions.rs - Download commands → FUS client: requests firmware
- FUS client → FUS authentication: uses authentication
fus/src/fusclient.rs - FUS client → FUS XML parsing: uses XML helpers
fus/src/fusclient.rs - FUS client → Samsung FUS: sends service requests
- Firmware transfer → Samsung FUS: downloads firmware
- Flash commands → Flash orchestration: starts flashing
- Flash orchestration → Firmware processing: processes packages
odin/src/flash.rs - Flash orchestration → Progress reporting: reports progress
odin/src/flash.rs - Flash orchestration → Odin session: sends flash operations
odin/src/flash.rs - Flash orchestration → PIT parsing: reads PIT data
odin/src/flash.rs - Odin session → Device information: queries device
odin/src/odin.rs - Odin session → LOKE protocol: encodes commands
odin/src/odin.rs - Odin session → Backend selection: transfers data
odin/src/odin.rs - Backend selection → nusb backend: selects backend
odin/src/usb/mod.rs - Backend selection → libusb backend: selects backend
odin/src/usb/mod.rs - Backend selection → Serial backend: selects backend
odin/src/usb/mod.rs - Backend selection → Mock backend: selects backend
odin/src/usb/mod.rs - nusb backend → Samsung device: communicates with
- libusb backend → Samsung device: communicates with
- Serial backend → Samsung device: communicates with