From 27bbe134258e464f1b9ea99cd2d9e9b25bd60352 Mon Sep 17 00:00:00 2001 From: vasilito Date: Mon, 27 Jul 2026 08:24:59 +0900 Subject: [PATCH] redbear-ftdi/redbear-acmd: propagate USB setup errors + bump base submodule redbear-ftdi: replace four silenced 'let _ = dev.{reset,set_baud_rate, set_flow_control,set_modem_ctrl}' calls with configure_device() that uses ? propagation. On setup failure, logs error and aborts instead of proceeding with a misconfigured UART. redbear-acmd: replace two silenced 'let _ = dev.{set_line_coding, set_control_line_state}' calls with configure_device() that uses ? propagation. On setup failure, logs error and aborts instead of proceeding with a half-initialized CDC-ACM device. Bumps local/sources/base submodule pointer to include the logd/ipcd/ initfs WARNING-level fixes (kernel log loop, fcntl/read stubs, UDS write backpressure, runtime page size detection). --- .../system/redbear-acmd/source/src/main.rs | 14 +++++++++++--- .../system/redbear-ftdi/source/src/main.rs | 16 ++++++++++++---- local/sources/base | 2 +- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/local/recipes/system/redbear-acmd/source/src/main.rs b/local/recipes/system/redbear-acmd/source/src/main.rs index 6efd3b3b53..ce157b9133 100644 --- a/local/recipes/system/redbear-acmd/source/src/main.rs +++ b/local/recipes/system/redbear-acmd/source/src/main.rs @@ -97,6 +97,13 @@ impl AcmDevice { } } +fn configure_device(dev: &mut AcmDevice) -> Result<(), io::Error> { + let lc = dev.line_coding; + dev.set_line_coding(&lc)?; + dev.set_control_line_state(CTRL_DTR | CTRL_RTS)?; + Ok(()) +} + /// SERIAL_STATE notification header size (8-byte setup-style header) plus the /// 2-byte UART state bitmap (CDC spec 1.1 section 6.3.5). const SERIAL_STATE_LEN: usize = 10; @@ -177,9 +184,10 @@ fn main() { bulk_out: handle.open_endpoint(bulk_out_num).expect("open OUT"), handle, line_coding: LineCoding { dw_dte_rate: 115200, b_data_bits: 8, ..LineCoding::default() }, }; - let lc = dev.line_coding; - let _ = dev.set_line_coding(&lc); - let _ = dev.set_control_line_state(CTRL_DTR | CTRL_RTS); + if let Err(e) = configure_device(&mut dev) { + log::error!("CDC ACM device setup failed, aborting: {}", e); + return; + } // SERIAL_STATE monitoring on the comm interface's interrupt-IN endpoint // (P6-A): DCD/DSR/break/RI/error bits, exposed via the scheme's "state" diff --git a/local/recipes/system/redbear-ftdi/source/src/main.rs b/local/recipes/system/redbear-ftdi/source/src/main.rs index 3ec1c73628..b9441d7f20 100644 --- a/local/recipes/system/redbear-ftdi/source/src/main.rs +++ b/local/recipes/system/redbear-ftdi/source/src/main.rs @@ -85,6 +85,14 @@ impl FtdiDevice { } } +fn configure_device(dev: &FtdiDevice) -> Result<(), io::Error> { + dev.reset()?; + dev.set_baud_rate(115200)?; + dev.set_flow_control(false, false)?; + dev.set_modem_ctrl(true, true)?; + Ok(()) +} + fn main() { log::set_max_level(log::LevelFilter::Info); common::init(); @@ -139,10 +147,10 @@ fn main() { handle, }; - let _ = dev.reset(); - let _ = dev.set_baud_rate(115200); - let _ = dev.set_flow_control(false, false); - let _ = dev.set_modem_ctrl(true, true); + if let Err(e) = configure_device(&dev) { + log::error!("FTDI device setup failed, aborting: {}", e); + return; + } log::info!("FTDI ready on {} port {} — bulk_in={} bulk_out={}", scheme, port_id, bulk_in_num, bulk_out_num); diff --git a/local/sources/base b/local/sources/base index 36dddf2300..4ba511830f 160000 --- a/local/sources/base +++ b/local/sources/base @@ -1 +1 @@ -Subproject commit 36dddf2300265ec73e26938e85ec565431369124 +Subproject commit 4ba511830f0d3f6006021fb55cfb021369bd510e