summaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2021-06-29 11:25:50 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-09-22 11:48:01 +0200
commit9076623badf1dba7a45743bad393ede47ca3f72e (patch)
tree55521562f369c0e32d935a0ce910bfff854b5fb3 /drivers/hid
parentb04b4e98bb7563fb64e5b5161f935a5a3b0c79be (diff)
downloadlinux-stable-9076623badf1dba7a45743bad393ede47ca3f72e.tar.gz
linux-stable-9076623badf1dba7a45743bad393ede47ca3f72e.tar.bz2
linux-stable-9076623badf1dba7a45743bad393ede47ca3f72e.zip
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 581c4484769e. This change helps UIs to not mis-represent fully charged batteries in styli as being charging/topping-off. Fixes: 581c4484769e ("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>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-input.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 4dd151b2924e..d56ef395eb69 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -427,8 +427,6 @@ static int hidinput_get_battery_property(struct power_supply *psy,
if (dev->battery_status == HID_BATTERY_UNKNOWN)
val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
- else if (dev->battery_capacity == 100)
- val->intval = POWER_SUPPLY_STATUS_FULL;
else
val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
break;