diff --git a/Upstream/Src/upstream_hid_botdetect.c b/Upstream/Src/upstream_hid_botdetect.c index 222362e..cc06c5f 100644 --- a/Upstream/Src/upstream_hid_botdetect.c +++ b/Upstream/Src/upstream_hid_botdetect.c @@ -19,9 +19,9 @@ //Variables common between keyboard and mouse bot detection: -uint32_t TemporaryLockoutTimeMs; volatile LockoutStateTypeDef LockoutState = LOCKOUT_STATE_INACTIVE; - +uint32_t TemporaryLockoutTimeMs; +uint8_t TemporaryLockoutCount = 0; //Variables specific to keyboard bot detection: @@ -201,6 +201,14 @@ static void Upstream_HID_BotDetectKeyboard_DoLockout(void) return; } + //Three (temporary) strikes -> you're out! + if (++TemporaryLockoutCount >= 3) + { + LockoutState = LOCKOUT_STATE_PERMANENT_ACTIVE; + LED_SetState(LED_STATUS_FLASH_BOTDETECT); + return; + } + //Otherwise, reset counters and give warning for (i = 0; i < KEYBOARD_BOTDETECT_FAST_BIN_COUNT; i++) { @@ -572,6 +580,14 @@ static void Upstream_HID_BotDetectMouse_DoLockout(void) return; } + //Three (temporary) strikes -> you're out! + if (++TemporaryLockoutCount >= 3) + { + LockoutState = LOCKOUT_STATE_PERMANENT_ACTIVE; + LED_SetState(LED_STATUS_FLASH_BOTDETECT); + return; + } + //Otherwise, reset counters and give warning for (i = 0; i < MOUSE_BOTDETECT_VELOCITY_HISTORY_SIZE; i++) {