From patchwork Fri Mar 31 22:45:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Torsha Banerjee X-Patchwork-Id: 669319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CDD0C761A6 for ; Fri, 31 Mar 2023 22:45:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232973AbjCaWp5 (ORCPT ); Fri, 31 Mar 2023 18:45:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbjCaWp4 (ORCPT ); Fri, 31 Mar 2023 18:45:56 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53EFF2D5F for ; Fri, 31 Mar 2023 15:45:55 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id q102so21965516pjq.3 for ; Fri, 31 Mar 2023 15:45:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1680302755; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=FT3VTUjo7B8Z6a6Co0FRAvEldOp0goywye0iYEBwxqQ=; b=bymzRAbBGTzOVh8y2mzeeRerq3UIiF4kZE079arFHGmT9TIO75k6aqXL8nUbrDPK/5 aqzUCQO3aFP3ohy6F4Y/RVzpJljEtT9hgu3PYKtF6KwT0EB/t29v3WSGxu130p0tAP9+ dgOg094CfB3dOx3wRIYpGwe1PTLE1exXzBF98= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680302755; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FT3VTUjo7B8Z6a6Co0FRAvEldOp0goywye0iYEBwxqQ=; b=auW+uVI0tp7IIbALjTVZP+7v5/Xa57d/LKiE04LEZ+/5obXRbap4nrwJaaiQKB/WpD 80UXGHftL7QIuDhrC5+TQdrORmAmxHGT2w2iUgFrvtQvVrJqN5ZzNDNixzHGKnsYMM5B /uNsdaeNbLoOxxif+dv+ItSketbGGO/P1fni8f8fflhZ56l1xHcs9aeECVMV/mBkf9Pf h8Bbxwk64xYYCWHFCls04zubmC+jO6t5Q2OfOekswjq4qpopWD2MIZLqFUyWcR9Btz6e sF349ilmyS7Qzh+jTboocajvC3OLqZaFSkmYywzmZesisN7Q61zgKMvRoqVDxwv00cc8 H93w== X-Gm-Message-State: AAQBX9e3v9+yfPf0/XNZAaq4SHqAIGFVzvrnLo3wtOYM2GdEZU8hE0RL FJ/JQxvCblStCzMxz7W/Jv20kQ== X-Google-Smtp-Source: AKy350bGaWt/BjzawxlujTsu+UdC93Q73IN15yVjk8iKLVcxpk0Kzb92ZCHHJsqTzHeW3KM5XN1gqQ== X-Received: by 2002:a05:6a20:4a30:b0:df:4e86:9c99 with SMTP id fr48-20020a056a204a3000b000df4e869c99mr19610716pzb.55.1680302754782; Fri, 31 Mar 2023 15:45:54 -0700 (PDT) Received: from torsha.c.googlers.com.com (209.148.168.34.bc.googleusercontent.com. [34.168.148.209]) by smtp.gmail.com with ESMTPSA id j11-20020aa7800b000000b005895f9657ebsm2289216pfi.70.2023.03.31.15.45.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 15:45:54 -0700 (PDT) From: Torsha Banerjee X-Google-Original-From: Torsha Banerjee To: u-boot@lists.denx.de Cc: Jing , Sean , Jora Jacobi , Harry Cutts , Torsha Banerjee , Benjamin Tissoires , Jiri Kosina , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Series-to: LKML Date: Fri, 31 Mar 2023 22:45:36 +0000 Message-Id: <20230331224536.1685149-1-torsha@google.com> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Jora Jacobi Restore missing cursor for digitizer devices A previously committed patch to remove cursors for HID Digitizer-Pen devices also removed the cursors for some tablets which have incorrect HID descriptors. These devices should enumerate with Usage ID "Digitizer" instead of Usage ID "Pen". Patch which introduced the issue: commit 8473a93d1ba5 ("HID: input: Set INPUT_PROP_-property for HID_UP_DIGITIZERS") Changes- Add HID quirk HID_QUIRK_DEVICE_IS_DIGITIZER Quirk will force INPUT_PROP_POINTER for HID Digitizers Apply quirk to Huion tablets Apply quirk to UGEE/XP-Pen tablets based on device ID Tested with Huion H640P and H430P. Connected the digitizer to the Chromebook and confirmed with a drawing program that the cursor appears and moves when the digitizer's stylus is hovering over the surface of the digitizer. Signed-off-by: Jora Jacobi Reviewed-by: Harry Cutts Signed-off-by: Torsha Banerjee --- drivers/hid/hid-input.c | 3 ++- drivers/hid/hid-quirks.c | 9 +++++++++ include/linux/hid.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 7fc967964dd8..f0c67baddc8d 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -927,7 +927,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel break; case HID_UP_DIGITIZER: - if ((field->application & 0xff) == 0x01) /* Digitizer */ + if (((field->application & 0xff) == 0x01) || + (device->quirks & HID_QUIRK_DEVICE_IS_DIGITIZER)) /* Digitizer */ __set_bit(INPUT_PROP_POINTER, input->propbit); else if ((field->application & 0xff) == 0x02) /* Pen */ __set_bit(INPUT_PROP_DIRECT, input->propbit); diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c index 66e64350f138..094fe4c4f3b3 100644 --- a/drivers/hid/hid-quirks.c +++ b/drivers/hid/hid-quirks.c @@ -102,6 +102,8 @@ static const struct hid_device_id hid_quirks[] = { { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_0941), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_0641), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_1f4a), HID_QUIRK_ALWAYS_POLL }, + { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_HS64), HID_QUIRK_DEVICE_IS_DIGITIZER }, + { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET), HID_QUIRK_DEVICE_IS_DIGITIZER }, { HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM, USB_DEVICE_ID_IDEACOM_IDC6680), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_INNOMEDIA, USB_DEVICE_ID_INNEX_GENESIS_ATARI), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X), HID_QUIRK_MULTI_INPUT }, @@ -1298,6 +1300,13 @@ unsigned long hid_lookup_quirk(const struct hid_device *hdev) quirks = hid_gets_squirk(hdev); mutex_unlock(&dquirks_lock); + /* + * UGEE/XP-Pen HID Pen devices which have 0x0-0x9 as the low nibble + * of the device ID are actually digitizers, not HID Pen devices + */ + if (hdev->vendor == USB_VENDOR_ID_UGEE && (hdev->product & 0x0F) <= 0x09) + quirks |= HID_QUIRK_DEVICE_IS_DIGITIZER; + return quirks; } EXPORT_SYMBOL_GPL(hid_lookup_quirk); diff --git a/include/linux/hid.h b/include/linux/hid.h index 1ea8c7a3570b..1653359002b3 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -354,6 +354,7 @@ struct hid_item { #define HID_QUIRK_INPUT_PER_APP BIT(11) #define HID_QUIRK_X_INVERT BIT(12) #define HID_QUIRK_Y_INVERT BIT(13) +#define HID_QUIRK_DEVICE_IS_DIGITIZER BIT(14) #define HID_QUIRK_SKIP_OUTPUT_REPORTS BIT(16) #define HID_QUIRK_SKIP_OUTPUT_REPORT_ID BIT(17) #define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP BIT(18)