device: fix processing of HID++ 1.0 battery reports

This commit is contained in:
Peter F. Patel-Schneider 2022-10-13 07:26:20 -04:00
parent 130aa20bb1
commit 6b1e8f8a99
2 changed files with 3 additions and 3 deletions

View File

@ -237,7 +237,7 @@ def parse_battery_status(register, reply):
BATTERY_STATUS.discharging if status_byte == 0x30 else
BATTERY_STATUS.recharging if status_byte == 0x50 else BATTERY_STATUS.full if status_byte == 0x90 else None
)
return charge, status_text, None
return charge, None, status_text, None
if register == REGISTERS.battery_status:
status_byte = ord(reply[:1])

View File

@ -234,8 +234,8 @@ def _process_hidpp10_custom_notification(device, status, n):
# message layout: 10 ix <register> <xx> <yy> <zz> <00>
assert n.data[-1:] == b'\x00'
data = chr(n.address).encode() + n.data
charge, status_text, next_charge = _hidpp10.parse_battery_status(n.sub_id, data)
status.set_battery_info(charge, next_charge, status_text, None)
charge, next_charge, status_text, voltage = _hidpp10.parse_battery_status(n.sub_id, data)
status.set_battery_info(charge, next_charge, status_text, voltage)
return True
if n.sub_id == _R.keyboard_illumination: