mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-11-01 10:20:50 +08:00
feat(hid): 支持控制台鼠标抖动
在控制台鼠键配置菜单增加鼠标抖动开关和间隔设置,默认关闭,间隔支持 10–3600 秒。 设备端按键鼠空闲时间调度,支持配置持久化、热更新、真实输入打断和断连后重新计时。 兼容绝对及相对鼠标模式,按键或按钮按住期间暂停抖动。 验证:608 项 Rust 单测通过;暂存快照前端构建和浏览器交互测试通过;已完成 ARMv7 OpenWrt 部署验证。 Refs #316
This commit is contained in:
@@ -107,6 +107,7 @@ impl RuntimeBuilder {
|
||||
#[cfg(target_os = "linux")]
|
||||
hid.set_bond_store(config_store.hid_bonds());
|
||||
hid.set_event_bus(events.clone()).await;
|
||||
hid.configure_jiggler(&config.hid);
|
||||
hid.set_screen_resolution(video_resolution.width, video_resolution.height)
|
||||
.await;
|
||||
if let Err(error) = hid.init().await {
|
||||
|
||||
@@ -52,6 +52,8 @@ impl UsbCoordinator {
|
||||
|
||||
pub async fn apply_config(&self, old_config: &AppConfig, new_config: &AppConfig) -> Result<()> {
|
||||
new_config.hid.validate_platform()?;
|
||||
// Also runs for config-only updates and rollback; never forces a USB reload.
|
||||
self.hid.configure_jiggler(&new_config.hid);
|
||||
#[cfg(unix)]
|
||||
{
|
||||
let transitioning_away_from_otg = old_config.hid.backend == HidBackend::Otg
|
||||
@@ -318,6 +320,32 @@ fn hid_otg_config_changed(old: &HidConfig, new: &HidConfig) -> bool {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn jiggler_preferences_do_not_reload_hid_or_change_usb_descriptors() {
|
||||
let old = AppConfig::default();
|
||||
let mut new = old.clone();
|
||||
new.hid.jiggler.enabled = true;
|
||||
new.hid.jiggler.interval_secs = 120;
|
||||
assert!(!hid_requires_reload(&old.hid, &new.hid));
|
||||
#[cfg(unix)]
|
||||
assert_eq!(
|
||||
crate::otg::service::OtgDesiredState::from_config(
|
||||
&old.hid,
|
||||
&old.msd,
|
||||
&old.otg_network,
|
||||
&old.uac
|
||||
)
|
||||
.unwrap(),
|
||||
crate::otg::service::OtgDesiredState::from_config(
|
||||
&new.hid,
|
||||
&new.msd,
|
||||
&new.otg_network,
|
||||
&new.uac
|
||||
)
|
||||
.unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn composite_otg_preferences_do_not_reload_ch9329_but_input_changes_do() {
|
||||
let old = HidConfig {
|
||||
|
||||
Reference in New Issue
Block a user