receiver: allow for unknown receivers

This commit is contained in:
Peter F. Patel-Schneider 2022-10-11 09:03:36 -04:00
parent 51ec36fef4
commit 2462d1aad7
2 changed files with 7 additions and 4 deletions

View File

@ -111,6 +111,8 @@ def filter_receivers(bus_id, vendor_id, product_id, hidpp_short=False, hidpp_lon
for record in _RECEIVER_USB_IDS: # known receivers
if match(record, bus_id, vendor_id, product_id):
return record
if vendor_id == 0x046D and 0xC500 <= product_id <= 0xC5FF: # unknown receiver
return {'vendor_id': vendor_id, 'product_id': product_id, 'bus_id': bus_id, 'isDevice': False}
def receivers():
@ -120,8 +122,8 @@ def receivers():
def filter(bus_id, vendor_id, product_id, hidpp_short=False, hidpp_long=False):
"""Check that this product is of interest and if so return the device record for further checking"""
for record in _RECEIVER_USB_IDS: # known receivers
if match(record, bus_id, vendor_id, product_id):
record = filter_receivers(bus_id, vendor_id, product_id, hidpp_short, hidpp_long)
if record: # known or unknown receiver
return record
for record in _DEVICE_IDS: # known devices
if match(record, bus_id, vendor_id, product_id):

View File

@ -58,7 +58,8 @@ class Receiver:
self.product_id = device_info.product_id
product_info = _product_information(self.product_id)
if not product_info:
raise Exception('Unknown receiver type', self.product_id)
_log.warning('Unknown receiver type: %s', self.product_id)
product_info = {}
self.receiver_kind = product_info.get('receiver_kind', 'unknown')
# read the serial immediately, so we can find out max_devices