-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Hi,
Weird issue, open blocks forever on opening /dev/ttyUSBx sometimes. Specifically dmesg shows me usb device disconnect then reconnect (different issue I'm still trying to figure out). When this happens the usb serial device moves from ttyUSB0 to ttyUSB1, so I then terminate my program and start it again on ttyUSB1. This is when open blocks forever. If I stop the program and open ttyUSB1 on minicom, then close minicom and open my program, then open works fine. Seems minicom sets or resets something on ttyUSB1? I'm not really sure.
Info:
Bus 003 Device 049: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port / Mobile Phone Data Cable
[580784.787037] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0
[580785.242982] usb 3-1: pl2303 converter now attached to ttyUSB1
How I'm opening the port:
let port_settings = |mut settings: Settings| {
settings.set_raw();
settings.set_baud_rate(9600)?;
settings.set_char_size(CharSize::Bits8);
settings.set_stop_bits(StopBits::One);
settings.set_parity(Parity::None);
settings.set_flow_control(FlowControl::None);
Ok(settings)
};
println!("port: {}", port);
let s = match SerialPort::open(port, port_settings) {
Ok(s) => s,
Err(err) => {
panic!("Error opening serial port: {}", err)
}
};
println!("serial port opened");
OS: latest raspberry pi OS (Debian GNU/Linux 12 (bookworm))
arch: aarch64
Hardware: raspberry pi 5 model B rev 1.0 8GB
Any advice appreciated, I can supply any other info you might want, to diagnose.
Thanks