NetBSD Problem Report #52489

From www@NetBSD.org  Wed Aug 16 20:50:42 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 4BC3F7A26E
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 16 Aug 2017 20:50:42 +0000 (UTC)
Message-Id: <20170816205038.D398B7A2AA@mollari.NetBSD.org>
Date: Wed, 16 Aug 2017 20:50:38 +0000 (UTC)
From: coypu@sdf.org
Reply-To: coypu@sdf.org
To: gnats-bugs@NetBSD.org
Subject: (patch) touchpad doesn't work after ALPS commit
X-Send-Pr-Version: www-1.0

>Number:         52489
>Category:       kern
>Synopsis:       (patch) touchpad doesn't work after ALPS commit
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 16 20:55:00 +0000 2017
>Closed-Date:    Fri Aug 18 10:39:04 +0000 2017
>Last-Modified:  Tue Jun 19 22:32:15 +0000 2018
>Originator:     coypu
>Release:        NetBSD 8.99.1
>Organization:
>Environment:
NetBSD localhost 8.99.1 NetBSD 8.99.1 (LOCKDEBUG) #4: Wed Aug 16 19:57:25 UTC 2017  fly@:/home/fly/obj/sys/arch/i386/compile/LOCKDEBUG i386

>Description:
I have an ALPS touchpad, but not one of the versions supported. ALPS
signature mismatch.

After ALPS probe, probably it gets into the 'wrong mode' and then
attempting to use it as a PS/2 mouse fails (no response at all, no
changes from trying though).

Sending as PR because I can't commit for the next few days and other
people may experience the same issue, and unnecessarily spend time
investigating it too.
>How-To-Repeat:

>Fix:
If ALPS probe fails, send a PMS_RESET.
Restores functionality on a wrong version ALPS touchpad

diff --git a/sys/dev/pckbport/alps.c b/sys/dev/pckbport/alps.c
index ffeb7d96e..fa409ca87 100644
--- a/sys/dev/pckbport/alps.c
+++ b/sys/dev/pckbport/alps.c
@@ -685,6 +685,8 @@ pms_alps_probe_init(void *opaque)
 	uint8_t e7sig[3];
 	uint8_t ecsig[3];
 	int res;
+	u_char cmd[1], resp[3];
+

 	sc->last_x1 = 0;
 	sc->last_y1 = 0;
@@ -726,8 +728,8 @@ pms_alps_probe_init(void *opaque)
 		aprint_normal_dev(psc->sc_dev,
 			"ALPS PS/2 V2 pointing device\n");
 	} else {
-		aprint_error_dev(psc->sc_dev, "No supported device found.\n");
-		return EINVAL;
+		res = EINVAL;
+		goto err;
 	}

 	/* From sysctl */
@@ -740,14 +742,17 @@ pms_alps_probe_init(void *opaque)
 		pckbport_set_inputhandler(psc->sc_kbctag, psc->sc_kbcslot,
 			pms_alps_input_v2, psc, device_xname(psc->sc_dev));
 	} else {
-		aprint_error_dev(psc->sc_dev, "No supported device found.\n");
-		return EINVAL;
+		res = EINVAL;
+		goto err;
 	}
 	/* Palm detection is enabled. */

 	return 0;

 err:
+	cmd[0] = PMS_RESET;
+	(void)pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot, cmd,
+	    1, 2, resp, 1);
 	aprint_error_dev(psc->sc_dev, "Failed to initialize an ALPS device.\n");
 	return res;
 }

>Release-Note:

>Audit-Trail:
From: "Nathanial Sloss" <nat@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52489 CVS commit: src/sys/dev/pckbport
Date: Wed, 16 Aug 2017 21:09:48 +0000

 Module Name:	src
 Committed By:	nat
 Date:		Wed Aug 16 21:09:48 UTC 2017

 Modified Files:
 	src/sys/dev/pckbport: alps.c

 Log Message:
 If ALPS probe fails, send a PMS_RESET.
 Restores functionality on a wrong version ALPS touchpad.

 Addresses PR kern/52489.

 This patch was prepared by/committed on behalf of maya@.


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pckbport/alps.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Fri, 18 Aug 2017 10:39:04 +0000
State-Changed-Why:
COmmitted by nat, thanks.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.