]> git.baikalelectronics.ru Git - kernel.git/commit
HID: input: do not report stylus battery state as "full"
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 29 Jun 2021 18:25:50 +0000 (11:25 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Sep 2021 10:26:22 +0000 (12:26 +0200)
commit32df8422af8864d2b250f474b278497cebe025d5
tree946931f806072bac7fa9142f22c5a99733fa632a
parent543660c5568b104ac91b1e78736196934789fd43
HID: input: do not report stylus battery state as "full"

[ Upstream commit f4abaa9eebde334045ed6ac4e564d050f1df3013 ]

The power supply states of discharging, charging, full, etc, represent
state of charging, not the capacity level of the battery (for which
we have a separate property). Current HID usage tables to not allow
for expressing charging state of the batteries found in generic
styli, so we should simply assume that the battery is discharging
even if current capacity is at 100% when battery strength reporting
is done via HID interface. In fact, we were doing just that before
commit a0a85d8d4c64.

This change helps UIs to not mis-represent fully charged batteries in
styli as being charging/topping-off.

Fixes: a0a85d8d4c64 ("HID: input: map digitizer battery usage")
Reported-by: Kenneth Albanowski <kenalba@google.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/hid-input.c