Skip to content

Commit 037c1aa

Browse files
JoseExpositoJiri Kosina
authored andcommitted
HID: input: do not query XP-PEN Deco LW battery
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 <[email protected]> Tested-by: Mia Kanashi <[email protected]> Signed-off-by: José Expósito <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 334fe5d commit 037c1aa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/hid/hid-input.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ static enum power_supply_property hidinput_battery_props[] = {
340340
#define HID_BATTERY_QUIRK_PERCENT (1 << 0) /* always reports percent */
341341
#define HID_BATTERY_QUIRK_FEATURE (1 << 1) /* ask for feature report */
342342
#define HID_BATTERY_QUIRK_IGNORE (1 << 2) /* completely ignore the battery */
343+
#define HID_BATTERY_QUIRK_AVOID_QUERY (1 << 3) /* do not query the battery */
343344

344345
static const struct hid_device_id hid_battery_quirks[] = {
345346
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
@@ -373,6 +374,8 @@ static const struct hid_device_id hid_battery_quirks[] = {
373374
HID_BATTERY_QUIRK_IGNORE },
374375
{ HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN),
375376
HID_BATTERY_QUIRK_IGNORE },
377+
{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE, USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_L),
378+
HID_BATTERY_QUIRK_AVOID_QUERY },
376379
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15),
377380
HID_BATTERY_QUIRK_IGNORE },
378381
{ 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,
554557
dev->battery_avoid_query = report_type == HID_INPUT_REPORT &&
555558
field->physical == HID_DG_STYLUS;
556559

560+
if (quirks & HID_BATTERY_QUIRK_AVOID_QUERY)
561+
dev->battery_avoid_query = true;
562+
557563
dev->battery = power_supply_register(&dev->dev, psy_desc, &psy_cfg);
558564
if (IS_ERR(dev->battery)) {
559565
error = PTR_ERR(dev->battery);

0 commit comments

Comments
 (0)