svn commit: r306746 - head/sys/dev/atkbdc

Oleksandr Tymoshenko gonzo at FreeBSD.org
Thu Oct 6 01:01:01 UTC 2016


Author: gonzo
Date: Thu Oct  6 01:01:00 2016
New Revision: 306746
URL: https://svnweb.freebsd.org/changeset/base/306746

Log:
  Fix extended buttons support on synaptic clickpad
  
  Fix regression introduced by r306355 on synaptic clickpads with
  extended buttons (buttons stopped working)
  
  PR:		205690
  Submitted by:	Vladimir Kondratyev <wulf at cicgroup.ru>

Modified:
  head/sys/dev/atkbdc/psm.c

Modified: head/sys/dev/atkbdc/psm.c
==============================================================================
--- head/sys/dev/atkbdc/psm.c	Thu Oct  6 00:51:27 2016	(r306745)
+++ head/sys/dev/atkbdc/psm.c	Thu Oct  6 01:01:00 2016	(r306746)
@@ -2750,7 +2750,9 @@ proc_synaptics(struct psm_softc *sc, pac
 	static int touchpad_buttons;
 	static int guest_buttons;
 	static finger_t f[PSM_FINGERS];
-	int w, id, nfingers, ewcode;
+	int w, id, nfingers, ewcode, extended_buttons;
+
+	extended_buttons = 0;
 
 	/* TouchPad PS/2 absolute mode message format with capFourButtons:
 	 *
@@ -2863,7 +2865,8 @@ proc_synaptics(struct psm_softc *sc, pac
 			if (pb->ipacket[1] & 0x02)
 				guest_buttons |= MOUSE_BUTTON3DOWN;
 
-			ms->button = touchpad_buttons | guest_buttons;
+			ms->button = touchpad_buttons | guest_buttons |
+			    sc->extended_buttons;
 		}
 		goto SYNAPTICS_END;
 
@@ -2933,30 +2936,26 @@ proc_synaptics(struct psm_softc *sc, pac
 		/* Middle Button */
 		if ((pb->ipacket[0] ^ pb->ipacket[3]) & 0x01)
 			touchpad_buttons |= MOUSE_BUTTON2DOWN;
-	} else if (sc->synhw.capExtended && sc->synhw.capClickPad) {
-		/* ClickPad Button */
-		if ((pb->ipacket[0] ^ pb->ipacket[3]) & 0x01)
-			touchpad_buttons = MOUSE_BUTTON1DOWN;
 	} else if (sc->synhw.capExtended && (sc->synhw.nExtendedButtons > 0)) {
 		/* Extended Buttons */
 		if ((pb->ipacket[0] ^ pb->ipacket[3]) & 0x02) {
 			if (sc->syninfo.directional_scrolls) {
 				if (pb->ipacket[4] & 0x01)
-					touchpad_buttons |= MOUSE_BUTTON4DOWN;
+					extended_buttons |= MOUSE_BUTTON4DOWN;
 				if (pb->ipacket[5] & 0x01)
-					touchpad_buttons |= MOUSE_BUTTON5DOWN;
+					extended_buttons |= MOUSE_BUTTON5DOWN;
 				if (pb->ipacket[4] & 0x02)
-					touchpad_buttons |= MOUSE_BUTTON6DOWN;
+					extended_buttons |= MOUSE_BUTTON6DOWN;
 				if (pb->ipacket[5] & 0x02)
-					touchpad_buttons |= MOUSE_BUTTON7DOWN;
+					extended_buttons |= MOUSE_BUTTON7DOWN;
 			} else {
 				if (pb->ipacket[4] & 0x01)
-					touchpad_buttons |= MOUSE_BUTTON1DOWN;
+					extended_buttons |= MOUSE_BUTTON1DOWN;
 				if (pb->ipacket[5] & 0x01)
-					touchpad_buttons |= MOUSE_BUTTON3DOWN;
+					extended_buttons |= MOUSE_BUTTON3DOWN;
 				if (pb->ipacket[4] & 0x02)
-					touchpad_buttons |= MOUSE_BUTTON2DOWN;
-				sc->extended_buttons = touchpad_buttons;
+					extended_buttons |= MOUSE_BUTTON2DOWN;
+				sc->extended_buttons = extended_buttons;
 			}
 
 			/*
@@ -2984,9 +2983,13 @@ proc_synaptics(struct psm_softc *sc, pac
 			 * Keep reporting MOUSE DOWN until we get a new packet
 			 * indicating otherwise.
 			 */
-			touchpad_buttons |= sc->extended_buttons;
+			extended_buttons |= sc->extended_buttons;
 		}
 	}
+	/* Handle ClickPad */
+	if (sc->synhw.capClickPad &&
+	    ((pb->ipacket[0] ^ pb->ipacket[3]) & 0x01))
+		touchpad_buttons |= MOUSE_BUTTON1DOWN;
 
 	if (sc->synhw.capReportsV && nfingers > 1)
 		f[0] = (finger_t) {
@@ -3023,7 +3026,7 @@ proc_synaptics(struct psm_softc *sc, pac
 		if (id >= nfingers)
 			PSM_FINGER_RESET(f[id]);
 
-	ms->button = touchpad_buttons | guest_buttons;
+	ms->button = touchpad_buttons;
 
 	/* Palm detection doesn't terminate the current action. */
 	if (!psmpalmdetect(sc, &f[0], nfingers)) {
@@ -3034,6 +3037,8 @@ proc_synaptics(struct psm_softc *sc, pac
 		VLOG(2, (LOG_DEBUG, "synaptics: palm detected! (%d)\n", f[0].w));
 	}
 
+	ms->button |= extended_buttons | guest_buttons;
+
 SYNAPTICS_END:
 	/*
 	 * Use the extra buttons as a scrollwheel


More information about the svn-src-head mailing list