diff --git a/teleprobe/src/auth/oidc.rs b/teleprobe/src/auth/oidc.rs index 551f143..870b674 100644 --- a/teleprobe/src/auth/oidc.rs +++ b/teleprobe/src/auth/oidc.rs @@ -3,20 +3,7 @@ use jsonwebtoken::{Algorithm, DecodingKey, Validation}; use serde::de::DeserializeOwned; use serde::Deserialize; -mod base64 { - use serde::{Deserialize, Deserializer, Serialize, Serializer}; - - pub fn serialize(v: &[u8], s: S) -> Result { - let base64 = base64::encode(v); - String::serialize(&base64, s) - } - - pub fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result, D::Error> { - let base64 = String::deserialize(d)?; - base64::decode(base64.as_bytes()).map_err(serde::de::Error::custom) - } -} - +#[allow(dead_code)] #[derive(Clone, Deserialize)] struct OpenIDConfiguration { issuer: String, @@ -33,6 +20,7 @@ struct JsonWebKeySet { } #[derive(Clone, Deserialize)] +#[allow(dead_code)] struct JsonWebKey { kty: String, kid: String, diff --git a/teleprobe/src/logutil.rs b/teleprobe/src/logutil.rs index 48d478b..a37af48 100644 --- a/teleprobe/src/logutil.rs +++ b/teleprobe/src/logutil.rs @@ -162,17 +162,6 @@ mod log_panics { } } - /// Determines how backtraces will be displayed. - #[derive(Debug, PartialEq, Eq, Clone, Copy)] - pub enum BacktraceMode { - /// Backtraces will be omitted from the log. - Off, - /// Backtraces will include addresses, but no symbol names or locations. - Unresolved, - /// Backtraces will include addresses as well as symbol names and locations when possible. - Resolved, - } - /// Configures the panic hook, ending with initialization. /// /// ## Example @@ -199,18 +188,6 @@ mod log_panics { } } - /// Controls how backtraces are displayed. - /// - /// The default when backtraces are enabled is [`BacktraceMode::Resolved`]. - pub fn backtrace_mode(mut self, mode: BacktraceMode) -> Self { - self.make_backtrace = match mode { - BacktraceMode::Off => || Backtrace::from(vec![]), - BacktraceMode::Unresolved => Backtrace::new_unresolved, - BacktraceMode::Resolved => Backtrace::default, - }; - self - } - /// Initializes the panic hook. /// /// After this method is called, all panics will be logged rather than printed diff --git a/teleprobe/src/probe/mod.rs b/teleprobe/src/probe/mod.rs index fb3d2ee..f12ebda 100644 --- a/teleprobe/src/probe/mod.rs +++ b/teleprobe/src/probe/mod.rs @@ -37,8 +37,12 @@ pub struct Opts { } pub fn list() -> Result<()> { + let start = Instant::now(); let lister = Lister::new(); let probes = lister.list_all(); + let t = Instant::now() - start; + println!("took {} ms", t.as_millis()); + if probes.is_empty() { println!("No probe found!"); return Ok(()); @@ -62,7 +66,7 @@ pub fn connect(opts: &Opts) -> Result { let Some(selector) = &opts.probe else { bail!("power reset requires a serial number"); }; - let Some(serial_number) = &selector.serial_number else { + if selector.serial_number.is_none() { bail!("power reset requires a serial number"); }; diff --git a/teleprobe/src/run.rs b/teleprobe/src/run.rs index 2b2a39a..edae9d2 100644 --- a/teleprobe/src/run.rs +++ b/teleprobe/src/run.rs @@ -82,7 +82,6 @@ impl Runner { // NOTE we don't load `.bss` because the app (cortex-m-rt) will zero it let candidates = [".vector_table", ".text", ".rodata", ".data"]; - let mut sections = vec![]; let mut vector_table = None; for sect in elf.sections() { if let Ok(name) = sect.name() { @@ -111,8 +110,6 @@ impl Runner { hard_fault: data[3], }); } - - sections.push(Section { start, data }); } } } @@ -577,13 +574,6 @@ fn get_rtt_main_from(elf: &ElfFile) -> anyhow::Result<(Option, u32)> { Ok((rtt, main.ok_or_else(|| anyhow!("`main` symbol not found"))?)) } -/// ELF section to be loaded onto the target -#[derive(Debug)] -struct Section { - start: u32, - data: Vec, -} - /// The contents of the vector table #[derive(Debug)] struct VectorTable {