[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230227020457.1048737-20-sashal@kernel.org>
Date: Sun, 26 Feb 2023 21:04:18 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: José Expósito <jose.exposito89@...il.com>,
Mia Kanashi <chad@...pilled.dev>,
Andreas Grosse <andig.mail@...nline.de>,
Jiri Kosina <jkosina@...e.cz>, Sasha Levin <sashal@...nel.org>,
jikos@...nel.org, benjamin.tissoires@...hat.com,
linux-input@...r.kernel.org
Subject: [PATCH AUTOSEL 6.1 20/58] HID: uclogic: Add battery quirk
From: José Expósito <jose.exposito89@...il.com>
[ Upstream commit f60c377f52de37f8705c5fc6d57737fdaf309ff9 ]
Some UGEE v2 tablets have a wireless version with an internal battery
and their firmware is able to report their battery level.
However, there was not found a field on their descriptor indicating
whether the tablet has battery or not, making it mandatory to classify
such devices through the UCLOGIC_BATTERY_QUIRK quirk.
Tested-by: Mia Kanashi <chad@...pilled.dev>
Tested-by: Andreas Grosse <andig.mail@...nline.de>
Signed-off-by: José Expósito <jose.exposito89@...il.com>
Signed-off-by: Jiri Kosina <jkosina@...e.cz>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/hid/hid-uclogic-params.c | 5 +++++
drivers/hid/hid-uclogic-params.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c
index e052538a62fb3..23624d5b07b5a 100644
--- a/drivers/hid/hid-uclogic-params.c
+++ b/drivers/hid/hid-uclogic-params.c
@@ -1222,6 +1222,11 @@ static int uclogic_params_ugee_v2_init_frame_mouse(struct uclogic_params *p)
*/
static bool uclogic_params_ugee_v2_has_battery(struct hid_device *hdev)
{
+ struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
+
+ if (drvdata->quirks & UCLOGIC_BATTERY_QUIRK)
+ return true;
+
/* The XP-PEN Deco LW vendor, product and version are identical to the
* Deco L. The only difference reported by their firmware is the product
* name. Add a quirk to support battery reporting on the wireless
diff --git a/drivers/hid/hid-uclogic-params.h b/drivers/hid/hid-uclogic-params.h
index 10a05c7fd9398..b0e7f3807939b 100644
--- a/drivers/hid/hid-uclogic-params.h
+++ b/drivers/hid/hid-uclogic-params.h
@@ -20,6 +20,7 @@
#include <linux/hid.h>
#define UCLOGIC_MOUSE_FRAME_QUIRK BIT(0)
+#define UCLOGIC_BATTERY_QUIRK BIT(1)
/* Types of pen in-range reporting */
enum uclogic_params_pen_inrange {
--
2.39.0
Powered by blists - more mailing lists