feat: 添加了对串口协议的继电器的支持

This commit is contained in:
Fridayssheep
2026-02-11 13:06:05 +08:00
parent 7baf6fcf44
commit 21bea797e4
5 changed files with 150 additions and 3 deletions

View File

@@ -72,12 +72,15 @@ pub fn discover_devices() -> AtxDevices {
devices.gpio_chips.push(format!("/dev/{}", name_str));
} else if name_str.starts_with("hidraw") {
devices.usb_relays.push(format!("/dev/{}", name_str));
} else if name_str.starts_with("ttyUSB") || name_str.starts_with("ttyACM") {
devices.serial_ports.push(format!("/dev/{}", name_str));
}
}
}
devices.gpio_chips.sort();
devices.usb_relays.sort();
devices.serial_ports.sort();
devices
}
@@ -92,6 +95,7 @@ mod tests {
// Just verify the function runs without error
assert!(devices.gpio_chips.len() >= 0);
assert!(devices.usb_relays.len() >= 0);
assert!(devices.serial_ports.len() >= 0);
}
#[test]