From patchwork Mon Aug 30 11:06:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrik Rydberg X-Patchwork-Id: 141891 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o7UB5fFJ007795 for ; Mon, 30 Aug 2010 11:11:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754920Ab0H3LHh (ORCPT ); Mon, 30 Aug 2010 07:07:37 -0400 Received: from ch-smtp01.sth.basefarm.net ([80.76.149.212]:45758 "EHLO ch-smtp01.sth.basefarm.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753261Ab0H3LHg (ORCPT ); Mon, 30 Aug 2010 07:07:36 -0400 Received: from c83-248-196-134.bredband.comhem.se ([83.248.196.134]:39983 helo=alnilam) by ch-smtp01.sth.basefarm.net with smtp (Exim 4.71) (envelope-from ) id 1Oq2CY-0001Am-55; Mon, 30 Aug 2010 13:07:02 +0200 Received: by alnilam (sSMTP sendmail emulation); Mon, 30 Aug 2010 13:06:56 +0200 From: "Henrik Rydberg" To: Jiri Kosina Cc: Dmitry Torokhov , Stephane Chatty , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Henrik Rydberg Subject: [PATCH] hid: 3m-pct: Adjust major / minor axes to scale Date: Mon, 30 Aug 2010 13:06:51 +0200 Message-Id: <1283166411-2346-1-git-send-email-rydberg@euromail.se> X-Mailer: git-send-email 1.7.1 X-Originating-IP: 83.248.196.134 X-Scan-Result: No virus found in message 1Oq2CY-0001Am-55. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1Oq2CY-0001Am-55 d2e874f27becc175248e172f72feaec3 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 30 Aug 2010 11:11:52 +0000 (UTC) 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;