aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-apple.c
diff options
context:
space:
mode:
authorFilipe Laíns <lains@archlinux.org>2020-01-11 19:24:19 +0000
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>2020-01-28 15:51:19 +0100
commit4ab2bb3c311a45d80d31f2f189606871669ed792 (patch)
tree13ccddb2d36c666aa20c9e1dd22449907327ac8a /drivers/hid/hid-apple.c
parentMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid (diff)
downloadlinux-dev-4ab2bb3c311a45d80d31f2f189606871669ed792.tar.xz
linux-dev-4ab2bb3c311a45d80d31f2f189606871669ed792.zip
HID: logitech-hidpp: BatteryVoltage: only read chargeStatus if extPower is active
In the HID++ 2.0 function getBatteryInfo() from the BatteryVoltage (0x1001) feature, chargeStatus is only valid if extPower is active. Previously we were ignoring extPower, which resulted in wrong values. Example: With an unplugged mouse $ cat /sys/class/power_supply/hidpp_battery_0/status Charging This patch fixes that, it also renames charge_sts to flags as charge_sts can be confused with chargeStatus from the spec. Spec: +--------+-------------------------------------------------------------------------+ | byte | 2 | +--------+--------------+------------+------------+----------+----------+----------+ | bit | 0..2 | 3 | 4 | 5 | 6 | 7 | +--------+--------------+------------+------------+----------+----------+----------+ | buffer | chargeStatus | fastCharge | slowCharge | critical | (unused) | extPower | +--------+--------------+------------+------------+----------+----------+----------+ Table 1 - battery voltage (0x1001), getBatteryInfo() (ASE 0), 3rd byte +-------+--------------------------------------+ | value | meaning | +-------+--------------------------------------+ | 0 | Charging | +-------+--------------------------------------+ | 1 | End of charge (100% charged) | +-------+--------------------------------------+ | 2 | Charge stopped (any "normal" reason) | +-------+--------------------------------------+ | 7 | Hardware error | +-------+--------------------------------------+ Table 2 - chargeStatus value Signed-off-by: Filipe Laíns <lains@archlinux.org> Tested-by: Pedro Vanzella <pedro@pedrovanzella.com> Reviewed-by: Pedro Vanzella <pedro@pedrovanzella.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Diffstat (limited to 'drivers/hid/hid-apple.c')
0 files changed, 0 insertions, 0 deletions