Expand description
§flashthing
A Rust library for flashing custom firmware to the Spotify Car Thing device.
This library provides a comprehensive toolset for interacting with the Amlogic SoC on the Spotify Car Thing, allowing users to flash custom firmware, read/write partitions, and execute other low-level operations on the device.
§Main Features
- Device detection and mode switching
- Memory reading and writing
- Partition management and restoration
- Custom firmware flashing via JSON configuration
- Progress reporting and event callbacks
- Error handling and recovery (including unbricking)
§Usage Example
use flashthing::{AmlogicSoC, Flasher, Event};
use std::{path::PathBuf, sync::Arc};
// Set up USB access for the device (on Linux, but no-op for other OSes so fine to call)
AmlogicSoC::host_setup().unwrap();
// Create a callback to handle events
let callback = Arc::new(|event: Event| {
match event {
Event::FlashProgress(progress) => {
println!("Progress: {:.1}%, ETA: {:.1}s", progress.percent, progress.eta / 1000.0);
},
Event::Step(step_index, step) => {
println!("Step {}: {:?}", step_index, step);
},
Event::DeviceMode(mode) => {
println!("Device mode: {:?}", mode);
},
_ => {}
}
});
// Flash firmware from a directory
let mut flasher = Flasher::from_directory(
PathBuf::from("/path/to/firmware"),
Some(callback.clone())
).unwrap();
// Start the flashing process
flasher.flash().unwrap();
§Device Connection
To use this library, the Spotify Car Thing must be connected via USB and placed in USB Mode by holding buttons 1 & 4 during power-on.
§Configuration Format
The flashing process is guided by a meta.json
file that specifies a sequence
of operations to perform. See the schema documentation for details on the format.
Modules§
- config
- Configuration types for the flashing process
Structs§
- Amlogic
SoC - The main interface for interacting with Amlogic-based hardware
- Flash
Progress - Progress information for flashing operations
- Flasher
- The main interface for flashing firmware to a Superbird device
Enums§
- Device
Mode - The current mode of the Superbird device
- Error
- Error types that can occur during the flashing process
- Event
- Events emitted during the flashing process