--- ../../gpm-1.20.0-pebl_old/src/synaptics.c	Fri Mar 22 02:00:09 2002
+++ synaptics.c	Thu Mar 21 01:06:46 2002
@@ -72,8 +72,9 @@
 **  Emulation of scrolling
 **        The window drivers allow using the edge to emulate a wheel
 **        mouse. When putting the finger at the right edge, a movement up or
-**        down translates to wheel movement. Lift the finger again to operate
-**        normally again.
+**        down translates to wheel movement. Taking the finger to the
+**        top/button edge keeps the wheel turning.  Lift the finger again to
+**        operate normally again.
 **
 **  Stick attached to a touchpad 
 **        Some touchpads have a stick "attached", so they share the same port.
@@ -160,9 +161,9 @@
 ** variables *_enabled are use for enable behaviors that may not supported in
 ** the touchpad.
 **
-** Many variables have two counterparts: a *_time and *_packet, where the first
-** is in msec and the latter is the same time converted to the number of
-** packets, when using 80 packets per second.
+** Many variables have two counterparts (and some that dont should have): a
+** *_time and *_packet, where the first is in msec and the latter is the same
+** time converted to the number of packets, when using 80 packets per second.
 **
 ** Variables:
 ** last_* is for last reviewed packet, not last reported/calculated movement/event.
@@ -173,7 +174,7 @@
 **
 ** syn_process_ps2_data   ---- syn_translate_serial_data    --                         -----------------------------------------------
 **                                (handles also wmode)       |                         |                            |
-**                                                           |                         |                            |
+**                                                           |                         |                            V
 **                                                           |- syn_preprocess_report --- syn_process_wmode_report --- syn_process_report
 **                                                           |                          
 ** syn_process_serial_data --- syn_translate_ps2_wmode_data --                                                       
@@ -196,11 +197,15 @@
 #include "headers/message.h"
 
 #define DEBUG                   1
-#undef  DEBUG_SYNAPTIC         
+#undef  DEBUG_SYNAPTIC          1
 #define DEBUG_PARAMS            1
 #define DEBUG_FLUSH             1
 #define DEBUG_SENT_DATA         1
+#define DEBUG_RECEIVED_DATA     1
 #define DEBUG_TOSS              1
+#define DEBUG_PALM              1
+#define DEBUG_STICK             1
+#define DEBUG_MULTI_FINGER      1
 #define DEBUG_REPORTS           1    /* this is VERY verbose */
 
 /* The next is UGLY, but I only want debug info from this file */
@@ -289,15 +294,14 @@
 static int   tap_range		     = 100;   /* mm finger movement limit  C */
 static int   tap_interval	     = 200;   /* a tap reports button press this long C*/
 static int   multiple_tap_delay      = 30;    /* time between reported button pressed C*/
+static int   pads_tap_interval       = 8;     /* if pad sends gestures, what is it's tap_interval. C*/
 
 /* wmode capabilities */
 static int   palm_detect_enabled     = 1;     /* Ignore when palm on pad   C */
 static int   palm_detect_level       = 12;    /* Detecting a palm level (between 0-11) C */
-static int   multi_finger_enabled    = 1;     /* Try detect multiple fingers  C */
-static int   finger2_threshold	     = 125;   /* pressure before 2 fingers C */
-static int   finger3_threshold	     = 195;   /* pressure before 3 fingers C */
-static int   multi_finger_move_enabled = 1;   /* less sensitive mouse with multi finger C*/
-static int   multi_finger_tap_enabled= 1;     /* no of fingers decides which button is pressed C*/
+static int   multi_finger_tap_enabled= 1;     /* No of fingers decides which button is pressed C*/
+static int   multi_finger_stop_enabled = 1;   /* less sensitive mouse with multi finger C*/
+static int   multi_finger_stop_delay = 8;     /* how long to stop after a multifinger detection. C*/
 
 
 /* mixed configurations */
@@ -307,7 +311,8 @@
                                            * it's packets.                                         C*/
 static int   touch_pad_enabled       = 1; /* Disable the touch pad, see corner action turn_on_off. C*/
 static int   scrolling_enabled       = 1; /* Simulate wheel mouse in at the right edge             C*/
