Skip to content

Commit 78b8e29

Browse files
authored
Merge pull request #415 from FrameworkComputer/hx20.ps2_drop_movement_during_setup
drop ps2 movement packets during host commands
2 parents 6e38e82 + 9ca3510 commit 78b8e29

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

board/hx20/ps2mouse.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ void send_movement_packet(void)
5656
int max = 3;
5757
int timeout = 0;
5858

59-
6059
if (five_button_mode)
6160
max = 4;
6261
/* sometimes the host will get behind */
63-
while (aux_buffer_available() < max && timeout++ < 25)
62+
while (aux_buffer_available() < max && timeout++ < 25 &&
63+
(*task_get_event_bitmap(emumouse_task_id) & PS2MOUSE_EVT_AUX_DATA) == 0) {
6464
usleep(10*MSEC);
65+
}
6566

66-
if (timeout == 25) {
67+
if (timeout == 25 || (*task_get_event_bitmap(emumouse_task_id) & PS2MOUSE_EVT_AUX_DATA)) {
6768
CPRINTS("PS2M Dropping");
6869
/*drop mouse packet - host is too far behind */
6970
return;
@@ -431,9 +432,7 @@ void mouse_interrupt_handler_task(void *p)
431432
if (ec_mode_disabled == false) {
432433
if (evt & PS2MOUSE_EVT_AUX_DATA) {
433434
process_request(aux_data);
434-
}
435-
436-
if (evt & PS2MOUSE_EVT_INTERRUPT) {
435+
} else if (evt & PS2MOUSE_EVT_INTERRUPT) {
437436
usleep(4*MSEC);
438437
/* at the expensive of a slight additional latency
439438
* check to see if the soc has grabbed this out from under us

0 commit comments

Comments
 (0)