From patchwork Tue Nov 8 14:59:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donohue X-Patchwork-Id: 9417617 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 E5CF760720 for ; Tue, 8 Nov 2016 15:00:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D85D9286DD for ; Tue, 8 Nov 2016 15:00:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCD3328ADA; Tue, 8 Nov 2016 15:00:05 +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 5772128AB7 for ; Tue, 8 Nov 2016 15:00:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753176AbcKHO7z (ORCPT ); Tue, 8 Nov 2016 09:59:55 -0500 Received: from Lepton.TopQuark.net ([168.235.66.66]:45243 "EHLO Mail2.TopQuark.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753095AbcKHO7x (ORCPT ); Tue, 8 Nov 2016 09:59:53 -0500 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 32EEDF60282; Tue, 8 Nov 2016 09:59:52 -0500 (EST) Received: from Mail1.TopQuark.net (unknown [127.0.0.1]) by Mail1.TopQuark.net (Postfix) with ESMTP id CE07E27EE34E; Tue, 8 Nov 2016 09:59:51 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=PaulSD.com; h=date:from:to :cc:subject:message-id:references:mime-version:content-type :in-reply-to; s=mail; bh=q/6E9KDY6DF4qE1H2BilIw0q9IU=; b=H8+svNH vrgzjaJ6U4qH21akfVUtN4VkLqR0LTtNNPv9LmimdDKn5DXCv7Wn5R7jfy1LIUE5 hjcvgFh0JZ9Ck/WNoAutXKyXsO/x0ynJ4nXgbjQ92P0wyx3L5Z50JmejyciCMtAm BRZE/DSLxnaOsaOInrxkiQJ035H88nG2e/8M= Received: by Mail1.TopQuark.net (Postfix, from userid 1000) id ABE8F27EE350; Tue, 8 Nov 2016 09:59:51 -0500 (EST) Date: Tue, 8 Nov 2016 09:59:51 -0500 From: Paul Donohue To: linux-input@vger.kernel.org Cc: Ben Gamari , Pali =?iso-8859-1?Q?Roh=E1r?= , Michal Hocko Subject: [PATCH v3 2/3] Input: ALPS - Fix TrackStick support for SS5 hardware Message-ID: <20161108145951.GL2927@TopQuark.net> References: <20161024210122.GA2919@TopQuark.net> <20161108145423.GK2927@TopQuark.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20161108145423.GK2927@TopQuark.net> 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 Input: ALPS - Clean up TrackStick handling for SS5 hardware For consistency and clarity, the input_report_*() functions should be called by alps_process_packet_ss4_v2() instead of by alps_decode_ss4_v2(). 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 b93fe83..12376d2 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c @@ -1267,18 +1267,11 @@ static int alps_decode_ss4_v2(struct alps_fields *f, break; case SS4_PACKET_ID_STICK: - if (!(priv->flags & ALPS_DUALPOINT)) { - psmouse_warn(psmouse, - "Rejected trackstick packet from non DualPoint device"); - } else { - int x = (s8)(((p[0] & 1) << 7) | (p[1] & 0x7f)); - int y = (s8)(((p[3] & 1) << 7) | (p[2] & 0x7f)); - int pressure = (s8)(p[4] & 0x7f); - - input_report_rel(priv->dev2, REL_X, x); - input_report_rel(priv->dev2, REL_Y, -y); - input_report_abs(priv->dev2, ABS_PRESSURE, pressure); - } + f->st.x = (s8)(((p[0] & 1) << 7) | (p[1] & 0x7f)); + f->st.y = -(s8)(((p[3] & 1) << 7) | (p[2] & 0x7f)); + f->pressure = (s8)(p[4] & 0x7f); + f->first_mp = 0; + f->is_mp = 0; break; case SS4_PACKET_ID_IDLE: @@ -1348,12 +1341,21 @@ static void alps_process_packet_ss4_v2(struct psmouse *psmouse) /* Report trackstick */ if (alps_get_pkt_id_ss4_v2(packet) == SS4_PACKET_ID_STICK) { - if (priv->flags & ALPS_DUALPOINT) { - 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); - input_sync(dev2); + if (!(priv->flags & ALPS_DUALPOINT)) { + psmouse_warn(psmouse, + "Rejected trackstick packet from non DualPoint device"); + return; } + + input_report_rel(priv->dev2, REL_X, f->st.x); + input_report_rel(priv->dev2, REL_Y, f->st.y); + input_report_abs(priv->dev2, ABS_PRESSURE, f->pressure); + + 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); + + input_sync(dev2); return; }