-
+static int   scrolling_edge          = RIGHT_EDGE; /* Which edge is a the scrolling edge           C*/
+static int   auto_scrolling_enabled  = 1; /* Moving to the upper/lower edge keeps scrolling up/downC*/
 
 /*
 ** Types for describing corner actions.
@@ -338,6 +343,7 @@
   { 0,                  No_Action } /* stop flag value */
 };
 
+
 /*
 ** These types are used to read the configuration data from the config file.
 */
@@ -377,7 +383,7 @@
   /* toss/catch related parameters */
   { "min_toss_time",              Integer_Param, {&min_toss_time              }},
   { "max_toss_time",              Integer_Param, {&max_toss_time              }},
-  { "toss_cleanup_time",          Integer_Param, {&prevent_toss_time          }},
+  { "prevent_toss_time",          Integer_Param, {&prevent_toss_time          }},
   { "min_toss_dist",              Integer_Param, {&min_toss_dist              }},
   { "static_toss_speed",          Integer_Param, {&static_toss_speed          }},
   { "toss_speed_factor",          Float_Param,   {&toss_speed_factor          }},
@@ -397,19 +403,19 @@
   { "tap_range",		  Integer_Param, {&tap_range		      }},
   { "tap_interval",		  Integer_Param, {&tap_interval		      }},
   { "multiple_tap_delay",	  Integer_Param, {&multiple_tap_delay	      }},
+  { "pads_tap_interval",	  Integer_Param, {&pads_tap_interval	      }},
   /* Additional wmode parameters */				 			     
   { "palm_detect_enabled",	  Flag_Param,	 {&palm_detect_enabled	      }},
   { "palm_detect_level",	  Integer_Param, {&palm_detect_level	      }},
-  { "multi_finger_enabled",	  Flag_Param,	 {&multi_finger_enabled	      }},
-  { "finger2_threshold",	  Integer_Param, {&finger2_threshold	      }},
-  { "finger3_threshold",	  Integer_Param, {&finger3_threshold	      }},
-  { "multi_finger_move_enabled",  Flag_Param,    {&multi_finger_move_enabled  }},
   { "multi_finger_tap_enable",    Flag_Param,    {&multi_finger_tap_enabled   }},
+  { "multi_finger_stop_enabled",  Flag_Param,    {&multi_finger_stop_enabled  }},
+  { "multi_finger_stop_delay",    Integer_Param, {&multi_finger_stop_delay    }},
   /* Additional options*/
-  { "stick_enabled",	          Flag_Param,    {&stick_enabled	      }},
   { "touch_pad_enabled",	  Flag_Param,    {&touch_pad_enabled	      }},
+  { "stick_enabled",	          Flag_Param,    {&stick_enabled	      }},
   { "scrolling_enabled",	  Flag_Param,    {&scrolling_enabled	      }},
-  
+  { "scrolling_edge",	          Integer_Param, {&scrolling_edge	      }},
+  { "auto_scrolling_enabled",	  Flag_Param,    {&auto_scrolling_enabled     }},
   /* end of list */
   { NULL,                         Flag_Param,    {NULL                        }}
 };
@@ -599,7 +605,7 @@
 
 /* status information */
 static int           packet_num = 0;
-static int           last_edges = 0;
+static int           was_edges = 0;
 static int           was_non_edge = 0;
 static int           last_corner_action = GPM_B_NONE;
 static location_type last_locs [4];
@@ -624,7 +630,12 @@
 /* Multi finger information */
 static int           last_pressure = 0;
 static int           was_fingers = 0;
-static int           multi_finger_move_timer = 0;
+static int           multi_finger_stop_timer = 0;
+static int           multi_finger_reset_timer;
+static int           multi_finger_pressure  = 0;
+static int           multi_finger_xy = 0;
+
+
 
 /* Scrolling information */
 static int           is_scrolling = 0;
