From 172b37e5471da2520f0c5058dc258a5bac8fdec7 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Thu, 6 Oct 2022 18:54:00 +0800 Subject: [PATCH] fix: btn events should be handled in ps2_mouse --- drivers/ps2/ps2_mouse.c | 7 +++---- quantum/mousekey.c | 5 ----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index 66b48bb3c3d6..b32ad1e222d4 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -80,7 +80,7 @@ void ps2_mouse_task(void) { uint8_t rcv; rcv = ps2_host_send(PS2_MOUSE_READ_DATA); if (rcv == PS2_ACK) { - mouse_report.buttons = ps2_host_recv_response() | tp_buttons; + mouse_report.buttons = ps2_host_recv_response(); mouse_report.x = ps2_host_recv_response() * PS2_MOUSE_X_MULTIPLIER; mouse_report.y = ps2_host_recv_response() * PS2_MOUSE_Y_MULTIPLIER; # ifdef PS2_MOUSE_ENABLE_SCROLLING @@ -88,11 +88,10 @@ void ps2_mouse_task(void) { # endif } else { if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n"); - return; } #else if (pbuf_has_data()) { - mouse_report.buttons = ps2_host_recv_response() | tp_buttons; + mouse_report.buttons = ps2_host_recv_response(); mouse_report.x = ps2_host_recv_response() * PS2_MOUSE_X_MULTIPLIER; mouse_report.y = ps2_host_recv_response() * PS2_MOUSE_Y_MULTIPLIER; # ifdef PS2_MOUSE_ENABLE_SCROLLING @@ -100,10 +99,10 @@ void ps2_mouse_task(void) { # endif } else { if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n"); - return; } #endif + mouse_report.buttons |= tp_buttons; /* if mouse moves or buttons state changes */ if (mouse_report.x || mouse_report.y || mouse_report.v || ((mouse_report.buttons ^ buttons_prev) & PS2_MOUSE_BTN_MASK)) { #ifdef PS2_MOUSE_DEBUG_RAW diff --git a/quantum/mousekey.c b/quantum/mousekey.c index 2f514b9c47ec..25a89bdba7d6 100644 --- a/quantum/mousekey.c +++ b/quantum/mousekey.c @@ -502,10 +502,5 @@ report_mouse_t mousekey_get_report(void) { } bool should_mousekey_report_send(report_mouse_t *mouse_report) { - static char previous_buttons = 0; - if (previous_buttons != mouse_report->buttons) { - previous_buttons = mouse_report->buttons; - return true; - } return mouse_report->x || mouse_report->y || mouse_report->v || mouse_report->h; }