From patchwork Mon Oct 24 21:01:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donohue X-Patchwork-Id: 9393303 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 11E6160762 for ; Mon, 24 Oct 2016 21:09:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0252228E1A for ; Mon, 24 Oct 2016 21:09:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB24F290CE; Mon, 24 Oct 2016 21:09:52 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 7044128E1A for ; Mon, 24 Oct 2016 21:09:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936238AbcJXVJt (ORCPT ); Mon, 24 Oct 2016 17:09:49 -0400 Received: from Lepton.TopQuark.net ([168.235.66.66]:36852 "EHLO Mail2.TopQuark.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934108AbcJXVJt (ORCPT ); Mon, 24 Oct 2016 17:09:49 -0400 X-Greylist: delayed 533 seconds by postgrey-1.27 at vger.kernel.org; Mon, 24 Oct 2016 17:09:48 EDT Received: from Mail1.TopQuark.net (pool-108-48-201-133.washdc.fios.verizon.net [108.48.201.133]) by Mail2.TopQuark.net (Postfix) with ESMTP id BE17EF603B5; Mon, 24 Oct 2016 17:00:53 -0400 (EDT) Received: from Mail1.TopQuark.net (unknown [127.0.0.1]) by Mail1.TopQuark.net (Postfix) with ESMTP id E87C527EE154; Mon, 24 Oct 2016 17:01:22 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=PaulSD.com; h=date:from:to :cc:subject:message-id:mime-version:content-type; s=mail; bh=/EN G+VaUSwNbPUWLOTehKMnX+ws=; b=Z9HltLXw2Ddb3WEf9IstXzTXJQp3jYa/9v1 BBxIGmT1Tkw6cTg8u6pFmC79r7odDuj+sKLgHVunUH1s4lFlyTf6dhtVsXUgSS9n 62BYHI/FIa9RkG166XC9e769pY58Nlup5JDOTeQsgp2v8nqmM0WjeMvQfaFQws8x qJxRrm/Y= Received: by Mail1.TopQuark.net (Postfix, from userid 1000) id C0E9B27EE293; Mon, 24 Oct 2016 17:01:22 -0400 (EDT) Date: Mon, 24 Oct 2016 17:01:22 -0400 From: Paul Donohue To: linux-input@vger.kernel.org Cc: Ben Gamari , Pali =?iso-8859-1?Q?Roh=E1r?= , Michal Hocko Subject: [PATCH] Input: ALPS - Fix TrackStick support for SS5 hardware Message-ID: <20161024210122.GA2919@TopQuark.net> MIME-Version: 1.0 Content-Disposition: inline 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 The current Alps SS5 (SS4 v2) code generates bogus TouchPad events when TrackStick packets are processed. This causes the xorg synaptics driver to print "unable to find touch point 0" and "BUG: triggered 'if (priv->num_active_touches > priv->num_slots)'" messages. It also causes unexpected TouchPad button release and reclick event sequences if the TrackStick is moved while holding a TouchPad button. This commit corrects the problem by setting a flag for the relevant packet type in alps_decode_ss4_v2(), then using that flag in alps_process_packet_ss4_v2() to send only TrackStick reports when processing TrackStick packets. Signed-off-by: Paul Donohue --- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 6d7de9b..2c2e55b 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c @@ -1279,6 +1279,8 @@ static int alps_decode_ss4_v2(struct alps_fields *f, input_report_rel(priv->dev2, REL_Y, -y); input_report_abs(priv->dev2, ABS_PRESSURE, pressure); } + f->first_mp = 0; + f->is_mp = 0; break; case SS4_PACKET_ID_IDLE: @@ -1289,12 +1291,14 @@ static int alps_decode_ss4_v2(struct alps_fields *f, /* handle buttons */ if (pkt_id == SS4_PACKET_ID_STICK) { + f->is_ts = 1; f->ts_left = !!(SS4_BTN_V2(p) & 0x01); if (!(priv->flags & ALPS_BUTTONPAD)) { f->ts_right = !!(SS4_BTN_V2(p) & 0x02); f->ts_middle = !!(SS4_BTN_V2(p) & 0x04); } } else { + f->is_ts = 0; f->left = !!(SS4_BTN_V2(p) & 0x01); if (!(priv->flags & ALPS_BUTTONPAD)) { f->right = !!(SS4_BTN_V2(p) & 0x02); @@ -1346,18 +1350,18 @@ static void alps_process_packet_ss4_v2(struct psmouse *psmouse) priv->multi_packet = 0; - alps_report_mt_data(psmouse, (f->fingers <= 4) ? f->fingers : 4); - - input_mt_report_finger_count(dev, f->fingers); + if (!f->is_ts) { + alps_report_mt_data(psmouse, (f->fingers <= 4) ? f->fingers : 4); - input_report_key(dev, BTN_LEFT, f->left); - input_report_key(dev, BTN_RIGHT, f->right); - input_report_key(dev, BTN_MIDDLE, f->middle); + input_mt_report_finger_count(dev, f->fingers); - input_report_abs(dev, ABS_PRESSURE, f->pressure); - input_sync(dev); + input_report_key(dev, BTN_LEFT, f->left); + input_report_key(dev, BTN_RIGHT, f->right); + input_report_key(dev, BTN_MIDDLE, f->middle); - if (priv->flags & ALPS_DUALPOINT) { + input_report_abs(dev, ABS_PRESSURE, f->pressure); + input_sync(dev); + } else { input_report_key(dev2, BTN_LEFT, f->ts_left); input_report_key(dev2, BTN_RIGHT, f->ts_right); input_report_key(dev2, BTN_MIDDLE, f->ts_middle); diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h index b9417e2..1dc09b5 100644 --- a/drivers/input/mouse/alps.h +++ b/drivers/input/mouse/alps.h @@ -192,6 +192,7 @@ struct alps_bitmap_point { * @left: Left touchpad button is active. * @right: Right touchpad button is active. * @middle: Middle touchpad button is active. + * @is_ts: Packet is for the trackstick, not the touchpad. * @ts_left: Left trackstick button is active. * @ts_right: Right trackstick button is active. * @ts_middle: Middle trackstick button is active. @@ -212,6 +213,7 @@ struct alps_fields { unsigned int right:1; unsigned int middle:1; + unsigned int is_ts:1; unsigned int ts_left:1; unsigned int ts_right:1; unsigned int ts_middle:1;