From 266edd80f3404fe427924ca63f19911cfb67ddc1 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Fri, 3 May 2013 00:10:58 +0200 Subject: [PATCH] Process reg07 battery notification --- lib/logitech/unifying_receiver/status.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/logitech/unifying_receiver/status.py b/lib/logitech/unifying_receiver/status.py index 35176c31..fe73d105 100644 --- a/lib/logitech/unifying_receiver/status.py +++ b/lib/logitech/unifying_receiver/status.py @@ -126,6 +126,9 @@ class DeviceStatus(dict): __nonzero__ = __bool__ def set_battery_info(self, level, status, timestamp=None): + # TODO: this is also executed when pressing Fn+F7 on K800. + # Modify this such that alerts/writes are only done when the + # level/status actually changes. self[BATTERY_LEVEL] = level self[BATTERY_STATUS] = status error = None @@ -227,7 +230,9 @@ class DeviceStatus(dict): def _process_hidpp10_custom_notification(self, n): if n.sub_id == 0x07: - # TODO + # message layout: 10 ix 07("address") 00 00 + level, status = _hidpp10.parse_battery_reply(n.address, ord(n.data[:1])) + self.set_battery_info(level, status) return True if n.sub_id == 0x0D: