From d1858f747bcb69d841e74bf698e61af901670391 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Thu, 24 Mar 2016 16:59:05 +0100 Subject: [PATCH] Assume 7 words for the DPI list response HID++ 2.0 responses are 20 bytes, once you strip the 4 byte common header and 1 byte sensorIdx, you have 15 bytes left. Since DPI values are 16-bit words, only 14 bytes should be used. --- lib/logitech_receiver/settings_templates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/logitech_receiver/settings_templates.py b/lib/logitech_receiver/settings_templates.py index 5aea9ec7..4123e7d1 100644 --- a/lib/logitech_receiver/settings_templates.py +++ b/lib/logitech_receiver/settings_templates.py @@ -172,7 +172,7 @@ def _feature_adjustable_dpi_choices(device): assert reply, 'Oops, DPI list cannot be retrieved!' dpi_list = [] step = None - for val in _unpack('!B7H', reply)[1:]: + for val in _unpack('!7H', reply[1:1+14]): if val == 0: break if val >> 13 == 0b111: