From: "José Expósito" <jose.exposito89@gmail.com>
To: jikos@kernel.org
Cc: benjamin.tissoires@redhat.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org,
"José Expósito" <jose.exposito89@gmail.com>,
"Mia Kanashi" <chad@redpilled.dev>,
"Andreas Grosse" <andig.mail@t-online.de>
Subject: [PATCH 2/6] HID: uclogic: Add battery quirk
Date: Mon, 26 Dec 2022 13:54:50 +0100 [thread overview]
Message-ID: <20221226125454.16106-3-jose.exposito89@gmail.com> (raw)
In-Reply-To: <20221226125454.16106-1-jose.exposito89@gmail.com>
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@redpilled.dev>
Tested-by: Andreas Grosse <andig.mail@t-online.de>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
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 2d46d4d50604..37cf4a93eafa 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 10a05c7fd939..b0e7f3807939 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.38.1
next prev parent reply other threads:[~2022-12-26 12:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-26 12:54 [PATCH 0/6] HID: uclogic: Add support for XP-PEN Deco PRO SW and MW José Expósito
2022-12-26 12:54 ` [PATCH 1/6] HID: uclogic: Add frame type quirk José Expósito
2022-12-26 12:54 ` José Expósito [this message]
2022-12-26 12:54 ` [PATCH 3/6] HID: uclogic: Refactor UGEEv2 probe magic data José Expósito
2022-12-26 12:54 ` [PATCH 4/6] HID: uclogic: Handle wireless device reconnection José Expósito
2022-12-26 12:54 ` [PATCH 5/6] HID: uclogic: Add support for XP-PEN Deco Pro SW José Expósito
2022-12-26 12:54 ` [PATCH 6/6] HID: uclogic: Add support for XP-PEN Deco Pro MW José Expósito
2023-01-18 8:46 ` [PATCH 0/6] HID: uclogic: Add support for XP-PEN Deco PRO SW and MW Jiri Kosina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221226125454.16106-3-jose.exposito89@gmail.com \
--to=jose.exposito89@gmail.com \
--cc=andig.mail@t-online.de \
--cc=benjamin.tissoires@redhat.com \
--cc=chad@redpilled.dev \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox