fixed parsing of custom battery messages

This commit is contained in:
Daniel Pavel 2013-07-07 12:23:23 +02:00
parent 0d89d1e6c8
commit 66416ff4cc
1 changed files with 2 additions and 2 deletions

View File

@ -100,9 +100,9 @@ def _process_hidpp10_custom_notification(device, status, n):
_log.debug("%s (%s) custom notification %s", device, device.protocol, n)
if n.sub_id in (_R.battery_status, _R.battery_charge):
assert n.data[-1:] == b'\x00'
# message layout: 10 ix <register> <xx> <yy> <zz> <00>
data = '%c%s' % (n.address, n.data)
assert n.data[-1:] == b'\x00'
data = chr(n.address).encode() + n.data
charge, status_text = _hidpp10.parse_battery_status(n.sub_id, data)
status.set_battery_info(charge, status_text)
return True