diff --git a/lib/logitech_receiver/device.py b/lib/logitech_receiver/device.py index 4820ac1e..e5edcfeb 100644 --- a/lib/logitech_receiver/device.py +++ b/lib/logitech_receiver/device.py @@ -119,13 +119,14 @@ class Device: kind = self.get_kind_from_index(number, receiver) self._kind = _hidpp10.DEVICE_KIND[kind] else: - # Not a notification, force a reading of the wpid + # Not a notification, force a reading of pairing information self.online = True self.update_pairing_information() + self.update_extended_pairing_information() + if not self.wpid and not self._serial: # if neither then the device almost certainly wasn't found + raise _base.NoSuchDevice(number=number, receiver=receiver, error='no wpid or serial') - # the wpid is necessary to properly identify wireless link on/off - # notifications also it gets set to None on this object when the - # device is unpaired + # the wpid is set to None on this object when the device is unpaired assert self.wpid is not None, 'failed to read wpid: device %d of %s' % (number, receiver) self.descriptor = _descriptors.get_wpid(self.wpid) diff --git a/lib/logitech_receiver/receiver.py b/lib/logitech_receiver/receiver.py index 39951872..2133135f 100644 --- a/lib/logitech_receiver/receiver.py +++ b/lib/logitech_receiver/receiver.py @@ -193,6 +193,7 @@ class Receiver: return wpid, kind, polling_rate def device_extended_pairing_information(self, n): + serial = None power_switch = '(unknown)' if self.receiver_kind == 'bolt': pair_info = self.read_register(_R.receiver_info, _IR.bolt_pairing_information + n) @@ -208,8 +209,6 @@ class Receiver: pair_info = self.read_register(0x2D5) if pair_info: serial = _strhex(pair_info[1:5]) - else: # fallback... - serial = self.serial return serial, power_switch def get_kind_from_index(self, index):