From patchwork Wed Jan 25 20:08:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Armstrong Skomra X-Patchwork-Id: 9537865 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7ADE66042B for ; Wed, 25 Jan 2017 20:09:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C21E27D4D for ; Wed, 25 Jan 2017 20:09:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6118A27F99; Wed, 25 Jan 2017 20:09:37 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 1080A27D4D for ; Wed, 25 Jan 2017 20:09:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751819AbdAYUJg (ORCPT ); Wed, 25 Jan 2017 15:09:36 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35680 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751718AbdAYUJf (ORCPT ); Wed, 25 Jan 2017 15:09:35 -0500 Received: by mail-pg0-f65.google.com with SMTP id 204so20532497pge.2 for ; Wed, 25 Jan 2017 12:09:35 -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; bh=iUiYWEb8FHfrwhAfxlGGhKO6THf5aCCO3soFdbTnGr0=; b=hvrDtg697NRTO8YQ1jCzHyIdFzC3sMhByILn0/eQHfHLXDxOPdp4LPXoAU1RmpSj5t IEEwtLWVVTVPlTdug+sOhEWwHpFgQXfcQx6RYZeQtHg0MjB2inH64DIrrDM7Yp+87Qnp +zMrlFgx33abPgmwYYMLr15EJD6tl9gD0vKlKTG8S47JzGbmthXUAJnC18y7H05oaXWx tnbaN9CC/8FZKA+9BIE47SuTgE6CTbVaISoX42/38870zYqRFfDrG4P7vY1H1hiT4083 WlYa/cVU5D+VZw8QC4vebq/dXnvz14m7mUnkcwG65O08SnBV/ZYaVyRDyGky36Evwe3X RrBg== 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; bh=iUiYWEb8FHfrwhAfxlGGhKO6THf5aCCO3soFdbTnGr0=; b=nK4Epy1j62NxGa9b4veqVJeEX724FQYamRgKoNqs9VC4BXPVATKYiq3WS7W+QIh+5Q QOrdllEiDjG3k+56OKGLVCW7FvrQaTgSiSLLmBBK1Iy0RXgEGmaEQygSYgvugNXYs266 f7vST5cNaPhYhN1RthXcTKnb+j2IrtvjSGTO0UehnpEplJzjPc/Ogb8Z5//qe7+Wqg7g mj19Ds365gghWqkmIXu3mNDN1HqlHyNFuN4z3NbPp2AiGfVn9qtMsaW7URXZKp+sP/7H PgZhseOlhVixdCsT0nIymNZLhHcbPk7RSR920/7bfb0P0YTj9+Xptg1j+vLx+JoT2xYh dxwQ== X-Gm-Message-State: AIkVDXJGBt/0QZFTf/LNbUKVmppqlgg2YeADV3fyG1LV/YsY0CgijWEPQ7OScvUprq9elQ== X-Received: by 10.98.139.22 with SMTP id j22mr48187521pfe.115.1485374975091; Wed, 25 Jan 2017 12:09:35 -0800 (PST) Received: from localhost.localdomain (71-36-102-37.ptld.qwest.net. [71.36.102.37]) by smtp.googlemail.com with ESMTPSA id g64sm3066106pfc.57.2017.01.25.12.09.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Jan 2017 12:09:34 -0800 (PST) From: Aaron Armstrong Skomra To: linux-input@vger.kernel.org, jkosina@suse.cz, benjamin.tissoires@redhat.com, pinglinux@gmail.com, killertofu@gmail.com Cc: Aaron Armstrong Skomra , Aaron Skomra Subject: [PATCH 5/8] HID: wacom: generic: add support for touchring Date: Wed, 25 Jan 2017 12:08:39 -0800 Message-Id: <1485374922-3417-6-git-send-email-skomra@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1485374922-3417-1-git-send-email-skomra@gmail.com> References: <1485374922-3417-1-git-send-email-skomra@gmail.com> 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 the touchring to the generic code path in support of the second generation Intuos Pro. We also add checks for usage->type to ensure that we handle the usage before we report it, or change the inrange_state based on it. Signed-off-by: Aaron Skomra --- drivers/hid/wacom_wac.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index f6825d2..636c4a1 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1733,6 +1733,10 @@ static void wacom_wac_pad_usage_mapping(struct hid_device *hdev, wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); features->device_type |= WACOM_DEVICETYPE_PAD; break; + case WACOM_HID_WD_TOUCHRINGSTATUS: + wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); + features->device_type |= WACOM_DEVICETYPE_PAD; + break; } switch (equivalent_usage & 0xfffffff0) { @@ -1775,12 +1779,22 @@ static void wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field struct input_dev *input = wacom_wac->pad_input; unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); + /* + * Avoid reporting this event and setting inrange_state if this usage + * hasn't been mapped. + */ + if (!usage->type) + return; + if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) { - wacom_wac->hid_data.inrange_state |= value; + if (usage->hid != WACOM_HID_WD_TOUCHRING) + wacom_wac->hid_data.inrange_state |= value; } switch (equivalent_usage) { case WACOM_HID_WD_TOUCHRINGSTATUS: + if (!value) + input_event(input, usage->type, usage->code, 0); break; default: @@ -2288,6 +2302,9 @@ void wacom_wac_event(struct hid_device *hdev, struct hid_field *field, if (wacom->wacom_wac.features.type != HID_GENERIC) return; + if (value > field->logical_maximum || value < field->logical_minimum) + return; + if (WACOM_PAD_FIELD(field)) { wacom_wac_pad_battery_event(hdev, field, usage, value); if (wacom->wacom_wac.pad_input)