aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/hid/wacom_sys.c
diff options
context:
space:
mode:
authorTatsunosuke Tobita <tatsunosuke.wacom@gmail.com>2023-11-15 08:57:29 +0900
committerBenjamin Tissoires <bentiss@kernel.org>2023-11-29 16:13:21 +0100
commitfd2a9b29dc9c4c35def91d5d1c5b470843539de6 (patch)
treef8df254bbcd2a50f2b11937c20bab22e7586685d /drivers/hid/wacom_sys.c
parentMerge tag 'for-linus-2023112301' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid (diff)
downloadwireguard-linux-fd2a9b29dc9c4c35def91d5d1c5b470843539de6.tar.xz
wireguard-linux-fd2a9b29dc9c4c35def91d5d1c5b470843539de6.zip
HID: wacom: Remove AES power_supply after extended inactivity
Even if a user does not use their AES pen for an extended period, the battery power supply attributes continue to exist. This results in the desktop showing battery status for a pen that is no longer in use and which may in fact be in a different state (e.g. the user may be charging the pen). To avoid confusion and ensure userspace has an accurate view of the battery state, this patch automatically removes the power_supply after 30 minutes of inactivity. Signed-off-by: Tatsunosuke Tobita <tatsunosuke.tobita@wacom.com> Reviewed-by: Jason Gerecke <Jason.Gerecke@wacom.com> Reviewed-by: Aaron Skomra <aaron.skomra@wacom.com> Reviewed-by: Josh Dickens <joshua.dickens@wacom.com> Link: https://lore.kernel.org/r/20231114235729.6867-1-tatsunosuke.wacom@gmail.com Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Diffstat (limited to 'drivers/hid/wacom_sys.c')
-rw-r--r--drivers/hid/wacom_sys.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 3f704b8072e8..b613f11ed949 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -1813,6 +1813,13 @@ static void wacom_destroy_battery(struct wacom *wacom)
}
}
+static void wacom_aes_battery_handler(struct work_struct *work)
+{
+ struct wacom *wacom = container_of(work, struct wacom, aes_battery_work.work);
+
+ wacom_destroy_battery(wacom);
+}
+
static ssize_t wacom_show_speed(struct device *dev,
struct device_attribute
*attr, char *buf)
@@ -2794,6 +2801,7 @@ static int wacom_probe(struct hid_device *hdev,
mutex_init(&wacom->lock);
INIT_DELAYED_WORK(&wacom->init_work, wacom_init_work);
+ INIT_DELAYED_WORK(&wacom->aes_battery_work, wacom_aes_battery_handler);
INIT_WORK(&wacom->wireless_work, wacom_wireless_work);
INIT_WORK(&wacom->battery_work, wacom_battery_work);
INIT_WORK(&wacom->remote_work, wacom_remote_work);