From 6b1e8f8a99670859889f272bad47420a19f35829 Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Thu, 13 Oct 2022 07:26:20 -0400 Subject: [PATCH] device: fix processing of HID++ 1.0 battery reports --- lib/logitech_receiver/hidpp10.py | 2 +- lib/logitech_receiver/notifications.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/logitech_receiver/hidpp10.py b/lib/logitech_receiver/hidpp10.py index e351331d..0818ef16 100644 --- a/lib/logitech_receiver/hidpp10.py +++ b/lib/logitech_receiver/hidpp10.py @@ -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]) diff --git a/lib/logitech_receiver/notifications.py b/lib/logitech_receiver/notifications.py index b746406b..5eee0780 100644 --- a/lib/logitech_receiver/notifications.py +++ b/lib/logitech_receiver/notifications.py @@ -234,8 +234,8 @@ def _process_hidpp10_custom_notification(device, status, n): # message layout: 10 ix <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: