mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mia Kanashi <chad@redpilled.dev>
To: "José Expósito" <jose.exposito89@gmail.com>, jikos@kernel.org
Cc: benjamin.tissoires@redhat.com, spbnick@gmail.com,
	pobrn@protonmail.com, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] HID: input: do not query XP-PEN Deco LW battery
Date: Sat, 29 Oct 2022 20:34:46 +0300	[thread overview]
Message-ID: <1701DB3A-5538-4B58-8232-E6705B9C70DF@redpilled.dev> (raw)
In-Reply-To: <20221029161240.15548-2-jose.exposito89@gmail.com>

On 29 October 2022 19:12:39 EEST, "José Expósito" <jose.exposito89@gmail.com> wrote:
>The XP-PEN Deco LW drawing tablet can be connected by USB cable or using
>a USB Bluetooth dongle. When it is connected using the dongle, there
>might be a small delay until the tablet is paired with the dongle.
>
>Fetching the device battery during this delay results in random battery
>percentage values.
>
>Add a quirk to avoid actively querying the battery percentage and wait
>for the device to report it on its own.
>
>Reported-by: Mia Kanashi <chad@redpilled.dev>
>Signed-off-by: José Expósito <jose.exposito89@gmail.com>
>---
> drivers/hid/hid-input.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
>diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
>index 859aeb07542e..d728a94c642e 100644
>--- a/drivers/hid/hid-input.c
>+++ b/drivers/hid/hid-input.c
>@@ -340,6 +340,7 @@ static enum power_supply_property hidinput_battery_props[] = {
> #define HID_BATTERY_QUIRK_PERCENT	(1 << 0) /* always reports percent */
> #define HID_BATTERY_QUIRK_FEATURE	(1 << 1) /* ask for feature report */
> #define HID_BATTERY_QUIRK_IGNORE	(1 << 2) /* completely ignore the battery */
>+#define HID_BATTERY_QUIRK_AVOID_QUERY	(1 << 3) /* do not query the battery */
> 
> static const struct hid_device_id hid_battery_quirks[] = {
> 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
>@@ -373,6 +374,8 @@ static const struct hid_device_id hid_battery_quirks[] = {
> 	  HID_BATTERY_QUIRK_IGNORE },
> 	{ HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN),
> 	  HID_BATTERY_QUIRK_IGNORE },
>+	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE, USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_L),
>+	  HID_BATTERY_QUIRK_AVOID_QUERY },
> 	{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15),
> 	  HID_BATTERY_QUIRK_IGNORE },
> 	{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15T_DR100),
>@@ -554,6 +557,9 @@ static int hidinput_setup_battery(struct hid_device *dev, unsigned report_type,
> 	dev->battery_avoid_query = report_type == HID_INPUT_REPORT &&
> 				   field->physical == HID_DG_STYLUS;
> 
>+	if (quirks & HID_BATTERY_QUIRK_AVOID_QUERY)
>+		dev->battery_avoid_query = true;
>+
> 	dev->battery = power_supply_register(&dev->dev, psy_desc, &psy_cfg);
> 	if (IS_ERR(dev->battery)) {
> 		error = PTR_ERR(dev->battery);

I've tested this patch and now power supply status is correctly set to Unknown and capacity is set to 0 initially.

Just a note that that issue occured not only with the dongle, but a cable also.
It seems that tablet just doesn't respond to the query.

Thank you for the work!

  reply	other threads:[~2022-10-29 17:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-29 16:12 [PATCH v3 0/2] Add support for XP-PEN Deco LW José Expósito
2022-10-29 16:12 ` [PATCH v3 1/2] HID: input: do not query XP-PEN Deco LW battery José Expósito
2022-10-29 17:34   ` Mia Kanashi [this message]
2022-10-29 18:13     ` José Expósito
2022-11-04 13:13     ` Jiri Kosina
2022-11-04 14:47       ` Mia Kanashi
2022-11-04 16:26       ` José Expósito
2022-10-29 16:12 ` [PATCH v3 2/2] HID: uclogic: Add support for XP-PEN Deco LW José Expósito
2022-11-04 14:54 ` [PATCH v3 0/2] " 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=1701DB3A-5538-4B58-8232-E6705B9C70DF@redpilled.dev \
    --to=chad@redpilled.dev \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jikos@kernel.org \
    --cc=jose.exposito89@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pobrn@protonmail.com \
    --cc=spbnick@gmail.com \
    /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

all inboxes | Powered by JetHome®