Triggering the dfu bootloader works

This commit is contained in:
Sebastian 2024-10-03 22:54:05 +02:00
parent ceb4dc035f
commit 524ed8f2c6
7 changed files with 131 additions and 25 deletions

View file

@ -14,8 +14,6 @@ serde_json = "1.0.118"
serialport = "4.5.1"
tokio = {version = "1.37.0", features = ["full"]}
tower-http = { version = "0.6.8", features = ["fs", "trace"] }
radomctl-protocol = { path = "../protocol" }
postcard = {version = "1.0.10", features = ["use-std"]}
dfu-libusb = "0.5.5"
rusb = "0.9"
clap = { version = "4.5.19", features = ["derive"] }
@ -25,3 +23,8 @@ tokio-util = { version = "0.7.13", features = ["codec", "rt"] }
bytes = "1.9.0"
futures = "0.3.31"
nom-language = "0.1.0"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
radomctl-protocol = { path = "../protocol" }
postcard = {version = "1.0.10", features = ["use-std"]}

View file

@ -0,0 +1,16 @@
use std::time::Duration;
use postcard::{from_bytes_cobs, to_stdvec_cobs};
use radomctl_protocol::*;
use radomctld::logger::setup_logger;
pub fn main() -> () {
let mut port = serialport::new("/dev/ttyACM0", 115_200)
.timeout(Duration::from_millis(10))
.open()
.expect("Failed to open port");
let host_msg = HostMessage::TriggerDFUBootloader;
let msg_bytes = to_stdvec_cobs(&host_msg).unwrap();
port.write_all(&msg_bytes).unwrap();
}

View file

@ -12,13 +12,17 @@ use tokio::{
task::JoinSet,
};
use tokio_serial;
use tower_http::{services::ServeFile, trace::TraceLayer};
use radomctld::{
logger::setup_logger,
rotctlprotocol::{parse_command, Command},
rotor::control_rotor,
};
use tower_http::{
services::{ServeDir, ServeFile},
trace::TraceLayer,
};
async fn process_socket(
socket: TcpStream,