device: convert HID++ 2.0 device kinds to enhanced HID++ 1.0 kinds

This commit is contained in:
Peter F. Patel-Schneider 2021-06-04 08:09:12 -04:00
parent 5aedbad692
commit 67dbe5f4c8
2 changed files with 14 additions and 2 deletions

View File

@ -23,6 +23,8 @@ del getLogger
_R = _hidpp10.REGISTERS
_IR = _hidpp10.INFO_SUBREGISTERS
KIND_MAP = {kind: _hidpp10.DEVICE_KIND[str(kind)] for kind in _hidpp20.DEVICE_KIND}
#
#
#
@ -256,7 +258,7 @@ class Device(object):
kind = ord(pair_info[7:8]) & 0x0F
self._kind = _hidpp10.DEVICE_KIND[kind]
elif self.online and self.protocol >= 2.0:
self._kind = _hidpp20.get_kind(self)
self._kind = KIND_MAP[_hidpp20.get_kind(self)]
return self._kind or '?'
@property

View File

@ -37,7 +37,17 @@ del getLogger
# documentation, some of them guessed.
#
DEVICE_KIND = _NamedInts(keyboard=0x01, mouse=0x02, numpad=0x03, presenter=0x04, remote=0x07, trackball=0x08, touchpad=0x09)
DEVICE_KIND = _NamedInts(
keyboard=0x01,
mouse=0x02,
numpad=0x03,
presenter=0x04,
remote=0x07,
trackball=0x08,
touchpad=0x09,
remote_control=0x0E, # for compatability with HID++ 2.0
receiver=0x0F # for compatability with HID++ 2.0
)
POWER_SWITCH_LOCATION = _NamedInts(
base=0x01,