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).
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
|
||||
+1
-1
Submodule local/sources/base updated: 36dddf2300...4ba511830f
Reference in New Issue
Block a user