From 9c0dac044cce4b5262cf7768394062dc714c6c40 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Wed, 22 May 2013 00:10:17 +0200 Subject: [PATCH] hid10: update 07 battery parsing based on spec This fixes pwr/Solaar#49 partially, at least the charging state will be reported correctly hereafter. The charge level may still be incorrect though. --- lib/logitech/unifying_receiver/hidpp10.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/logitech/unifying_receiver/hidpp10.py b/lib/logitech/unifying_receiver/hidpp10.py index 1cc9842c..6b5dba91 100644 --- a/lib/logitech/unifying_receiver/hidpp10.py +++ b/lib/logitech/unifying_receiver/hidpp10.py @@ -132,9 +132,10 @@ def parse_battery_reply_07(level, battery_status): else 20 if level == 3 # low else 5 if level == 1 # critical else 0 ) # wtf? - status = ('charging' if battery_status == 0x25 + status = ('charging' if battery_status == 0x21 or battery_status == 0x25 else 'fully charged' if battery_status == 0x22 - else 'discharging') + else 'discharging' if battery_status == 0x00 + else None) return charge, status