receiver: allow for unknown receivers
This commit is contained in:
parent
51ec36fef4
commit
2462d1aad7
|
@ -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
|
for record in _RECEIVER_USB_IDS: # known receivers
|
||||||
if match(record, bus_id, vendor_id, product_id):
|
if match(record, bus_id, vendor_id, product_id):
|
||||||
return record
|
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():
|
def receivers():
|
||||||
|
@ -120,9 +122,9 @@ def receivers():
|
||||||
|
|
||||||
def filter(bus_id, vendor_id, product_id, hidpp_short=False, hidpp_long=False):
|
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"""
|
"""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
|
record = filter_receivers(bus_id, vendor_id, product_id, hidpp_short, hidpp_long)
|
||||||
if match(record, bus_id, vendor_id, product_id):
|
if record: # known or unknown receiver
|
||||||
return record
|
return record
|
||||||
for record in _DEVICE_IDS: # known devices
|
for record in _DEVICE_IDS: # known devices
|
||||||
if match(record, bus_id, vendor_id, product_id):
|
if match(record, bus_id, vendor_id, product_id):
|
||||||
return record
|
return record
|
||||||
|
|
|
@ -58,7 +58,8 @@ class Receiver:
|
||||||
self.product_id = device_info.product_id
|
self.product_id = device_info.product_id
|
||||||
product_info = _product_information(self.product_id)
|
product_info = _product_information(self.product_id)
|
||||||
if not product_info:
|
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')
|
self.receiver_kind = product_info.get('receiver_kind', 'unknown')
|
||||||
|
|
||||||
# read the serial immediately, so we can find out max_devices
|
# read the serial immediately, so we can find out max_devices
|
||||||
|
|
Loading…
Reference in New Issue