From f24a3bd441a79a5e7a283e1f09ca5b805f40a451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Wed, 24 Jul 2019 09:19:48 +0100 Subject: [PATCH] hidpp20: fix 0x1001 comments, add missing ASE and use get_unaligned_be_u16 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe LaĆ­ns --- src/hidpp20.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hidpp20.c b/src/hidpp20.c index 5a8c81b7..c97fb19e 100644 --- a/src/hidpp20.c +++ b/src/hidpp20.c @@ -432,10 +432,11 @@ hidpp20_batterylevel_get_battery_level(struct hidpp20_device *device, } /* -------------------------------------------------------------------------- */ -/* 0x1000: Battery level status */ +/* 0x1001: Battery voltage */ /* -------------------------------------------------------------------------- */ #define CMD_BATTERY_VOLTAGE_GET_BATTERY_VOLTAGE 0x00 +#define CMD_BATTERY_VOLTAGE_GET_SHOW_BATTERY_STATUS 0x10 int hidpp20_batteryvoltage_get_battery_voltage(struct hidpp20_device *device, @@ -460,7 +461,7 @@ hidpp20_batteryvoltage_get_battery_voltage(struct hidpp20_device *device, if (rc) return rc; - *voltage = (msg.msg.parameters[0] << 8) + msg.msg.parameters[1]; + *voltage = get_unaligned_be_u16(msg.msg.parameters); return msg.msg.parameters[2]; }