Skip to content

Commit

Permalink
Merge pull request cb22#62 from roadrunner2/handle-rollover-overflow
Browse files Browse the repository at this point in the history
applespi: Handle key rollover overflow.
  • Loading branch information
cb22 authored Mar 14, 2018
2 parents c98c672 + 02ccb27 commit 0301500
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions applespi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,20 @@ static void applespi_handle_keyboard_event(struct applespi_data *applespi,
int i, j;
unsigned int key;
bool still_pressed;
bool is_overflow;

/* check for rollover overflow, which is signalled by all keys == 1 */
is_overflow = true;

for (i = 0; i < MAX_ROLLOVER; i++) {
if (keyboard_protocol->keys_pressed[i] != 1) {
is_overflow = false;
break;
}
}

if (is_overflow)
return;

/* check released keys */
for (i = 0; i < MAX_ROLLOVER; i++) {
Expand Down

0 comments on commit 0301500

Please sign in to comment.