receiver: rationalize receiver information structure
This commit is contained in:
parent
d1572b0c02
commit
51ec36fef4
|
@ -35,7 +35,6 @@ from .i18n import _
|
||||||
## should this last be changed so that may_unpair is used for all receivers? writing to _R.receiver_pairing doesn't seem right
|
## should this last be changed so that may_unpair is used for all receivers? writing to _R.receiver_pairing doesn't seem right
|
||||||
# re_pairs determines whether a receiver pairs by replacing existing pairings, default to False
|
# re_pairs determines whether a receiver pairs by replacing existing pairings, default to False
|
||||||
## currently only one receiver is so marked - should there be more?
|
## currently only one receiver is so marked - should there be more?
|
||||||
# ex100_27mhz_wpid_fix enable workarounds for EX100 and possible other old 27Mhz receivers
|
|
||||||
|
|
||||||
_DRIVER = ('hid-generic', 'generic-usb', 'logitech-djreceiver')
|
_DRIVER = ('hid-generic', 'generic-usb', 'logitech-djreceiver')
|
||||||
|
|
||||||
|
@ -135,8 +134,7 @@ _ex100_receiver = lambda product_id: {
|
||||||
'receiver_kind': '27Mhz',
|
'receiver_kind': '27Mhz',
|
||||||
'max_devices': 4,
|
'max_devices': 4,
|
||||||
'may_unpair': False,
|
'may_unpair': False,
|
||||||
're_pairs': True,
|
're_pairs': True
|
||||||
'ex100_27mhz_wpid_fix': True
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Receivers added here should also be listed in
|
# Receivers added here should also be listed in
|
||||||
|
|
|
@ -116,7 +116,7 @@ class Device:
|
||||||
# assert link_notification.address == (0x04 if unifying else 0x03)
|
# assert link_notification.address == (0x04 if unifying else 0x03)
|
||||||
kind = ord(link_notification.data[0:1]) & 0x0F
|
kind = ord(link_notification.data[0:1]) & 0x0F
|
||||||
# get 27Mhz wpid and set kind based on index
|
# get 27Mhz wpid and set kind based on index
|
||||||
if receiver.ex100_27mhz_wpid_fix: # 27 Mhz receiver
|
if receiver.receiver_kind == '27Mhz': # 27 Mhz receiver
|
||||||
self.wpid = '00' + _strhex(link_notification.data[2:3])
|
self.wpid = '00' + _strhex(link_notification.data[2:3])
|
||||||
kind = self.get_kind_from_index(number, receiver)
|
kind = self.get_kind_from_index(number, receiver)
|
||||||
self._kind = _hidpp10.DEVICE_KIND[kind]
|
self._kind = _hidpp10.DEVICE_KIND[kind]
|
||||||
|
|
|
@ -83,12 +83,11 @@ class Receiver:
|
||||||
self.may_unpair = product_info.get('may_unpair', False)
|
self.may_unpair = product_info.get('may_unpair', False)
|
||||||
self.last_id = self.last_id if self.last_id else self.max_devices
|
self.last_id = self.last_id if self.last_id else self.max_devices
|
||||||
|
|
||||||
self.name = product_info.get('name', '')
|
self.name = product_info.get('name', 'Receiver')
|
||||||
self.re_pairs = product_info.get('re_pairs', False)
|
self.re_pairs = product_info.get('re_pairs', False)
|
||||||
self._str = '<%s(%s,%s%s)>' % (
|
self._str = '<%s(%s,%s%s)>' % (
|
||||||
self.name.replace(' ', ''), self.path, '' if isinstance(self.handle, int) else 'T', self.handle
|
self.name.replace(' ', ''), self.path, '' if isinstance(self.handle, int) else 'T', self.handle
|
||||||
)
|
)
|
||||||
self.ex100_27mhz_wpid_fix = product_info.get('ex100_27mhz_wpid_fix', False)
|
|
||||||
|
|
||||||
self._firmware = None
|
self._firmware = None
|
||||||
self._devices = {}
|
self._devices = {}
|
||||||
|
@ -174,7 +173,7 @@ class Receiver:
|
||||||
wpid = _strhex(pair_info[3:5])
|
wpid = _strhex(pair_info[3:5])
|
||||||
kind = _hidpp10.DEVICE_KIND[ord(pair_info[7:8]) & 0x0F]
|
kind = _hidpp10.DEVICE_KIND[ord(pair_info[7:8]) & 0x0F]
|
||||||
polling_rate = ord(pair_info[2:3])
|
polling_rate = ord(pair_info[2:3])
|
||||||
elif self.ex100_27mhz_wpid_fix: # 27Mhz receiver, fill extracting WPID from udev path
|
elif self.receiver_kind == '27Mz': # 27Mhz receiver, fill extracting WPID from udev path
|
||||||
wpid = _hid.find_paired_node_wpid(self.path, n)
|
wpid = _hid.find_paired_node_wpid(self.path, n)
|
||||||
if not wpid:
|
if not wpid:
|
||||||
_log.error('Unable to get wpid from udev for device %d of %s', n, self)
|
_log.error('Unable to get wpid from udev for device %d of %s', n, self)
|
||||||
|
|
Loading…
Reference in New Issue