Module Name:    src
Committed By:   riz
Date:           Sat Nov 20 01:19:01 UTC 2010

Modified Files:
        src/sys/dev/pckbport [netbsd-5]: synaptics.c synapticsreg.h

Log Message:
Pull up following revision(s) (requested by plunky in ticket #1383):
        sys/dev/pckbport/synapticsreg.h: revision 1.6
        sys/dev/pckbport/synaptics.c: revision 1.22
        sys/dev/pckbport/synaptics.c: revision 1.23
        sys/dev/pckbport/synaptics.c: revision 1.24
some definitions from the Linux driver (via PR kern/42853)
Extended capability probes can confuse the passthrough device,
reset the touchpad on enable to cure that.
send the SET_SCALE11 command before the 'sliced' command as per the
Linux driver (and elantech(4)), via PR kern/42853


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.10.1 src/sys/dev/pckbport/synaptics.c
cvs rdiff -u -r1.5 -r1.5.56.1 src/sys/dev/pckbport/synapticsreg.h

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

Modified files:

Index: src/sys/dev/pckbport/synaptics.c
diff -u src/sys/dev/pckbport/synaptics.c:1.21 src/sys/dev/pckbport/synaptics.c:1.21.10.1
--- src/sys/dev/pckbport/synaptics.c:1.21	Wed Apr 30 14:07:14 2008
+++ src/sys/dev/pckbport/synaptics.c	Sat Nov 20 01:19:01 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: synaptics.c,v 1.21 2008/04/30 14:07:14 ad Exp $	*/
+/*	$NetBSD: synaptics.c,v 1.21.10.1 2010/11/20 01:19:01 riz Exp $	*/
 
 /*
  * Copyright (c) 2005, Steve C. Woodford
@@ -48,7 +48,7 @@
 #include "opt_pms.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.21 2008/04/30 14:07:14 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.21.10.1 2010/11/20 01:19:01 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -241,6 +241,10 @@
 		const char comma[] = ", ";
 		const char *sep = "";
 		aprint_normal_dev(psc->sc_dev, "");
+		if (sc->flags & SYN_FLAG_HAS_PASSTHROUGH) {
+			aprint_normal("%sPassthrough", sep);
+			sep = comma;
+		}
 		if (sc->flags & SYN_FLAG_HAS_MIDDLE_BUTTON) {
 			aprint_normal("%sMiddle button", sep);
 			sep = comma;
@@ -276,9 +280,19 @@
 {
 	struct pms_softc *psc = vsc;
 	struct synaptics_softc *sc = &psc->u.synaptics;
-	u_char cmd[2];
+	u_char cmd[2], resp[2];
 	int res;
 
+	if (sc->flags & SYN_FLAG_HAS_PASSTHROUGH) {
+		/* 
+		 * Extended capability probes can confuse the passthrough device;
+		 * reset the touchpad now to cure that.
+		 */
+		cmd[0] = PMS_RESET;
+		res = pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot, cmd,
+		    1, 2, resp, 1);
+	}
+
 	/*
 	 * Enable Absolute mode with W (width) reporting, and set
 	 * the packet rate to maximum (80 packets per second).
@@ -286,7 +300,7 @@
 	res = pms_synaptics_send_command(psc->sc_kbctag, psc->sc_kbcslot,
 	    SYNAPTICS_MODE_ABSOLUTE | SYNAPTICS_MODE_W | SYNAPTICS_MODE_RATE);
 	cmd[0] = PMS_SET_SAMPLE;
-	cmd[1] = 0x14; /* doit */
+	cmd[1] = SYNAPTICS_CMD_SET_MODE2;
 	res |= pckbport_enqueue_cmd(psc->sc_kbctag, psc->sc_kbcslot, cmd, 2, 0,
 	    1, NULL);
 	sc->up_down = 0;
@@ -616,13 +630,16 @@
 	u_char cmd[2];
 	int res;
 
+	cmd[0] = PMS_SET_SCALE11;
+	res = pckbport_poll_cmd(tag, slot, cmd, 1, 0, NULL, 0);
+
 	/*
 	 * Need to send 4 Set Resolution commands, with the argument
 	 * encoded in the bottom most 2 bits.
 	 */
 	cmd[0] = PMS_SET_RES;
 	cmd[1] = syn_cmd >> 6;
-	res = pckbport_poll_cmd(tag, slot, cmd, 2, 0, NULL, 0);
+	res |= pckbport_poll_cmd(tag, slot, cmd, 2, 0, NULL, 0);
 
 	cmd[0] = PMS_SET_RES;
 	cmd[1] = (syn_cmd & 0x30) >> 4;

Index: src/sys/dev/pckbport/synapticsreg.h
diff -u src/sys/dev/pckbport/synapticsreg.h:1.5 src/sys/dev/pckbport/synapticsreg.h:1.5.56.1
--- src/sys/dev/pckbport/synapticsreg.h:1.5	Wed Jan 17 23:14:03 2007
+++ src/sys/dev/pckbport/synapticsreg.h	Sat Nov 20 01:19:01 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: synapticsreg.h,v 1.5 2007/01/17 23:14:03 uwe Exp $	*/
+/*	$NetBSD: synapticsreg.h,v 1.5.56.1 2010/11/20 01:19:01 riz Exp $	*/
 
 /*
  * Copyright (c) 2005, Steve C. Woodford
@@ -45,6 +45,10 @@
 #define SYNAPTICS_READ_MODEL_ID		0x3
 #define SYNAPTICS_EXTENDED_QUERY	0x9
 
+/* Synaptics special commands */
+#define SYNAPTICS_CMD_SET_MODE2		0x14
+#define SYNAPTICS_CMD_CLIENT_CMD	0x28
+
 /* Magic numbers. */
 #define SYNAPTICS_MIN_VERSION		45 /* 4.5 */
 #define SYNAPTICS_MAGIC_BYTE		0x47
@@ -64,6 +68,7 @@
 #define SYNAPTICS_MODE_RATE		(1 << 6)
 #define SYNAPTICS_MODE_SLEEP		(1 << 3)
 #define SYNAPTICS_MODE_GEST		(1 << 2)
+#define SYNAPTICS_MODE_4BYTE_CLIENT	(1 << 1)
 #define SYNAPTICS_MODE_W		(1)
 
 /* Extended mode button masks. */

Reply via email to