mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-09-13 11:04:25 +08:00
feat: 新增安卓平台支持
This commit is contained in:
@@ -25,13 +25,12 @@ pub use service::{HidDevicePaths, OtgService};
|
||||
|
||||
/// List USB Device Controller names exposed by sysfs.
|
||||
pub fn list_udc_devices() -> Vec<String> {
|
||||
let mut devices: Vec<String> = std::fs::read_dir("/sys/class/udc")
|
||||
.ok()
|
||||
.into_iter()
|
||||
.flat_map(|entries| entries.filter_map(|entry| entry.ok()))
|
||||
.filter_map(|entry| entry.file_name().to_str().map(str::to_owned))
|
||||
.collect();
|
||||
|
||||
devices.sort();
|
||||
devices
|
||||
#[cfg(unix)]
|
||||
{
|
||||
configfs::list_udcs()
|
||||
}
|
||||
#[cfg(not(unix))]
|
||||
{
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user