Skip to content

Commit 644af04

Browse files
committed
fix: forward non-matching HID++ reports during command exchanges
_request() reads all incoming HID++ reports while waiting for a specific response, but previously discarded non-matching ones (e.g. diverted button state reports). This caused the held-state tracker for extra CIDs like 0x00C4 (SmartShift button) to get out of sync -- a button release during a set_smart_shift write would be swallowed, leaving held=True and requiring an extra press to re-sync. Forward non-matching reports to _on_report() so button DOWN/UP tracking stays correct during command exchanges. Also reset extra_diverts held states on disconnect so reconnects start clean.
1 parent 7a1cd26 commit 644af04

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

core/hid_gesture.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,9 @@ def _request(self, feat, func, params, timeout_ms=2000):
738738
expected_funcs = {func, (func + 1) & 0x0F}
739739
if r_feat == feat and r_sw == MY_SW and r_func in expected_funcs:
740740
return msg
741+
# Forward non-matching reports (e.g. diverted button events) so
742+
# button held-state tracking stays in sync during command exchanges.
743+
self._on_report(raw)
741744
print(f"[HidGesture] request timeout feat=0x{feat:02X} func=0x{func:X} "
742745
f"devIdx=0x{self._dev_idx:02X} params=[{_hex_bytes(req_params)}]")
743746
return None
@@ -1474,6 +1477,8 @@ def _main_loop(self):
14741477
self._pending_battery = None
14751478
self._last_logged_battery = None
14761479
self._held = False
1480+
for info in self._extra_diverts.values():
1481+
info["held"] = False
14771482
self._gesture_cid = DEFAULT_GESTURE_CID
14781483
self._gesture_candidates = list(DEFAULT_GESTURE_CIDS)
14791484
self._rawxy_enabled = False

0 commit comments

Comments
 (0)