From c02a1b820bf727ff82fa28fe7d7f17a9c22537a4 Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Wed, 25 Aug 2021 13:40:50 -0400 Subject: [PATCH] device: pass protocol to base request so that SW ID can be done right --- lib/logitech_receiver/base.py | 4 ++-- lib/logitech_receiver/device.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/logitech_receiver/base.py b/lib/logitech_receiver/base.py index 53802cde..b7e7527b 100644 --- a/lib/logitech_receiver/base.py +++ b/lib/logitech_receiver/base.py @@ -381,7 +381,7 @@ def acquire_timeout(lock, handle, timeout): # a very few requests (e.g., host switching) do not expect a reply, but use no_reply=True with extreme caution -def request(handle, devnumber, request_id, *params, no_reply=False, return_error=False, long_message=False): +def request(handle, devnumber, request_id, *params, no_reply=False, return_error=False, long_message=False, protocol=1.0): """Makes a feature call to a device and waits for a matching reply. :param handle: an open UR handle. :param devnumber: attached device number. @@ -395,7 +395,7 @@ def request(handle, devnumber, request_id, *params, no_reply=False, return_error with acquire_timeout(handle_lock(handle), handle, 10.): assert isinstance(request_id, int) - if devnumber != 0xFF and request_id < 0x8000: + if (devnumber != 0xFF or protocol >= 2.0) and request_id < 0x8000: # For HID++ 2.0 feature requests, randomize the SoftwareId to make it # easier to recognize the reply for this request. also, always set the # most significant bit (8) in SoftwareId, to make notifications easier diff --git a/lib/logitech_receiver/device.py b/lib/logitech_receiver/device.py index 754c7877..3c345aad 100644 --- a/lib/logitech_receiver/device.py +++ b/lib/logitech_receiver/device.py @@ -433,7 +433,6 @@ class Device(object): return None def request(self, request_id, *params, no_reply=False): - if self: return _base.request( self.handle or self.receiver.handle, @@ -441,7 +440,8 @@ class Device(object): request_id, *params, no_reply=no_reply, - long_message=self.bluetooth or self.protocol >= 2.0 + long_message=self.bluetooth or self.protocol >= 2.0, + protocol=self.protocol ) def feature_request(self, feature, function=0x00, *params, no_reply=False):