receiver: use Bolt unique ID as serial number

This commit is contained in:
Peter F. Patel-Schneider 2021-11-11 10:42:46 -05:00
parent 4bc3799e96
commit 5acc216e12
2 changed files with 20 additions and 16 deletions

View File

@ -123,6 +123,7 @@ REGISTERS = _NamedInts(
receiver_info=0x2B5, receiver_info=0x2B5,
bolt_device_discovery=0xC0, bolt_device_discovery=0xC0,
bolt_pairing=0x2C1, bolt_pairing=0x2C1,
bolt_uniqueId=0x02FB,
# only apply to devices # only apply to devices
mouse_button_flags=0x01, mouse_button_flags=0x01,

View File

@ -63,7 +63,10 @@ class Receiver:
# read the serial immediately, so we can find out max_devices # read the serial immediately, so we can find out max_devices
if self.receiver_kind == 'bolt': if self.receiver_kind == 'bolt':
serial_reply = None serial_reply = self.read_register(_R.bolt_uniqueId)
self.serial = _strhex(serial_reply)
self.max_devices = product_info.get('max_devices', 1)
self.may_unpair = product_info.get('may_unpair', False)
else: else:
serial_reply = self.read_register(_R.receiver_info, _IR.receiver_information) serial_reply = self.read_register(_R.receiver_info, _IR.receiver_information)
if serial_reply: if serial_reply: