mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-06-14 03:32:00 +08:00
13 lines
389 B
Rust
13 lines
389 B
Rust
//! 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
|
|
}
|