<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"> 25-akpm/drivers/input/mouse/synaptics.c |  174 ++++++++++++++++++--------------
 1 files changed, 100 insertions(+), 74 deletions(-)

diff -puN drivers/input/mouse/synaptics.c~p00007_synaptics-old-proto drivers/input/mouse/synaptics.c
--- 25/drivers/input/mouse/synaptics.c~p00007_synaptics-old-proto	Tue Jul 29 14:57:07 2003
+++ 25-akpm/drivers/input/mouse/synaptics.c	Tue Jul 29 14:57:07 2003
@@ -394,20 +394,6 @@ void synaptics_disconnect(struct psmouse
 
 static void synaptics_parse_hw_state(unsigned char buf[], struct synaptics_data *priv, struct synaptics_hw_state *hw)
 {
-	hw-&gt;x = (((buf[3] &amp; 0x10) &lt;&lt; 8) |
-		 ((buf[1] &amp; 0x0f) &lt;&lt; 8) |
-		 buf[4]);
-	hw-&gt;y = (((buf[3] &amp; 0x20) &lt;&lt; 7) |
-		 ((buf[1] &amp; 0xf0) &lt;&lt; 4) |
-		 buf[5]);
-
-	hw-&gt;z = buf[2];
-	hw-&gt;w = (((buf[0] &amp; 0x30) &gt;&gt; 2) |
-		 ((buf[0] &amp; 0x04) &gt;&gt; 1) |
-		 ((buf[3] &amp; 0x04) &gt;&gt; 2));
-
-	hw-&gt;left  = (buf[0] &amp; 0x01) ? 1 : 0;
-	hw-&gt;right = (buf[0] &amp; 0x02) ? 1 : 0;
 	hw-&gt;up    = 0;
 	hw-&gt;down  = 0;
 	hw-&gt;b0    = 0;
@@ -418,32 +404,58 @@ static void synaptics_parse_hw_state(uns
 	hw-&gt;b5    = 0;
 	hw-&gt;b6    = 0;
 	hw-&gt;b7    = 0;
-	if (SYN_CAP_EXTENDED(priv-&gt;capabilities) &amp;&amp;
-	    (SYN_CAP_FOUR_BUTTON(priv-&gt;capabilities))) {
-		hw-&gt;up = ((buf[3] &amp; 0x01)) ? 1 : 0;
-		if (hw-&gt;left)
-			hw-&gt;up = !hw-&gt;up;
-		hw-&gt;down = ((buf[3] &amp; 0x02)) ? 1 : 0;
-		if (hw-&gt;right)
-			hw-&gt;down = !hw-&gt;down;
-	}
-	if (buf[3] == 0xC2 &amp;&amp; SYN_CAP_MULTI_BUTTON_NO(priv-&gt;ext_cap)) {
-		switch (SYN_CAP_MULTI_BUTTON_NO(priv-&gt;ext_cap) &amp; ~0x01) {
-		default:
-			; /* we did comment while initialising... */
-		case 8:
-			hw-&gt;b7 = ((buf[5] &amp; 0x08)) ? 1 : 0;
-			hw-&gt;b6 = ((buf[4] &amp; 0x08)) ? 1 : 0;
-		case 6:
-			hw-&gt;b5 = ((buf[5] &amp; 0x04)) ? 1 : 0;
-			hw-&gt;b4 = ((buf[4] &amp; 0x04)) ? 1 : 0;
-		case 4:
-			hw-&gt;b3 = ((buf[5] &amp; 0x02)) ? 1 : 0;
-			hw-&gt;b2 = ((buf[4] &amp; 0x02)) ? 1 : 0;
-		case 2:
-			hw-&gt;b1 = ((buf[5] &amp; 0x01)) ? 1 : 0;
-			hw-&gt;b0 = ((buf[4] &amp; 0x01)) ? 1 : 0;
+
+	if (SYN_MODEL_NEWABS(priv-&gt;model_id)) {
+		hw-&gt;x = (((buf[3] &amp; 0x10) &lt;&lt; 8) |
+			 ((buf[1] &amp; 0x0f) &lt;&lt; 8) |
+			 buf[4]);
+		hw-&gt;y = (((buf[3] &amp; 0x20) &lt;&lt; 7) |
+			 ((buf[1] &amp; 0xf0) &lt;&lt; 4) |
+			 buf[5]);
+
+		hw-&gt;z = buf[2];
+		hw-&gt;w = (((buf[0] &amp; 0x30) &gt;&gt; 2) |
+			 ((buf[0] &amp; 0x04) &gt;&gt; 1) |
+			 ((buf[3] &amp; 0x04) &gt;&gt; 2));
+
+		hw-&gt;left  = (buf[0] &amp; 0x01) ? 1 : 0;
+		hw-&gt;right = (buf[0] &amp; 0x02) ? 1 : 0;
+		if (SYN_CAP_EXTENDED(priv-&gt;capabilities) &amp;&amp;
+		    (SYN_CAP_FOUR_BUTTON(priv-&gt;capabilities))) {
+			hw-&gt;up = ((buf[3] &amp; 0x01)) ? 1 : 0;
+			if (hw-&gt;left)
+				hw-&gt;up = !hw-&gt;up;
+			hw-&gt;down = ((buf[3] &amp; 0x02)) ? 1 : 0;
+			if (hw-&gt;right)
+				hw-&gt;down = !hw-&gt;down;
+		}
+		if (buf[3] == 0xC2 &amp;&amp; SYN_CAP_MULTI_BUTTON_NO(priv-&gt;ext_cap)) {
+			switch (SYN_CAP_MULTI_BUTTON_NO(priv-&gt;ext_cap) &amp; ~0x01) {
+			default:
+				; /* we did comment while initialising... */
+			case 8:
+				hw-&gt;b7 = ((buf[5] &amp; 0x08)) ? 1 : 0;
+				hw-&gt;b6 = ((buf[4] &amp; 0x08)) ? 1 : 0;
+			case 6:
+				hw-&gt;b5 = ((buf[5] &amp; 0x04)) ? 1 : 0;
+				hw-&gt;b4 = ((buf[4] &amp; 0x04)) ? 1 : 0;
+			case 4:
+				hw-&gt;b3 = ((buf[5] &amp; 0x02)) ? 1 : 0;
+				hw-&gt;b2 = ((buf[4] &amp; 0x02)) ? 1 : 0;
+			case 2:
+				hw-&gt;b1 = ((buf[5] &amp; 0x01)) ? 1 : 0;
+				hw-&gt;b0 = ((buf[4] &amp; 0x01)) ? 1 : 0;
+			}
 		}
+	} else {
+		hw-&gt;x = (((buf[1] &amp; 0x1f) &lt;&lt; 8) | buf[2]);
+		hw-&gt;y = (((buf[4] &amp; 0x1f) &lt;&lt; 8) | buf[5]);
+
+		hw-&gt;z = (((buf[0] &amp; 0x30) &lt;&lt; 2) | (buf[3] &amp; 0x3F));
+		hw-&gt;w = (((buf[1] &amp; 0x80) &gt;&gt; 4) | ((buf[0] &amp; 0x04) &gt;&gt; 1));
+
+		hw-&gt;left  = (buf[0] &amp; 0x01) ? 1 : 0;
+		hw-&gt;right = (buf[0] &amp; 0x02) ? 1 : 0;
 	}
 }
 
@@ -522,44 +534,58 @@ void synaptics_process_byte(struct psmou
 	struct input_dev *dev = &amp;psmouse-&gt;dev;
 	struct synaptics_data *priv = psmouse-&gt;private;
 	unsigned char data = psmouse-&gt;packet[psmouse-&gt;pktcnt - 1];
+	int newabs = SYN_MODEL_NEWABS(priv-&gt;model_id);
 
 	input_regs(dev, regs);
 
-	/* check first byte */
-	if (psmouse-&gt;pktcnt == 1 &amp;&amp; (data &amp; 0xC8) != 0x80) {
-		printk(KERN_WARNING "Synaptics driver lost sync at 1st byte\n");
-		priv-&gt;out_of_sync++;
-		psmouse-&gt;pktcnt = 0;
-	        if (psmouse_resetafter &gt; 0 &amp;&amp; priv-&gt;out_of_sync	== psmouse_resetafter) {
-			psmouse-&gt;state = PSMOUSE_IGNORE;
-			serio_rescan(psmouse-&gt;serio);
-		}
-		return;
-	}
-
-	/* check 4th byte */
-	if (psmouse-&gt;pktcnt == 4 &amp;&amp; (data &amp; 0xC8) != 0xC0) {
-		printk(KERN_WARNING "Synaptics driver lost sync at 4th byte\n");
-		priv-&gt;out_of_sync++;
-		psmouse-&gt;pktcnt = 0;
-	        if (psmouse_resetafter &gt; 0 &amp;&amp; priv-&gt;out_of_sync	== psmouse_resetafter) {
-			psmouse-&gt;state = PSMOUSE_IGNORE;
-			serio_rescan(psmouse-&gt;serio);
-		}
-		return;
-	}
-
-	if (psmouse-&gt;pktcnt &gt;= 6) { /* Full packet received */
-		if (priv-&gt;out_of_sync) {
-			priv-&gt;out_of_sync = 0;
-			printk(KERN_NOTICE "Synaptics driver resynced.\n");
-		}
-
-		if (priv-&gt;ptport &amp;&amp; synaptics_is_pt_packet(psmouse-&gt;packet))
-			synaptics_pass_pt_packet(priv-&gt;ptport, psmouse-&gt;packet);
-		else
-			synaptics_process_packet(psmouse);
+	switch (psmouse-&gt;pktcnt) {
+	case 1:
+		if (newabs ? ((data &amp; 0xC8) != 0x80) : ((data &amp; 0xC0) != 0xC0)) {
+			printk(KERN_WARNING "Synaptics driver lost sync at 1st byte\n");
+			goto bad_sync;
+		}
+		break;
+	case 2:
+		if (!newabs &amp;&amp; ((data &amp; 0x60) != 0x00)) {
+			printk(KERN_WARNING "Synaptics driver lost sync at 2nd byte\n");
+			goto bad_sync;
+		}
+		break;
+	case 4:
+		if (newabs ? ((data &amp; 0xC8) != 0xC0) : ((data &amp; 0xC0) != 0x80)) {
+			printk(KERN_WARNING "Synaptics driver lost sync at 4th byte\n");
+			goto bad_sync;
+		}
+		break;
+	case 5:
+		if (!newabs &amp;&amp; ((data &amp; 0x60) != 0x00)) {
+			printk(KERN_WARNING "Synaptics driver lost sync at 5th byte\n");
+			goto bad_sync;
+		}
+		break;
+	default:
+		if (psmouse-&gt;pktcnt &gt;= 6) { /* Full packet received */
+			if (priv-&gt;out_of_sync) {
+				priv-&gt;out_of_sync = 0;
+				printk(KERN_NOTICE "Synaptics driver resynced.\n");
+			}
 
-		psmouse-&gt;pktcnt = 0;
+			if (priv-&gt;ptport &amp;&amp; synaptics_is_pt_packet(psmouse-&gt;packet))
+				synaptics_pass_pt_packet(priv-&gt;ptport, psmouse-&gt;packet);
+			else
+				synaptics_process_packet(psmouse);
+
+			psmouse-&gt;pktcnt = 0;
+		}
+		break;
+	}
+	return;
+
+ bad_sync:
+	priv-&gt;out_of_sync++;
+	psmouse-&gt;pktcnt = 0;
+	if (psmouse_resetafter &gt; 0 &amp;&amp; priv-&gt;out_of_sync	== psmouse_resetafter) {
+		psmouse-&gt;state = PSMOUSE_IGNORE;
+		serio_rescan(psmouse-&gt;serio);
 	}
 }

_
</pre></body></html>