@@ -724,18 +735,24 @@
 
 
 /*
-** process_corner_taps
+** process_corner_taps. 
+**
+** last_corner_action holds the last action because then the second "tap" in
+** Tap hold and two taps do not to be at the corner, we just repeat the
+** action. This function is only called the at the first gesture report; at
+** consecutive gestures, the buttons are repeated other place. Action that
+** should not be repeated should report GPM_B_NONE.
 */
 void process_corner_taps (Gpm_Event *state, report_type report) 
 {
   int i = 0;
 
   if (corner_taps_enabled && report.gesture &&
-      (is_corner (last_edges) || last_corner_action != GPM_B_NONE)) {
+      (is_corner (was_edges) || last_corner_action != GPM_B_NONE)) {
     last_corner_action = GPM_B_NONE;
 
     while (corner_actions [i].corner_mask) {
-      if (check_bits (last_edges, corner_actions [i].corner_mask)) {
+      if (check_bits (was_edges, corner_actions [i].corner_mask)) {
 	switch (corner_actions [i].action) {
 	case Left_Button_Action:
 	  last_corner_action = GPM_B_LEFT;
@@ -757,7 +774,7 @@
           break;
 	case Turn_On_Off_Action:
 	  touch_pad_enabled = !touch_pad_enabled;
-	  last_corner_action = GPM_B_LAST;
+	  last_corner_action = GPM_B_NONE;
 	  break;
 	case Debug_On_Off_Action:
 	  /* This does not work with gpm_report: */
@@ -766,7 +783,7 @@
 	  /* 	  else */
 	  /* 	    gpm_debug_level = GPM_PR_DEBUG; */
 	  
-	  last_corner_action = GPM_B_LAST;
+	  last_corner_action = GPM_B_NONE;
 	  break;
 	case No_Action:
 	default:
@@ -784,6 +801,24 @@
   }
 }
 
+/*
+** is_corner_used
+*/
+
+int is_corner_used (int edges) {
+  int i = 0;
+
+    while (corner_actions [i].corner_mask) {
+      if (check_bits (edges, corner_actions [i].corner_mask)) {
+	return corner_actions [i].action;
+      }
+      i++;
+    }
+    
+    return GPM_B_NONE;
+}
+
+
 
 /*
 ** Dump the report data for debugging.
@@ -818,7 +853,7 @@
   last_report = report;
 
   gpm_report (GPM_PR_INFO,
-	      "\rSynps2: %c%c%c%c%c  %4dx%-4d %3d %2d  %c%c%c%c  %c%c    %3d%3d %d",
+	      "\rSynps2: %c%c%c%c%c  %4dx%-4d %3d %2d %d  %c%c%c%c  %c%c    %3d%3d %d    %8d %8d %c",
 	      report.fingers ? 'f' : '-',  
                  report.gesture ? 'g' : '-',
 
@@ -827,7 +862,7 @@
                  report.right   ? 'r' : '-',
 	      
                  report.x, report.y, report.pressure,
-	      report.w,
+	      report.w,was_fingers, 
 	      
                  edges & LEFT_EDGE   ? 'l' : '-',
                  edges & RIGHT_EDGE  ? 'r' : '-',
@@ -837,7 +872,11 @@
 	      report.gesture && !report.fingers ? 't' : '-',
 	      report.gesture && report.fingers  ? 'd' : '-',
 	      
-	      state->dx,state->dy,state->buttons);
+	      state->dx,state->dy,state->buttons,
+
+
+	      multi_finger_pressure,multi_finger_xy,
+	      (multi_finger_pressure>4500 && multi_finger_xy>50000? 'f':' '));
     
 }
 
@@ -876,10 +915,11 @@
       state->dx=  ((data[1] & 0x10) ? data[4]-256 : data[4]);
       state->dy= -((data[1] & 0x20) ? data[5]-256 : data[5]);
       
+#     ifdef DEBUG_STICK      
       gpm_report (GPM_PR_DEBUG,"StickData? %02x %02x %02x %02x %02x %02x :dx:%d dy:%d b:%d",
 		  data[0],data[1],data[2],data[3],data[4],data[5],
 		  state->dx,state->dy,state->buttons);
-
+#     endif
       return 1;
     }
 
@@ -894,9 +934,11 @@
    * 8-14 very wide finger or palm
    * 15   maximum reportable width     
    */
-  if (palm_detect_enabled && wmode_enabled && 
+  if (wmode_enabled && palm_detect_enabled &&  
       report->pressure != 0 && ((report->w - 4) >= palm_detect_level)){
+#   ifdef DEBUG_PALM
     gpm_report (GPM_PR_DEBUG,"\rSynps2: palm detected. w: %d",report->w); 
+#   endif
     /* BUG should not return 1, as this drops packets. Return a repeated report ? */
     /*       last_locs [mod4 (packet_num - 1)].x = report->x; */
     /*       last_locs [mod4 (packet_num - 1)].y = report->y; */
@@ -907,10 +949,14 @@
 
 
     
-  /* Check whether there is more than one finger on the pad */
+  /* Check whether there is one finger on the pad,
+  *  but only if pad does not report it, as it also report gestures then,
+  *  which it would signal independed on whether we detect fingers. */
+  if(wmode_enabled){
   report->fingers  = (report->pressure > finger_threshold);
+  }
   
-  if (multi_finger_enabled){
+  if (multi_finger_tap_enabled || multi_finger_stop_enabled){
     
     if (wmode_enabled && capabilities.cap_multi_finger){
       
@@ -919,68 +965,113 @@
 	report->fingers = 2+report->w;
 	fake_extra_finger = 0;
       }
+    }
       
       /* Extra check for vertical multi fingers which my pad is very bad to detect. 
        * Only check for extra fingers if w has not changed.
        * Faking fingers may go wrong so sanity check: */
-      if(report->fingers == 0)
+    if(report->fingers == 0){
 	fake_extra_finger = 0;
-      else
+#     ifdef DEBUG_REPORTS
+        multi_finger_pressure  = 0;
+        multi_finger_xy = 0;
+#     endif
+    }else
 	if (report->fingers + fake_extra_finger == last_fingers){
-	  if(report->pressure - last_pressure > 40){
-	    fake_extra_finger ++;
-	    was_fake_pressure = last_pressure;
-	  }else if ( (fake_extra_finger > 0) &&
-		     (report->pressure - was_fake_pressure < 20)){
+
+	multi_finger_pressure = sqr(report->pressure) - sqr(last_pressure);
+	multi_finger_xy = (sqr(last_locs [mod4 (packet_num - 1)].x - report->x) +
+			   sqr(last_locs [mod4 (packet_num - 1)].y - report->y) );
+
+	/* Check for a second finger. If the move is larger than tap range,
+	* then it is not a tap, and adding the finger does not change reported        
+	* buttons, but it will still stop the moving if
+	* multi_finger_stop_enabled is on. These tests are complete base on my
+	* imagination and experience, so any better idea are welcome. */
+	if(report->fingers == 1 && 
+	   multi_finger_pressure > 4500 && multi_finger_xy > 2*sqr((double)tap_range)){
+	    fake_extra_finger = 1;
+	    was_fake_pressure =  report->pressure;
+
+	}/* Check for third finger. */
+	else if(last_pressure > 180 && (report->fingers + fake_extra_finger) == 2 &&
+		 multi_finger_pressure > 4500 && multi_finger_xy > 2*sqr((double)tap_range)){
+	  fake_extra_finger = 2;
+	  was_fake_pressure = report->pressure;
+
+	} else if ( (fake_extra_finger > 0) &&
+		    (was_fake_pressure - report->pressure > 20)){
 	    fake_extra_finger --;
+
+	} else if(multi_finger_pressure < -5000 && multi_finger_xy > 2*sqr((double)tap_range)){
+	  /* Probably missed a placed multi finger, as this is one removed! */
+	  last_fingers ++;
 	  }
 	}
       
       report->fingers += fake_extra_finger;
     
-    }else{
-      if (report->pressure > finger2_threshold) report->fingers++;
-      if (report->pressure > finger3_threshold) report->fingers++;
     }
-  }
-
-  if (multi_finger_enabled && multi_finger_move_enabled){
 
 
     /* Check whether to reduce sensibility when adding or removing fingers */
+  if (multi_finger_stop_enabled){
+
+    /* Is a finger added or removed since last packet? */
     if( (report->fingers > 1 && report->fingers > last_fingers) ||
 	(last_fingers    > 1 && report->fingers < last_fingers) ){
-      multi_finger_move_timer  = 8;
 
+      /* Updating the timer right after another added/removed finger,
+       * would make the undo moving become redo, so dont.*/
+      if(multi_finger_stop_timer != multi_finger_stop_delay - 1)
+	multi_finger_stop_timer  = multi_finger_stop_delay;
+
+#     ifdef DEBUG_MULTI_FINGER
       gpm_report (GPM_PR_DEBUG,"%s multi finger %d %d %d",
 		  report->fingers > last_fingers ? "Add":"Remove",
 		  last_fingers,report->fingers,fake_extra_finger);
+#     endif
       
-    }else if(report->fingers == 0)
-	multi_finger_move_timer = 0;
-
+    } /* Should be tested last, because of undo moving when removing fingers. */
+    else if(report->fingers == 0){
+	multi_finger_stop_timer = 0;
+    }
 
-    /* Stop moving the mouse after a multi finger (un)detection*/
-    if( multi_finger_move_timer > 0){
+    /* Stop moving the mouse after a finger adding/removing. */
+    if( multi_finger_stop_timer > 0){
       last_locs [mod4 (packet_num - 1)].x = report->x;
       last_locs [mod4 (packet_num - 1)].y = report->y;
       last_locs [mod4 (packet_num - 2)].x = report->x;
       last_locs [mod4 (packet_num - 2)].y = report->y;
 
-      /* Undo the previous move (before detecting the change).*/
-      if (multi_finger_move_timer == 8){
+      /* Undo the previous move (before detecting of the adding/removing). */
+      if (multi_finger_stop_timer == multi_finger_stop_delay){
 	last_locs [mod4 (packet_num - 2)].x += last_state.dx * 2 / standard_speed_factor;
 	last_locs [mod4 (packet_num - 2)].y -= last_state.dy * 2 / standard_speed_factor;	
       }
 
-      multi_finger_move_timer --;
+      multi_finger_stop_timer --;
     }
   }
 
+  /* If wmode is not used, we do not know all the informations to reset the
+   * was_fingers variable, so set a timer to reset the variable when we believe it is time.
+   * pads_tap_interval is optimal when set to the touchpads tap_interval.
+   */
 
-  was_fingers = max(was_fingers,report->fingers);
+  if(!wmode_enabled){
+    if (report->fingers || report->gesture)
+      multi_finger_reset_timer = pads_tap_interval;
+
+    if(multi_finger_reset_timer > 0)
+      multi_finger_reset_timer --;
+    else
+      was_fingers = 0;
+  }
 
 
+  was_fingers = max(was_fingers,report->fingers);
+
   return 0;
 }
 
@@ -1196,20 +1287,25 @@
 
       /* Is this start of scrolling? */
       if (scrolling_enabled && !is_scrolling)
-	is_scrolling  = ((edges & RIGHT_EDGE)  &&
-			 !was_non_edge         &&
-			 (!corner_taps_enabled ||
-			  !is_corner (edges)));
+	is_scrolling  = ((edges & scrolling_edge)  &&
+			 !was_non_edge         && /* Must start at edge */
+			 !last_gesture         && /* No consecutive tap */
+			 (!corner_taps_enabled || /* Corner disabled or */
+			  !is_corner (edges)));   /* no corner          */
 
 
       /* 
-      ** if edge motion is enabled, only activate if we moved into
-      ** the edge.  And this isn't a corner tap.
+      ** if edge motion is enabled, only activate if we moved into the edge or
+      ** if not using the corners.  Dont activate right away after a gesture
+      ** from a corner tap. No harm is done if activated when scrolling (as
+      ** long as the scrolling edge is vertical).
       */
-      edge_motion_on = (edge_motion_enabled &&
-			edges &&
+      edge_motion_on = (edges  &&
+			((auto_scrolling_enabled && is_scrolling) ||
+			 (edge_motion_enabled   &&
 			(was_non_edge ||
-			 (!is_corner (edges) && last_corner_action != GPM_B_NONE)));
+			   !corner_taps_enabled ||
+			   (!is_corner(edges) && !last_gesture)))));
 
 
 
@@ -1257,7 +1353,7 @@
     } /* If (packet_num > 3)*/
 
     last_locs [mod4 (packet_num)] = loc;
-    last_edges = edges;
+    was_edges = edges;
     packet_num++;
   } else {
     /* No finger on the pad */
@@ -1346,7 +1442,7 @@
 
       if (report.down)	 state->buttons |= GPM_B_DOWN;
 
-      if ((tap_gesture_enabled && report.gesture && !is_corner (last_edges))){
+      if ((tap_gesture_enabled && report.gesture && !is_corner (was_edges))){
 
 	if( ( multi_finger_tap_enabled && (was_fingers == 0 || was_fingers == 1)) ||
 	    (!multi_finger_tap_enabled && was_fingers > 0))
@@ -1422,7 +1518,7 @@
 
 	  /* was a param found? */
 	  if (!param_data [param].name) {
-	    gpm_report (GPM_PR_INFO,"Unknown parameter %s", token);
+	    gpm_report (GPM_PR_WARN,"Unknown parameter %s", token);
 	  } else {
 	    token = strtok (NULL, "[] ");
 
@@ -1430,7 +1526,7 @@
 	    case Integer_Param:
 	      *(param_data [param].addr.int_p) = strtol (token, &end_ptr, 0);
 	      if (end_ptr == token)
-		gpm_report (GPM_PR_INFO,"Value (%s) for parameter %s is invalid",
+		gpm_report (GPM_PR_WARN,"Value (%s) for parameter %s is invalid",
                                token, param_data [param].name);
 #             if DEBUG_PARAMS
 	      gpm_report (GPM_PR_INFO,"Param %s set to %d",
@@ -1442,7 +1538,7 @@
 	    case Float_Param:
 	      *(param_data [param].addr.float_p) = strtod (token, &end_ptr);
 	      if (end_ptr == token)
-		gpm_report (GPM_PR_INFO,"Value (%s) for parameter %s is invalid",
+		gpm_report (GPM_PR_WARN,"Value (%s) for parameter %s is invalid",
                                token, param_data [param].name);
 #             if DEBUG_PARAMS
 	      gpm_report (GPM_PR_INFO,"Param %s set to %3.3f",
@@ -1457,7 +1553,7 @@
 	      } else if (index ("NnFf0", token [0])) {
 		*(param_data [param].addr.flag_p) = 0;
 	      } else {
-		gpm_report (GPM_PR_INFO,"Value (%s) for parameter %s is invalid",
+		gpm_report (GPM_PR_WARN,"Value (%s) for parameter %s is invalid",
                                token, param_data [param].name);
 	      }
 #             if DEBUG_PARAMS
@@ -1472,7 +1568,7 @@
 	      param_data [param].addr.corner_p->action = strtol (token,
 								 &end_ptr, 0);
 	      if (end_ptr == token)
-		gpm_report (GPM_PR_INFO,"Value (%s) for parameter %s is invalid",
+		gpm_report (GPM_PR_WARN,"Value (%s) for parameter %s is invalid",
                                token, param_data [param].name);
 #             if DEBUG_PARAMS
 	      gpm_report (GPM_PR_INFO,"Param %s set to %d",
@@ -1646,7 +1742,7 @@
   ser_read (fd, junk, strlen (cmd));
 #if DEBUG_FLUSH
   junk [strlen (cmd)] = '\0';
-  gpm_report (GPM_PR_INFO,"serial tossing: %s", junk);
+  gpm_report (GPM_PR_DEBUG,"serial tossing: %s", junk);
 #endif
 }
 
@@ -1658,7 +1754,7 @@
 
   sprintf (bytes, "%%C3B%02X5555", mode);
 #if DEBUG_SENT_DATA
-  gpm_report (GPM_PR_INFO,"modes: %s", bytes);
+  gpm_report (GPM_PR_DEBUG,"modes: %s", bytes);
 #endif
   ser_send_cmd (fd, bytes);
 }
@@ -1720,7 +1816,7 @@
     
 #   if DEBUG_SENT_DATA
       bytes [6] = '\0';
-      gpm_report (GPM_PR_INFO,"Serial model id: %s", bytes);
+      gpm_report (GPM_PR_DEBUG,"Serial model id: %s", bytes);
 #   endif
 
   }else{
@@ -1743,7 +1839,7 @@
 
 #if DEBUG_SENT_DATA
   bytes [7] = '\0';
-  gpm_report (GPM_PR_INFO,"Serial capabilites: %s", bytes);
+  gpm_report (GPM_PR_DEBUG,"Serial capabilites: %s", bytes);
 #endif
 
   if (ident.info_major >= 4){
@@ -1903,7 +1999,7 @@
 
   ps2_status_rqst (fd, PS2_SYN_CMD_MODES, bytes);
 #if DEBUG_SENT_DATA
-  gpm_report (GPM_PR_INFO,"PS/2 modes: %02X", bytes [2]);
+  gpm_report (GPM_PR_DEBUG,"PS/2 modes: %02X", bytes [2]);
 #endif
 }
 
@@ -1917,7 +2013,7 @@
 
   ps2_status_rqst (fd, PS2_SYN_CMD_IDENTIFY, bytes);
   if (bytes [1] != PS2_SYN_STATUS_OK) {
-    gpm_report (GPM_PR_INFO,"PS/2 device doesn't appear to be a synaptics touchpad\n");
+    gpm_report (GPM_PR_ERR,"PS/2 device doesn't appear to be a synaptics touchpad\n");
     info->info_minor      = 0;
     info->info_model_code = 0;
     info->info_major      = 0;
@@ -1957,7 +2053,7 @@
   ps2_status_rqst (fd, PS2_SYN_CMD_CAPABILITIES, bytes);
 
   if (bytes [1] != PS2_SYN_STATUS_OK) {
-    gpm_report (GPM_PR_INFO,"PS/2 device doesn't appear to be a synaptics touchpad\n");
+    gpm_report (GPM_PR_ERR,"PS/2 device doesn't appear to be a synaptics touchpad\n");
     ext_cap_int = 0;
   }else{
     ext_cap_int = bytes[0] << 8 | bytes[2];
@@ -1982,8 +2078,8 @@
  * byte 3 |    0   |                     y-pos 7-12                          |
  * byte 4 |    0   |                     y-pos 1-6                           |
  * byte 5 |    0   |                  z pressure 7-2                         |
- * byte 6 |    0   |  down    |   up     |y-pos 0 | x-pos 0 | z pressure 0-1 |
- * byte 7 |    0   |      reserved       |       W mode 0-3                  |
+ * byte 6 |    0   |  down    |   up     |y-pos 0 | x-pos 0 | z pressure 0-1 |  (new_abs set)
+ * byte 7 |    0   |      reserved       |       W mode 0-3                  |  (new_abs and wmode set)
  */
 
 
@@ -2094,9 +2190,12 @@
    } else { /* Garbage or not
 	     * The synaptics pad keeps sending data 1 sec after last touch
 	    */
+#   ifdef DEBUG_RECEIVED_DATA
     gpm_report (GPM_PR_INFO,"Garbage or tossing PS/2 data: ");
     for (i = 0; i < 6; i++)
       gpm_report (GPM_PR_INFO,"%02X ", data [i]);
+#   endif
+
     report->left     = 0;
     report->middle   = 0;
     report->right    = 0;
@@ -2156,9 +2255,12 @@
   } else { /* Packet is garbage or not?? The synaptics pad keeps sending data 1
 	    * sec after last touch, 
 	    */
+#   ifdef DEBUG_RECEIVED_DATA
     gpm_report (GPM_PR_INFO,"garbage or tossing PS/2 data: ");
     for (i = 0; i < 6; i++)
       gpm_report (GPM_PR_INFO,"%02X ", data [i]);
+#   endif
+
     report->left     = 0;
     report->middle   = 0;
     report->right    = 0;
@@ -2207,7 +2309,7 @@
 void syn_process_ps2_data (Gpm_Event *state,
 			   unsigned char *data) 
 {
-/*   gpm_report(GPM_PR_INFO,"Data %02x %02x %02x %02x %02x %02x",data[0],data[1],data[2],data[3],data[4],data[5]); */
+  /* gpm_report(GPM_PR_DEBUG,"Data %02x %02x %02x %02x %02x %02x",data[0],data[1],data[2],data[3],data[4],data[5]); */
 
   if (wmode_enabled) {
     syn_translate_ps2_wmode_data (data, &report);
