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.
This commit is contained in:
Peter Wu 2013-05-22 00:10:17 +02:00
parent 2f8e330b73
commit 9c0dac044c
1 changed files with 3 additions and 2 deletions

View File

@ -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