From patchwork Thu Aug 18 10:28:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Ospite X-Patchwork-Id: 1075972 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7IARVGS026299 for ; Thu, 18 Aug 2011 10:29:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752825Ab1HRK3N (ORCPT ); Thu, 18 Aug 2011 06:29:13 -0400 Received: from smtp207.alice.it ([82.57.200.103]:46300 "EHLO smtp207.alice.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755462Ab1HRK3M (ORCPT ); Thu, 18 Aug 2011 06:29:12 -0400 Received: from jcn (87.10.137.120) by smtp207.alice.it (8.5.124.08) id 4DFA189A05B845C2; Thu, 18 Aug 2011 12:29:11 +0200 Received: from ao2 by jcn with local (Exim 4.76) (envelope-from ) id 1QtzqX-0005A4-HL; Thu, 18 Aug 2011 12:29:09 +0200 From: Antonio Ospite To: linux-input@vger.kernel.org Cc: Antonio Ospite , Simon Wood , Henrik Rydberg , virtuousfox@gmail.com Subject: [RFC PATCH] Only process ABS_MT_SLOT where there are slots available Date: Thu, 18 Aug 2011 12:28:53 +0200 Message-Id: <1313663333-19810-1-git-send-email-ospite@studenti.unina.it> X-Mailer: git-send-email 1.7.5.4 X-Face: z*RaLf`X<@C75u6Ig9}{oW$H; 1_\2t5)({*|jhM/Vb; ]yA5\I~93>J<_`<4)A{':UrE 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.6 (demeter1.kernel.org [140.211.167.41]); Thu, 18 Aug 2011 10:29:14 +0000 (UTC) This fixes the case when a non-multitouch device happens to have a HID code equal to ABS_MT_SLOT, like the Sony Sixaxis has for the left dpad analog control. Signed-off-by: Antonio Ospite Cc: Simon Wood Cc: Henrik Rydberg Cc: virtuousfox@gmail.com --- Hi, following up from the discussion at http://thread.gmane.org/gmane.linux.kernel.input/19632 I've come up with this workaround to make the dpad left analog axis of the Sony Sixaxis controller working. What happens is that this button has a code of 0x2f (ABS_MT_SLOT) which gets some special handling regardless of the device being a multitouch one or not. I do not know anything about multitouch devices, so I am not sure if this hack may break something else, I'd like some advice here. Another possibility could be to remap the code at the HID level for the Sixaxis only, Simon you suggested this, are you willing to do that if this will be the preferred way? My HID-fu is way worse than yours and It'll take a lot more time for me. Thanks, Antonio Ospite http://ao2.it drivers/input/input.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/input/input.c b/drivers/input/input.c index da38d97..f878ae9 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -169,7 +169,7 @@ static int input_handle_abs_event(struct input_dev *dev, bool is_mt_event; int *pold; - if (code == ABS_MT_SLOT) { + if (code == ABS_MT_SLOT && dev->mtsize > 0) { /* * "Stage" the event; we'll flush it later, when we * get actual touch data. @@ -205,7 +205,8 @@ static int input_handle_abs_event(struct input_dev *dev, } /* Flush pending "slot" event */ - if (is_mt_event && dev->slot != input_abs_get_val(dev, ABS_MT_SLOT)) { + if (is_mt_event && dev->slot != input_abs_get_val(dev, ABS_MT_SLOT) && + dev->mtsize > 0 ) { input_abs_set_val(dev, ABS_MT_SLOT, dev->slot); input_pass_event(dev, EV_ABS, ABS_MT_SLOT, dev->slot); }