Skip to content

Commit d9f8f8b

Browse files
committed
Fix handling of serial ports on BSD systems
1 parent f447c4e commit d9f8f8b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

espflash/src/cli/serial.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,22 @@ fn find_serial_port(ports: &[SerialPortInfo], name: &str) -> Result<SerialPortIn
7777
#[cfg(not(target_os = "windows"))]
7878
let name = name.to_string_lossy();
7979

80+
// The case in device paths matters in BSD!
81+
#[cfg(any(
82+
target_os = "freebsd",
83+
target_os = "dragonfly",
84+
target_os = "openbsd",
85+
target_os = "netbsd"
86+
))]
87+
let port_info = ports.iter().find(|port| port.port_name == name);
88+
89+
// On Windows and other *nix systems, the case is not important.
90+
#[cfg(not(any(
91+
target_os = "freebsd",
92+
target_os = "dragonfly",
93+
target_os = "openbsd",
94+
target_os = "netbsd"
95+
)))]
8096
let port_info = ports
8197
.iter()
8298
.find(|port| port.port_name.eq_ignore_ascii_case(name.as_ref()));

0 commit comments

Comments
 (0)