don't use notification flags with HID++ 2.0 devices
This commit is contained in:
parent
788fb145af
commit
83a29328c7
|
@ -177,6 +177,11 @@ def get_firmware(device):
|
||||||
|
|
||||||
|
|
||||||
def get_notification_flags(device):
|
def get_notification_flags(device):
|
||||||
|
if device.kind:
|
||||||
|
p = device.protocol
|
||||||
|
if p is None or p >= 2.0:
|
||||||
|
return
|
||||||
|
|
||||||
flags = device.request(0x8100)
|
flags = device.request(0x8100)
|
||||||
if flags is not None:
|
if flags is not None:
|
||||||
assert len(flags) == 3
|
assert len(flags) == 3
|
||||||
|
@ -184,6 +189,11 @@ def get_notification_flags(device):
|
||||||
|
|
||||||
|
|
||||||
def set_notification_flags(device, *flag_bits):
|
def set_notification_flags(device, *flag_bits):
|
||||||
|
if device.kind:
|
||||||
|
p = device.protocol
|
||||||
|
if p is None or p >= 2.0:
|
||||||
|
return
|
||||||
|
|
||||||
flag_bits = sum(int(b) for b in flag_bits)
|
flag_bits = sum(int(b) for b in flag_bits)
|
||||||
result = device.request(0x8000, 0xFF & (flag_bits >> 16), 0xFF & (flag_bits >> 8), 0xFF & flag_bits)
|
result = device.request(0x8000, 0xFF & (flag_bits >> 16), 0xFF & (flag_bits >> 8), 0xFF & flag_bits)
|
||||||
return result is not None
|
return result is not None
|
||||||
|
|
|
@ -129,7 +129,7 @@ class FeatureCallError(_KwException):
|
||||||
class FeaturesArray(object):
|
class FeaturesArray(object):
|
||||||
"""A sequence of features supported by a HID++ 2.0 device."""
|
"""A sequence of features supported by a HID++ 2.0 device."""
|
||||||
__slots__ = ('supported', 'device', 'features')
|
__slots__ = ('supported', 'device', 'features')
|
||||||
assert int(FEATURE.ROOT) == 0x0000
|
assert FEATURE.ROOT == 0x0000
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
assert device is not None
|
assert device is not None
|
||||||
|
|
|
@ -167,7 +167,7 @@ class PairedDevice(object):
|
||||||
def enable_notifications(self, enable=True):
|
def enable_notifications(self, enable=True):
|
||||||
"""Enable or disable device (dis)connection notifications on this
|
"""Enable or disable device (dis)connection notifications on this
|
||||||
receiver."""
|
receiver."""
|
||||||
if not self.receiver or not self.receiver.handle:
|
if not self.receiver or not self.receiver.handle or self.protocol >= 2.0:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if enable:
|
if enable:
|
||||||
|
|
Loading…
Reference in New Issue