From patchwork Tue May 25 11:52:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrik Rydberg X-Patchwork-Id: 102169 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4PBs0x9011102 for ; Tue, 25 May 2010 11:54:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754214Ab0EYLx7 (ORCPT ); Tue, 25 May 2010 07:53:59 -0400 Received: from ch-smtp03.sth.basefarm.net ([80.76.149.214]:42181 "EHLO ch-smtp03.sth.basefarm.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754053Ab0EYLx6 (ORCPT ); Tue, 25 May 2010 07:53:58 -0400 Received: from c83-248-196-134.bredband.comhem.se ([83.248.196.134]:50706 helo=alnilam) by ch-smtp03.sth.basefarm.net with smtp (Exim 4.68) (envelope-from ) id 1OGshF-0000an-CG; Tue, 25 May 2010 13:53:24 +0200 Received: by alnilam (sSMTP sendmail emulation); Tue, 25 May 2010 13:53:21 +0200 From: "Henrik Rydberg" To: Dmitry Torokhov Cc: Andrew Morton , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Mika Kuoppala , Peter Hutterer , Benjamin Tissoires , Stephane Chatty , Rafi Rubin , Michael Poole , Henrik Rydberg Subject: [PATCH 2/2] input: evdev: Add EVIOC mechanism to extract the MT slot state Date: Tue, 25 May 2010 13:52:59 +0200 Message-Id: <1274788379-11026-3-git-send-email-rydberg@euromail.se> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1274788379-11026-2-git-send-email-rydberg@euromail.se> References: <1274788379-11026-1-git-send-email-rydberg@euromail.se> <1274788379-11026-2-git-send-email-rydberg@euromail.se> X-Originating-IP: 83.248.196.134 X-Scan-Result: No virus found in message 1OGshF-0000an-CG. X-Scan-Signature: ch-smtp03.sth.basefarm.net 1OGshF-0000an-CG 07591cac834a90e97ad581a993bdda31 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 (demeter.kernel.org [140.211.167.41]); Tue, 25 May 2010 11:54:00 +0000 (UTC) diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 2ee6c7a..8b68b88 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -43,6 +43,7 @@ struct evdev_client { struct fasync_struct *fasync; struct evdev *evdev; struct list_head node; + int slot; /* used to extract MT events via EVIOC */ }; static struct evdev *evdev_table[EVDEV_MINORS]; @@ -624,7 +625,8 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, t = _IOC_NR(cmd) & ABS_MAX; - abs.value = dev->abs[t]; + abs.value = input_mt_get_abs_value(dev, t, + client->slot); abs.minimum = dev->absmin[t]; abs.maximum = dev->absmax[t]; abs.fuzz = dev->absfuzz[t]; @@ -665,6 +667,11 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, sizeof(struct input_absinfo)))) return -EFAULT; + if (t == ABS_MT_SLOT) { + client->slot = abs.value; + return 0; + } + /* * Take event lock to ensure that we are not * changing device parameters in the middle