Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp809943rwj; Sat, 29 Oct 2022 11:14:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4YFDCdvg2PJFVOBoYl0Zn/aZoXlSWt+uZMh6Rdno/L2EHKZ4BFRhA7rRUCQqca0vEjruMd X-Received: by 2002:a62:5807:0:b0:56b:9926:a4e7 with SMTP id m7-20020a625807000000b0056b9926a4e7mr5487046pfb.79.1667067274151; Sat, 29 Oct 2022 11:14:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667067274; cv=none; d=google.com; s=arc-20160816; b=xmuLlghXNBJwY5keAT/dZ5qwdrzHM/72ZzBfLVhP3ffVDdnScqHCequcGHuYzlMEG7 zHzvLhwvEw9ZFTvhis4+2gJYbPhnNk9rErpXAhqm6kMdr+fJJowf7XnhZuKI8EgmpzmK SoVgHKp3lyG5QsIg+5dioTx9SCSAk18l3amQWdumqto341pp575NpnwlnnK0f2WWUKV7 jQjYzeS+2wSIbxCLVtgCrIv3BojrOH1ZDUG0kADJGFf5r72uKh+4v/DtWaRFOwSFj8NT 1QipOsM0xYS7XHKKvtK6IUxxvJXRh/aa1cr3ldU8d8CLbNlAUmammgDY+i++B/JOHPsA LPTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:references:in-reply-to:subject:cc:to:from:dkim-signature :date; bh=h3mGwizRktjW9xsjaOG3vg/Kh6l2SlXpVsNYlVEB6Ig=; b=NQQmhjhNFJT3X0ydnTUk4eqbcTndNUoXkVbPyIspRko7h7PnzJgQ0neYCBcuSLUOxb 9+DKlS9caut9AFMz9l5fHo1jnQ6QrU55bxW1fBMG3QC6bYBJb6h+owtmnMQpwk0ZfzCT 5DcbykW2saApuE/dop9/97tXvaUuC6EZOj4FRUAO3inEelWyMrD/cQK5wMRS3SQVUvke PcpmlL4QtusDjrWzIQ6Zf1EgaWWQ7NJOGy9EhBEsBOSMGT8iPsNtOYz6aHwl4VsF7g0Q UrbYsdiOdHzdwm4GpQIjA5XHv3JnitLWupkA+ip3i4GgIktkeeNWl5LAiAtwqbH+VTZ8 x64w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redpilled.dev header.s=mail header.b=WCmOSJPh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=redpilled.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 6-20020a630006000000b004620564706dsi2881679pga.730.2022.10.29.11.14.22; Sat, 29 Oct 2022 11:14:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redpilled.dev header.s=mail header.b=WCmOSJPh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=redpilled.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229835AbiJ2RfA (ORCPT + 99 others); Sat, 29 Oct 2022 13:35:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229714AbiJ2Re4 (ORCPT ); Sat, 29 Oct 2022 13:34:56 -0400 Received: from redpilled.dev (redpilled.dev [IPv6:2a01:4f8:1c1c:f8e2::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C92EC10FCC; Sat, 29 Oct 2022 10:34:51 -0700 (PDT) Date: Sat, 29 Oct 2022 20:34:46 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redpilled.dev; s=mail; t=1667064889; bh=h3mGwizRktjW9xsjaOG3vg/Kh6l2SlXpVsNYlVEB6Ig=; h=Date:From:To:CC:Subject:In-Reply-To:References; b=WCmOSJPh1IPrj1M5MhGQU5TNW+qJCtok//7gmFlCbO5VfR7HK1d8GYcoTfMwt/CCZ oVmCXpBkPXAD+fyZVCU2GY34tiYxXQSpJVV+fSjZMQpQ/F/9c2NgJkH076HHcMcuVx tVVaWybV1gNA0TUkSTa8L7MFPIthVY7Erdl9AVZ4= From: Mia Kanashi To: =?ISO-8859-1?Q?Jos=E9_Exp=F3sito?= , 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 In-Reply-To: <20221029161240.15548-2-jose.exposito89@gmail.com> References: <20221029161240.15548-1-jose.exposito89@gmail.com> <20221029161240.15548-2-jose.exposito89@gmail.com> Message-ID: <1701DB3A-5538-4B58-8232-E6705B9C70DF@redpilled.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29 October 2022 19:12:39 EEST, "Jos=C3=A9 Exp=C3=B3sito" wrote: >The XP-PEN Deco LW drawing tablet can be connected by USB cable or using >a USB Bluetooth dongle=2E When it is connected using the dongle, there >might be a small delay until the tablet is paired with the dongle=2E > >Fetching the device battery during this delay results in random battery >percentage values=2E > >Add a quirk to avoid actively querying the battery percentage and wait >for the device to report it on its own=2E > >Reported-by: Mia Kanashi >Signed-off-by: Jos=C3=A9 Exp=C3=B3sito >--- > drivers/hid/hid-input=2Ec | 6 ++++++ > 1 file changed, 6 insertions(+) > >diff --git a/drivers/hid/hid-input=2Ec b/drivers/hid/hid-input=2Ec >index 859aeb07542e=2E=2Ed728a94c642e 100644 >--- a/drivers/hid/hid-input=2Ec >+++ b/drivers/hid/hid-input=2Ec >@@ -340,6 +340,7 @@ static enum power_supply_property hidinput_battery_pr= ops[] =3D { > #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 batte= ry */ >+#define HID_BATTERY_QUIRK_AVOID_QUERY (1 << 3) /* do not query the batte= ry */ >=20 > static const struct hid_device_id hid_battery_quirks[] =3D { > { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, >@@ -373,6 +374,8 @@ static const struct hid_device_id hid_battery_quirks[= ] =3D { > HID_BATTERY_QUIRK_IGNORE }, > { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550VE_TOUCHSC= REEN), > HID_BATTERY_QUIRK_IGNORE }, >+ { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, USB_DEVICE_ID_UGEE_XPPEN_TABLET_DE= CO_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_DR1= 00), >@@ -554,6 +557,9 @@ static int hidinput_setup_battery(struct hid_device *= dev, unsigned report_type, > dev->battery_avoid_query =3D report_type =3D=3D HID_INPUT_REPORT && > field->physical =3D=3D HID_DG_STYLUS; >=20 >+ if (quirks & HID_BATTERY_QUIRK_AVOID_QUERY) >+ dev->battery_avoid_query =3D true; >+ > dev->battery =3D power_supply_register(&dev->dev, psy_desc, &psy_cfg); > if (IS_ERR(dev->battery)) { > error =3D PTR_ERR(dev->battery); I've tested this patch and now power supply status is correctly set to Unk= nown and capacity is set to 0 initially=2E Just a note that that issue occured not only with the dongle, but a cable = also=2E It seems that tablet just doesn't respond to the query=2E Thank you for the work!