fix: 补齐 ATX 控制器缺失接口并完成全项目 clippy -D warnings 修复

This commit is contained in:
mofeng-git
2026-02-10 21:37:33 +08:00
parent 72eb2c450d
commit 394baca938
64 changed files with 474 additions and 760 deletions

View File

@@ -36,6 +36,7 @@ const FLAG_MSD: u8 = 0b10;
/// HID device paths
#[derive(Debug, Clone)]
#[derive(Default)]
pub struct HidDevicePaths {
pub keyboard: Option<PathBuf>,
pub mouse_relative: Option<PathBuf>,
@@ -43,16 +44,6 @@ pub struct HidDevicePaths {
pub consumer: Option<PathBuf>,
}
impl Default for HidDevicePaths {
fn default() -> Self {
Self {
keyboard: None,
mouse_relative: None,
mouse_absolute: None,
consumer: None,
}
}
}
impl HidDevicePaths {
pub fn existing_paths(&self) -> Vec<PathBuf> {
@@ -239,14 +230,13 @@ impl OtgService {
let requested_functions = self.hid_functions.read().await.clone();
{
let state = self.state.read().await;
if state.hid_enabled {
if state.hid_functions.as_ref() == Some(&requested_functions) {
if state.hid_enabled
&& state.hid_functions.as_ref() == Some(&requested_functions) {
if let Some(ref paths) = state.hid_paths {
info!("HID already enabled, returning existing paths");
return Ok(paths.clone());
}
}
}
}
// Recreate gadget with both HID and MSD if needed
@@ -671,7 +661,7 @@ mod tests {
fn test_service_creation() {
let _service = OtgService::new();
// Just test that creation doesn't panic
assert!(!OtgService::is_available() || true); // Depends on environment
let _ = OtgService::is_available(); // Depends on environment
}
#[tokio::test]