From patchwork Wed Jul 23 12:42:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolai Kondrashov X-Patchwork-Id: 4610331 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A49B79F37C for ; Wed, 23 Jul 2014 12:43:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E868220172 for ; Wed, 23 Jul 2014 12:43:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 13ADB20173 for ; Wed, 23 Jul 2014 12:43:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751047AbaGWMnX (ORCPT ); Wed, 23 Jul 2014 08:43:23 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:44524 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751990AbaGWMnW (ORCPT ); Wed, 23 Jul 2014 08:43:22 -0400 Received: by mail-wi0-f172.google.com with SMTP id n3so7708232wiv.5 for ; Wed, 23 Jul 2014 05:43:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OIDA12QE4I3hBtwvUU8z/qUAXyHj2wWFMqRlRQCzIrc=; b=nc5NenG3N+zI2GzyAuT58OXVcNQKWMTtuJM90d0P8lNi4hKN2+8agvae/fPDImDHsW xcKFrS93OW7ovb9N1yVOGRDnR29xsdX4PLZH2ZARxtfhrishVv6zjSve3lcIGF1v2Pu5 i0sPkgRYWOLBzPeM/aXEdfLGCV6psr4zLbgajfxEiZiJYm0oHExCP72K+ox2JcQSShoe 7MoY2eAjTycuFaCm4rZOqF6tlUden2Aa4cNWA+KJXf8AcQ7BM5PIwsxa6Na7cxhMCJWw sPzf+VUmUpL957LswPmmMWvKFtfHq8/8kQJ3RiR7mFRHMVilDKExfs2sUN59JhUxz2VY pFIA== X-Received: by 10.180.89.193 with SMTP id bq1mr24313895wib.81.1406119401553; Wed, 23 Jul 2014 05:43:21 -0700 (PDT) Received: from gimli.redhat.com (a88-114-29-97.elisa-laajakaista.fi. [88.114.29.97]) by mx.google.com with ESMTPSA id fw4sm8806681wib.19.2014.07.23.05.43.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Jul 2014 05:43:20 -0700 (PDT) From: Nikolai Kondrashov To: Jiri Kosina Cc: linux-input@vger.kernel.org, DIGImend-devel , Nikolai Kondrashov Subject: [PATCH 2/5] hid: huion: Invert in-range on specific product Date: Wed, 23 Jul 2014 15:42:55 +0300 Message-Id: <1406119378-24551-3-git-send-email-spbnick@gmail.com> X-Mailer: git-send-email 2.0.1 In-Reply-To: <1406119378-24551-1-git-send-email-spbnick@gmail.com> References: <1406119378-24551-1-git-send-email-spbnick@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Limit inverting the in-range bit in raw reports to tablet product ID only. This will make adding handling of other, non-tablet products, easier. Signed-off-by: Nikolai Kondrashov Reviewed-by: Benjamin Tissoires --- drivers/hid/hid-huion.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-huion.c b/drivers/hid/hid-huion.c index 25d01cd..db24472 100644 --- a/drivers/hid/hid-huion.c +++ b/drivers/hid/hid-huion.c @@ -151,9 +151,15 @@ err: static int huion_raw_event(struct hid_device *hdev, struct hid_report *report, u8 *data, int size) { - /* If this is a pen input report then invert the in-range bit */ - if (report->type == HID_INPUT_REPORT && report->id == 0x07 && size >= 2) - data[1] ^= 0x40; + switch (hdev->product) { + case USB_DEVICE_ID_HUION_TABLET: + /* If this is a pen input report */ + if (report->type == HID_INPUT_REPORT && + report->id == 0x07 && size >= 2) + /* Invert the in-range bit */ + data[1] ^= 0x40; + break; + } return 0; }