mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-06-14 03:32:00 +08:00
feat: 初步增加 Windows 支持
This commit is contained in:
12
src/utils/serial.rs
Normal file
12
src/utils/serial.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
//! Cross-platform serial port discovery helpers.
|
||||
|
||||
/// Return serial port names that users can put directly into the config.
|
||||
pub fn list_serial_ports() -> Vec<String> {
|
||||
let mut ports: Vec<String> = serialport::available_ports()
|
||||
.map(|ports| ports.into_iter().map(|port| port.port_name).collect())
|
||||
.unwrap_or_default();
|
||||
|
||||
ports.sort();
|
||||
ports.dedup();
|
||||
ports
|
||||
}
|
||||
Reference in New Issue
Block a user