Skip to content

Commit

Permalink
device: improve determination of short or long messages
Browse files Browse the repository at this point in the history
  • Loading branch information
pfps committed Sep 14, 2023
1 parent 12f9c01 commit ec54b1b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/logitech_receiver/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,13 +429,16 @@ def handle_notification(self, n) -> Optional[bool]:

def request(self, request_id, *params, no_reply=False):
if self:
long = self.hidpp_long is True or (
self.hidpp_long is None and (self.bluetooth or self._protocol is not None and self._protocol >= 2.0)
)
return _base.request(
self.handle or self.receiver.handle,
self.number,
request_id,
*params,
no_reply=no_reply,
long_message=self.bluetooth or self.hidpp_short is False or self.protocol >= 2.0,
long_message=long,
protocol=self.protocol
)

Expand All @@ -445,7 +448,10 @@ def feature_request(self, feature, function=0x00, *params, no_reply=False):

def ping(self):
"""Checks if the device is online, returns True of False"""
long = self.bluetooth or self.hidpp_short is False or self._protocol is not None and self._protocol >= 2.0
# long = self.bluetooth or self.hidpp_short is False or self._protocol is not None and self._protocol >= 2.0
long = self.hidpp_long is True or (
self.hidpp_long is None and (self.bluetooth or self._protocol is not None and self._protocol >= 2.0)
)
protocol = _base.ping(self.handle or self.receiver.handle, self.number, long_message=long)
self.online = protocol is not None
if protocol:
Expand Down

0 comments on commit ec54b1b

Please sign in to comment.