feat: 新增 Linux 绝对鼠标兼容模式 #266;新增 CH9329 描述符设置

This commit is contained in:
mofeng-git
2026-06-14 20:59:23 +08:00
parent da61644dbc
commit 5c98aea7e3
21 changed files with 1403 additions and 105 deletions

View File

@@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
use tokio::sync::watch;
use super::types::{ConsumerEvent, KeyboardEvent, MouseEvent};
use crate::config::{Ch9329DescriptorConfig, Ch9329DescriptorState};
use crate::error::Result;
use crate::events::LedState;
@@ -21,6 +22,8 @@ pub enum HidBackendType {
port: String,
#[serde(default = "default_ch9329_baud_rate")]
baud_rate: u32,
#[serde(default)]
hybrid_mouse: bool,
},
#[default]
None,
@@ -63,6 +66,21 @@ pub trait HidBackend: Send + Sync {
))
}
async fn apply_ch9329_descriptor(
&self,
_descriptor: &Ch9329DescriptorConfig,
) -> Result<Ch9329DescriptorState> {
Err(crate::error::AppError::BadRequest(
"CH9329 descriptor configuration is not supported by this backend".to_string(),
))
}
async fn read_ch9329_descriptor(&self) -> Result<Ch9329DescriptorState> {
Err(crate::error::AppError::BadRequest(
"CH9329 descriptor reading is not supported by this backend".to_string(),
))
}
async fn reset(&self) -> Result<()>;
async fn shutdown(&self) -> Result<()>;