[gpm]Additional Synaptics patch against 1.20.1rc1

Ben Pfaff blp@cs.stanford.edu
06 Aug 2002 23:10:29 -0700


I just got a new IBM ThinkPad T30, which has an "UltraNav"
Synaptics-based touchpad/pointing stick mouse device on it.  The
1.20.1rc1 version of gpm works well on this with gpm's synps2
driver, except that the buttons don't work properly, especially
the middle button.  The first of the following patches takes care
of this for me.  I can't be sure that it doesn't screw things up
for other people, unfortunately, so feedback would be welcome.

The second and third patch fragments fix the configuration parser
in synaptics.c.  The sample gpm-syn.conf contains tabs, but the
configuration parser considers tabs as token parts instead of
delimiters.

Should I be working with the maintainer of synaptics.c on this
directly?  It's unclear from the file who the current maintainer
is, so I'm sending this to the gpm list.

--- tmp/gpm-cvs/src/synaptics.c	Fri May 31 14:58:40 2002
+++ gpm-cvs/src/synaptics.c	Tue Aug  6 22:57:22 2002
@@ -1105,16 +1105,15 @@
      * thereby returning a non-clicked state between the packets. Maybe
      * press-lock mechanism is useful. Forget it, the styk supports it! */
     if((data[0] & 0xFC) == 0x84 && 
-       (data[1] & 0xCE) == 0x08 &&
+       (data[1] & 0xC8) == 0x08 &&
        (data[3] & 0xFC) == 0xC4){
 
       if (stick_enabled){
 	
 	state->buttons |=
-	  ((data[0]& 0x01) ? GPM_B_LEFT  : 0 )+
-	  ((data[0]& 0x02) ? GPM_B_RIGHT : 0 )+
-	  (((data[0] ^ data[3]) & 0x01) ? GPM_B_MIDDLE : 0) +
-	  (((data[0] ^ data[3]) & 0x02) ? GPM_B_FOURTH : 0);
+	  ((data[1] & 0x01) ? GPM_B_LEFT : 0) |
+	  ((data[1] & 0x02) ? GPM_B_RIGHT : 0) |
+	  ((data[1] & 0x04) ? GPM_B_MIDDLE : 0);
 	
 	state->dx=  ((data[1] & 0x10) ? data[4]-256 : data[4]);
 	state->dy= -((data[1] & 0x20) ? data[5]-256 : data[5]);
@@ -1801,7 +1800,7 @@
   }else{
     while (fgets (line, 80, config)) {
       if (line [0] == '[') {
-	if ( (token = strtok (line, "[] ")) ) {
+	if ( (token = strtok (line, "[] \t")) ) {
 	  param = 0;
 
 	  /* which param is it */
@@ -1814,7 +1813,7 @@
 	  if (!param_data [param].name) {
 	    gpm_report (GPM_PR_WARN,"Unknown parameter %s", token);
 	  } else {
-	    token = strtok (NULL, "[] ");
+	    token = strtok (NULL, "[] \t");
 
 	    switch (param_data [param].p_type) {
 	    case Integer_Param:

-- 
"The USA has no monopoly on stupidity.
 They just work longer hours."
--Richard Heathfield