Skip to content

Commit 9ca3510

Browse files
committed
drop ps2 movement packets during host commands
We were running into an issue where during boot the host would probe the ps2 mouse with magic knock. But the ps2 mouse would be sending movement packets with a full buffer which would confuse the probe due to returning movement packet data mixed with host response data. This caused windows driver to not detect a valid ps2 mouse if the user was moving their finger on the touchpad during boot. This normally only impacts OS's where there is no PCH i2c driver present and we fallback to ps2 emulation. Such as windows setup. Signed-off-by: Kieran Levin <[email protected]>
1 parent 369d3c3 commit 9ca3510

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)