终于,键盘鼠标都成功了
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user