handle backlight notifications from register 0x17

This commit is contained in:
Daniel Pavel 2013-06-26 13:38:36 +02:00
parent 39ec568ab1
commit 0cf1f1983d
2 changed files with 11 additions and 0 deletions

View File

@ -277,6 +277,9 @@ def make_notification(devnumber, data):
# custom HID++1.0 battery events, where SubId is 0x07/0x0D
(sub_id in (0x07, 0x0D) and len(data) == 5 and data[4:5] == b'\x00')
or
# custom HID++1.0 illumination event, where SubId is 0x17
(sub_id == 0x17 and len(data) == 5)
or
# HID++ 2.0 feature notifications have the SoftwareID 0
(address & 0x0F == 0x00)
):

View File

@ -308,6 +308,8 @@ class DeviceStatus(dict):
# however, this has not been fully verified yet
if n.sub_id in (0x07, 0x0D) and len(n.data) == 3 and n.data[2:3] == b'\x00':
return self._process_hidpp10_custom_notification(n)
if n.sub_id == 0x17 and len(n.data) == 3:
return self._process_hidpp10_custom_notification(n)
else:
# assuming 0x00 to 0x3F are feature (HID++ 2.0) notifications
try:
@ -334,6 +336,12 @@ class DeviceStatus(dict):
self.set_battery_info(level, status)
return True
if n.sub_id == 0x17:
# message layout: 10 ix 17("address") <??> <?> <??> <light level 1=off..5=max>
# TODO anything we can do with this?
_log.info("backlight event: %s", n)
return True
_log.warn("%s: unrecognized %s", self._device, n)
def _process_hidpp10_notification(self, n):