From 4b4fc8fe1c33762ec51c36c7f0a55ecff6a460a0 Mon Sep 17 00:00:00 2001 From: dereckhall Date: Wed, 13 May 2026 18:43:11 -0400 Subject: [PATCH] fix: extend inactivity detection to all primary inputs Upstream only checks left stick X axis, so pressing buttons, using the d-pad, or moving the right stick won't prevent disconnection. Extends the same dead zone pattern to cover both sticks (all 4 axes), both button bytes, and d-pad/misc bytes. --- src/bt.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bt.cpp b/src/bt.cpp index f0b19c4..b4572b7 100644 --- a/src/bt.cpp +++ b/src/bt.cpp @@ -340,7 +340,13 @@ static void l2cap_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t if (get_config().disable_inactive_disconnect) { return; } - if (packet[3] < 120 || packet[3] > 140) { + if (packet[3] < 120 || packet[3] > 140 || + packet[4] < 120 || packet[4] > 140 || + packet[5] < 120 || packet[5] > 140 || + packet[6] < 120 || packet[6] > 140 || + packet[7] > 0 || packet[8] > 0 || + packet[10] != 0x08 || packet[11] != 0x00 || + packet[12] != 0x00) { inactive_time = get_absolute_time(); } else if (absolute_time_diff_us(inactive_time, get_absolute_time()) > static_cast(get_config().inactive_time) * 60 * 1000 * 1000) {