From patchwork Wed Sep 1 11:22:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrik Rydberg X-Patchwork-Id: 63367 X-Patchwork-Delegate: leann.ogasawara@canonical.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 008B3B7162 for ; Wed, 1 Sep 2010 21:23:15 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1OqlPJ-0004Jx-Kq; Wed, 01 Sep 2010 12:23:09 +0100 Received: from ch-smtp03.sth.basefarm.net ([80.76.149.214]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1OqlPH-0004J6-Ee for kernel-team@lists.ubuntu.com; Wed, 01 Sep 2010 12:23:07 +0100 Received: from c83-248-196-134.bredband.comhem.se ([83.248.196.134]:37032 helo=alnilam) by ch-smtp03.sth.basefarm.net with smtp (Exim 4.68) (envelope-from ) id 1OqlP7-0005Fs-9o; Wed, 01 Sep 2010 13:22:59 +0200 Received: by alnilam (sSMTP sendmail emulation); Wed, 01 Sep 2010 13:22:57 +0200 From: "Henrik Rydberg" To: kernel-team@lists.ubuntu.com Subject: [PATCH 5/5] hid: 3m: Adjust major / minor axes to scale Date: Wed, 1 Sep 2010 13:22:24 +0200 Message-Id: <1283340144-18695-6-git-send-email-rydberg@euromail.se> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1283340144-18695-1-git-send-email-rydberg@euromail.se> References: <1283340144-18695-1-git-send-email-rydberg@euromail.se> X-Originating-IP: 83.248.196.134 X-Scan-Result: No virus found in message 1OqlP7-0005Fs-9o. X-Scan-Signature: ch-smtp03.sth.basefarm.net 1OqlP7-0005Fs-9o d603a108f5e370613cc1b074df4cab95 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com By visual inspection, the reported touch_major and touch_minor axes are a factor of two too large. Presumably the device actually reports the width_major and width_minor, which are generally about a factor of two larger than the touches themselves. Signed-off-by: Henrik Rydberg --- drivers/hid/hid-3m-pct.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/hid/hid-3m-pct.c b/drivers/hid/hid-3m-pct.c index 65441e0..cd4b125 100644 --- a/drivers/hid/hid-3m-pct.c +++ b/drivers/hid/hid-3m-pct.c @@ -162,16 +162,18 @@ static void mmm_filter_event(struct mmm_data *md, struct input_dev *input) if (f->touch) { /* this finger is on the screen */ int wide = (f->w > f->h); + /* divided by two to match visual scale of touch */ + int major = max(f->w, f->h) >> 1; + int minor = min(f->w, f->h) >> 1; + if (!f->prev_touch) f->id = md->id++; input_event(input, EV_ABS, ABS_MT_TRACKING_ID, f->id); input_event(input, EV_ABS, ABS_MT_POSITION_X, f->x); input_event(input, EV_ABS, ABS_MT_POSITION_Y, f->y); input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide); - input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, - wide ? f->w : f->h); - input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, - wide ? f->h : f->w); + input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major); + input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor); /* touchscreen emulation: pick the oldest contact */ if (!oldest || ((f->id - oldest->id) & (SHRT_MAX + 1))) oldest = f;