Skip to content

Commit

Permalink
device: recover from errors in ping
Browse files Browse the repository at this point in the history
  • Loading branch information
pfps committed Feb 1, 2025
1 parent 90ab457 commit 722a3d7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/logitech_receiver/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,10 @@ def ping(self):
self.hidpp_long is None and (self.bluetooth or self._protocol is not None and self._protocol >= 2.0)
)
handle = self.handle or self.receiver.handle
protocol = self.low_level.ping(handle, self.number, long_message=long)
try:
protocol = self.low_level.ping(handle, self.number, long_message=long)
except exceptions.NoReceiver: # if ping fails, device is offline
protocol = None
self.online = protocol is not None
if protocol:
self._protocol = protocol
Expand Down

0 comments on commit 722a3d7

Please sign in to comment.