From patchwork Sun Feb 10 10:14:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolai Kondrashov X-Patchwork-Id: 10804695 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1FBF31575 for ; Sun, 10 Feb 2019 10:15:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1157129F46 for ; Sun, 10 Feb 2019 10:15:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 058FF29F4F; Sun, 10 Feb 2019 10:15:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EB7829F46 for ; Sun, 10 Feb 2019 10:15:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726125AbfBJKPH (ORCPT ); Sun, 10 Feb 2019 05:15:07 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:45774 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726078AbfBJKPG (ORCPT ); Sun, 10 Feb 2019 05:15:06 -0500 Received: by mail-lj1-f193.google.com with SMTP id s5-v6so6393827ljd.12 for ; Sun, 10 Feb 2019 02:15:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=j/uufF6j1jhec1j4yaI1N8gsCXqws97mbfh9D9faZiI=; b=uT6uNYCDJZ70xCkCKU33PVrYv7qLsas1XkUhEkOYoodD6ep7vgl7OFRPTMo8FX9iQs /NpERVFfs59ozXoUHEfS/EhACFEw5m5Vm69V+RCqjIGrQjMS54/8+0oxxSpQKSgf7aeO 5ft3zNGu5FeNFEB303AV30AbczezzphVb3VPtnTjgGOIZIqlLiwsWuLKY/pS1uvUCLIr NoSvKU6vV7/SbmgeXGeGVWyEhBTWng40V3sJWjOcBUNnbw6AYK8dwNN74ejEfnHO8jrU kKJN+mGFc+ECZ+CWwKsmX+mlx5b9/8eiJpdGatijwSq8D3fV3+pVSP4C6pACkl4b0jwc 9DEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=j/uufF6j1jhec1j4yaI1N8gsCXqws97mbfh9D9faZiI=; b=mKIVagethPBpA7HuVEigVb4RABDwjdXpx8+DSXpAcQ8zjC80Q/UtzLgc88Lt+ThZrk mVtmg7c9BojC9zMvT0FdrxIP6BdLuQTB7gqFP6hqAT0xDNb7mAA8FqDlMj0qBMCMbhk3 ugI3H2viH6jcfN987jUKqsSMEKbNH3D8LCgHHTFKloaHaNejWIBMaNa5FM1yMRI+kSPU H1I5/C7JwOvgCHKJqdztHh36R2uqxJVj7DtMtxFkw/eBTrIFKisoOlRN9zb4nANIP6BG 6pUvCexdQqwZlUVWqI/55G5gugn4lLEuo5iUOCvuidTMUgtTIwE4g3daVrO0xghnWXj+ SZkw== X-Gm-Message-State: AHQUAuZ71R5FWUKY3y29rQAiiku+L0BeV3qBvxnc0VEhFfyMvk0gUUiF 5ku1JW/RcfzlKS2xeUnSU5I= X-Google-Smtp-Source: AHgI3IaAYjrIK65vJ3fVchzeHIh1Oqp4PhFXLgbN93V9T/384jeeHRwQgg79coVNv7TaoCjcO3RU0A== X-Received: by 2002:a2e:7f04:: with SMTP id a4-v6mr18282401ljd.156.1549793705157; Sun, 10 Feb 2019 02:15:05 -0800 (PST) Received: from bard.ponomarevs.fi (88-112-122-53.elisa-laajakaista.fi. [88.112.122.53]) by smtp.gmail.com with ESMTPSA id l21-v6sm1472010ljj.48.2019.02.10.02.15.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Feb 2019 02:15:04 -0800 (PST) From: Nikolai Kondrashov To: Benjamin Tissoires Cc: Jiri Kosina , linux-input@vger.kernel.org, Nikolai Kondrashov Subject: [PATCH v2 17/23] HID: uclogic: Support faking Wacom pad device ID Date: Sun, 10 Feb 2019 12:14:03 +0200 Message-Id: <20190210101409.3511-18-spbnick@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190210101409.3511-1-spbnick@gmail.com> References: <20181227171625.11164-1-spbnick@gmail.com> <20190210101409.3511-1-spbnick@gmail.com> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add support for inserting a Wacom pad device ID into hid-uclogic reports. This allows reporting dial inputs in a way compatible with the Wacom driver. Needed for Ugee G5 support in particular. Signed-off-by: Nikolai Kondrashov --- drivers/hid/hid-uclogic-core.c | 10 ++++++++++ drivers/hid/hid-uclogic-params.h | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c index e4324ad86e58..f5fb612daa1e 100644 --- a/drivers/hid/hid-uclogic-core.c +++ b/drivers/hid/hid-uclogic-core.c @@ -300,6 +300,16 @@ static int uclogic_raw_event(struct hid_device *hdev, } } + /* Tweak frame control reports, if necessary */ + if ((report->type == HID_INPUT_REPORT) && + (report->id == params->frame.id)) { + /* If need to, and can, set pad device ID for Wacom drivers */ + if (params->frame.dev_id_byte > 0 && + params->frame.dev_id_byte < size) { + data[params->frame.dev_id_byte] = 0xf; + } + } + return 0; } diff --git a/drivers/hid/hid-uclogic-params.h b/drivers/hid/hid-uclogic-params.h index 1060f70d647d..4ba6ecc2b8b8 100644 --- a/drivers/hid/hid-uclogic-params.h +++ b/drivers/hid/hid-uclogic-params.h @@ -87,6 +87,13 @@ struct uclogic_params_frame { * Report ID, if reports should be tweaked, zero if not. */ unsigned int id; + /* + * Offset of the Wacom-style device ID byte in the report, to be set + * to pad device ID (0xf), for compatibility with Wacom drivers. Zero + * if no changes to the report should be made. Only valid if "id" is + * not zero. + */ + unsigned int dev_id_byte; }; /* @@ -161,6 +168,7 @@ extern int uclogic_params_init(struct uclogic_params *params, ".frame.desc_ptr = %p\n" \ ".frame.desc_size = %u\n" \ ".frame.id = %u\n" \ + ".frame.dev_id_byte = %u\n" \ ".pen_frame_flag = 0x%02x\n" /* Tablet interface parameters *printf format arguments */ @@ -177,6 +185,7 @@ extern int uclogic_params_init(struct uclogic_params *params, (_params)->frame.desc_ptr, \ (_params)->frame.desc_size, \ (_params)->frame.id, \ + (_params)->frame.dev_id_byte, \ (_params)->pen_frame_flag /* Get a replacement report descriptor for a tablet's interface. */