diff --git a/lib/logitech_receiver/base_usb.py b/lib/logitech_receiver/base_usb.py index 6e94b7f9..2ac0201f 100644 --- a/lib/logitech_receiver/base_usb.py +++ b/lib/logitech_receiver/base_usb.py @@ -56,7 +56,8 @@ _unifying_receiver = lambda product_id: { 'usb_interface': 2, 'hid_driver': _DRIVER, # noqa: F821 'name': _('Unifying Receiver'), - 'receiver_kind': 'unifying' + 'receiver_kind': 'unifying', + 'may_unpair': True } _nano_receiver = lambda product_id: { @@ -112,7 +113,8 @@ _lenovo_receiver = lambda product_id: { 'usb_interface': 1, 'hid_driver': _DRIVER, # noqa: F821 'name': _('Nano Receiver'), - 'receiver_kind': 'nano' + 'receiver_kind': 'nano', + 'may_unpair': False } _lightspeed_receiver = lambda product_id: { @@ -120,7 +122,8 @@ _lightspeed_receiver = lambda product_id: { 'product_id': product_id, 'usb_interface': 2, 'hid_driver': _DRIVER, # noqa: F821 - 'name': _('Lightspeed Receiver') + 'name': _('Lightspeed Receiver'), + 'may_unpair': False } _ex100_receiver = lambda product_id: { diff --git a/lib/logitech_receiver/receiver.py b/lib/logitech_receiver/receiver.py index 2133135f..f0df4353 100644 --- a/lib/logitech_receiver/receiver.py +++ b/lib/logitech_receiver/receiver.py @@ -76,12 +76,7 @@ class Receiver: self.last_id = ord(serial_reply[7:8]) if self.max_devices <= 0 or self.max_devices > 6: self.max_devices = product_info.get('max_devices', 1) - # TODO _properly_ figure out which receivers do and which don't support unpairing - # This code supposes that receivers that don't unpair support a pairing request for device index 0 - if 'unpair' in product_info: - self.may_unpair = product_info['unpair'] - else: - self.may_unpair = self.write_register(_R.receiver_pairing) is None + self.may_unpair = product_info.get('may_unpair', False) else: # handle receivers that don't have a serial number specially (i.e., c534 and Bolt receivers) self.serial = None self.max_devices = product_info.get('max_devices', 1)