Skip to content

Commit

Permalink
inputmodule-control: Ignore /dev/tty. on macOS
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
moon-jam authored and JohnAZoidberg committed Oct 13, 2024
1 parent ad3a034 commit e87571b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions inputmodule-control/src/inputmodule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ fn match_serialdevs(
// Find all supported Framework devices
for p in ports {
if let SerialPortType::UsbPort(usbinfo) = &p.port_type {
// macOS creates a /dev/cu.* and /dev/tty.* device.
// The latter can only be used for reading, not writing, so we have to ignore it.
#[cfg(target_os = "macos")]
if !p.port_name.starts_with("/dev/tty.") {
continue;
}
if usbinfo.vid == FRAMEWORK_VID && pids.contains(&usbinfo.pid) {
compatible_devs.push(p.port_name.clone());
}
Expand Down

0 comments on commit e87571b

Please sign in to comment.