From 0cf1f1983d54807fbde964d89b2dccf199b07374 Mon Sep 17 00:00:00 2001 From: Daniel Pavel Date: Wed, 26 Jun 2013 13:38:36 +0200 Subject: [PATCH] handle backlight notifications from register 0x17 --- lib/logitech/unifying_receiver/base.py | 3 +++ lib/logitech/unifying_receiver/status.py | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/lib/logitech/unifying_receiver/base.py b/lib/logitech/unifying_receiver/base.py index e56242cb..6a0b7c50 100644 --- a/lib/logitech/unifying_receiver/base.py +++ b/lib/logitech/unifying_receiver/base.py @@ -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) ): diff --git a/lib/logitech/unifying_receiver/status.py b/lib/logitech/unifying_receiver/status.py index ce3577aa..8cd73dfc 100644 --- a/lib/logitech/unifying_receiver/status.py +++ b/lib/logitech/unifying_receiver/status.py @@ -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") + # 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):