From patchwork Fri Mar 3 13:06:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: HungNien Chen X-Patchwork-Id: 9602813 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 0DAC3600CB for ; Fri, 3 Mar 2017 13:23:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F373926C9B for ; Fri, 3 Mar 2017 13:23:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E65FB285D0; Fri, 3 Mar 2017 13:23:43 +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.9 required=2.0 tests=BAYES_00,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 6A48726C9B for ; Fri, 3 Mar 2017 13:23:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752134AbdCCNX3 (ORCPT ); Fri, 3 Mar 2017 08:23:29 -0500 Received: from ml01.weidahitech.com ([61.222.87.235]:2391 "EHLO ml01.weidahitech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751521AbdCCNWc (ORCPT ); Fri, 3 Mar 2017 08:22:32 -0500 X-Greylist: delayed 578 seconds by postgrey-1.27 at vger.kernel.org; Fri, 03 Mar 2017 08:22:31 EST Received: from mail02.WHT.local (mail02.wht.local [192.168.10.16]) by ml01.weidahitech.com (8.13.8/8.13.8) with ESMTP id v23D2QpD019129; Fri, 3 Mar 2017 21:02:26 +0800 Received: from x-Veriton-M4620G.WHT.local (192.168.10.88) by MAIL02.WHT.local (192.168.10.16) with Microsoft SMTP Server id 14.2.347.0; Fri, 3 Mar 2017 21:02:29 +0800 From: To: CC: , , , , , HungNien Chen Subject: [PATCH] HID: hid-multitouch: change for touch height/width Date: Fri, 3 Mar 2017 21:06:09 +0800 Message-ID: <1488546369-32580-1-git-send-email-hn.chen@weidahitech.com> X-Mailer: git-send-email 1.9.1 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 From: HungNien Chen This change is from Jonathan Clarke and have been discussed in previous thread(2017/01/24). Just doing a slight change in quirk name from Benjamin's comment. Signed-off-by: HungNien Chen --- drivers/hid/hid-multitouch.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 6926474..24d5b6d 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -69,6 +69,7 @@ #define MT_QUIRK_CONTACT_CNT_ACCURATE (1 << 12) #define MT_QUIRK_FORCE_GET_FEATURE (1 << 13) #define MT_QUIRK_FIX_CONST_CONTACT_ID (1 << 14) +#define MT_QUIRK_TOUCH_SIZE_SCALING (1 << 15) #define MT_INPUTMODE_TOUCHSCREEN 0x02 #define MT_INPUTMODE_TOUCHPAD 0x03 @@ -222,7 +223,8 @@ static int cypress_compute_slot(struct mt_device *td) */ { .name = MT_CLS_3M, .quirks = MT_QUIRK_VALID_IS_CONFIDENCE | - MT_QUIRK_SLOT_IS_CONTACTID, + MT_QUIRK_SLOT_IS_CONTACTID | + MT_QUIRK_TOUCH_SIZE_SCALING, .sn_move = 2048, .sn_width = 128, .sn_height = 128, @@ -658,9 +660,17 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input) if (active) { /* this finger is in proximity of the sensor */ int wide = (s->w > s->h); - /* divided by two to match visual scale of touch */ - int major = max(s->w, s->h) >> 1; - int minor = min(s->w, s->h) >> 1; + int major = max(s->w, s->h); + int minor = min(s->w, s->h); + + /* + * divided by two to match visual scale of touch + * for devices with this quirk + */ + if (td->mtclass.quirks & MT_QUIRK_TOUCH_SIZE_SCALING) { + major = major >> 1; + minor = minor >> 1; + } input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x); input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);