2026-04-23 07:00:06 -03:00
|
|
|
// USB gadget state, cycling, and host-enumeration recovery helpers.
|
2025-06-25 21:11:59 -05:00
|
|
|
use anyhow::{Context, Result};
|
2025-11-30 16:16:03 -03:00
|
|
|
use std::{
|
2026-01-08 23:58:19 -03:00
|
|
|
env,
|
2025-11-30 16:16:03 -03:00
|
|
|
fs::{self, OpenOptions},
|
|
|
|
|
io::Write,
|
|
|
|
|
path::Path,
|
2026-04-21 19:09:52 -03:00
|
|
|
process::Command,
|
2025-11-30 16:16:03 -03:00
|
|
|
thread,
|
|
|
|
|
time::Duration,
|
|
|
|
|
};
|
2026-04-21 19:09:52 -03:00
|
|
|
#[cfg(not(coverage))]
|
|
|
|
|
use tracing::warn;
|
|
|
|
|
use tracing::{info, trace};
|
2025-06-24 23:48:06 -05:00
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
|
pub struct UsbGadget {
|
|
|
|
|
udc_file: &'static str,
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-23 07:00:06 -03:00
|
|
|
include!("gadget/sysfs_state.rs");
|
|
|
|
|
include!("gadget/cycle_control.rs");
|
|
|
|
|
include!("gadget/driver_rebind.rs");
|
|
|
|
|
include!("gadget/enumeration_recovery.rs");
|