feat: 初步增加 Windows 支持

This commit is contained in:
mofeng-git
2026-05-18 22:43:28 +08:00
parent 0b9d94f53f
commit 935fa823f2
163 changed files with 11419 additions and 7581 deletions

View File

@@ -1,14 +1,37 @@
//! USB OTG composite gadget (HID + MSD).
#[cfg(unix)]
pub mod configfs;
pub mod endpoint;
#[cfg(unix)]
pub mod function;
#[cfg(unix)]
pub mod hid;
#[cfg(unix)]
pub mod manager;
#[cfg(unix)]
pub mod msd;
pub mod report_desc;
pub mod self_check;
#[cfg(unix)]
pub mod service;
#[cfg(unix)]
pub use manager::{wait_for_hid_devices, OtgGadgetManager};
#[cfg(unix)]
pub use msd::{MsdFunction, MsdLunConfig};
#[cfg(unix)]
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
}