终于,键盘鼠标都成功了

This commit is contained in:
zqm
2026-04-09 14:21:34 +08:00
parent aae527258a
commit 64a42bebbc
26 changed files with 7491 additions and 5659 deletions

View File

@@ -161,14 +161,24 @@ fn send_random_key() {
/// 发送随机鼠标移动事件
fn send_random_mouse_move() {
// 生成随机的鼠标移动距离 (-10 到 10 之间)
let random_x = (get_random_u32() % 21) as i8 - 10;
let random_y = (get_random_u32() % 21) as i8 - 10;
// 检查 USB 是否仍然挂载
let mounted = unsafe {
rust_is_usb_mounted()
};
if !mounted {
log_info("USB not mounted, skipping mouse move\0");
return;
}
// 生成随机的鼠标移动距离 (-50 到 50 之间,增加移动幅度)
let random_x = (get_random_u32() % 101) as i8 - 50;
let random_y = (get_random_u32() % 101) as i8 - 50;
// 发送鼠标移动事件
log_info("Sending mouse move event\0");
unsafe {
rust_send_mouse_report(REPORT_ID_MOUSE, 0, random_x, random_y, 0, 0);
rust_send_mouse_report(0, 0, random_x, random_y, 0, 0);
}
}