Skip to content

Commit e87571b

Browse files
moon-jamJohnAZoidberg
authored andcommitted
inputmodule-control: Ignore /dev/tty. on macOS
macOS has two instances of the serial console. /dev/tty.* and /dev/cu.*. The former we can't use. Right now it'll select the wrong one by default.
1 parent ad3a034 commit e87571b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

inputmodule-control/src/inputmodule.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ fn match_serialdevs(
9090
// Find all supported Framework devices
9191
for p in ports {
9292
if let SerialPortType::UsbPort(usbinfo) = &p.port_type {
93+
// macOS creates a /dev/cu.* and /dev/tty.* device.
94+
// The latter can only be used for reading, not writing, so we have to ignore it.
95+
#[cfg(target_os = "macos")]
96+
if !p.port_name.starts_with("/dev/tty.") {
97+
continue;
98+
}
9399
if usbinfo.vid == FRAMEWORK_VID && pids.contains(&usbinfo.pid) {
94100
compatible_devs.push(p.port_name.clone());
95101
}

0 commit comments

Comments
 (0)