diff -urN gpm-1.19.6/Makefile.in gpm-1.19.6.new/Makefile.in
--- gpm-1.19.6/Makefile.in	Wed Oct  3 23:17:45 2001
+++ gpm-1.19.6.new/Makefile.in	Sat Feb  9 00:49:14 2002
@@ -66,7 +66,7 @@
 # Configure & unconfigure
 
 distclean:	clean do-distclean
-	rm -f config.log config.status config.cache Makefile TAGS
+	rm -f config.log config.status config.cache Makefile Makefile.include TAGS
 
 
 # Maintainer portion, use at your own risk
diff -urN gpm-1.19.6/README gpm-1.19.6.new/README
--- gpm-1.19.6/README	Tue Oct  2 16:33:55 2001
+++ gpm-1.19.6.new/README	Thu Feb  7 19:15:44 2002
@@ -21,7 +21,7 @@
 distributions and the Jed editor use gpm as well, and the same do
 several custom applications.
 
-There are still some new feautures to add (f.i. clean devfs support).
+There are still some new features to add (f.i. clean devfs support).
 Some of gpm's code needs a cleanup.
 
 For additionally documentation and other READMEs have a look into doc/.
@@ -74,11 +74,11 @@
 files (detected during the "configure" step); info files are installed
 under $(prefix)/info.
 
-If any error occur, please report them to me. Something like this
+If any errors occur, please report them to me. Something like this
 could be an easy (though brutal) way to do it:
  make clean; (uname -a; make) |& mail -s "gpm compile err." nicos@pcsystems.de
 
-What remains to do after installation  is a little configuration
+What remains to do after installation is a little configuration
 
 =========== CONFIGURING
 
@@ -128,7 +128,7 @@
 The directory "./doc" holds the documentation. The release embeds a
 postscript file, slightly reduced to save paper (doc/gpm2.ps), an info
 one (doc/gpm.info) and a text-only version (doc/gpmdoc.txt -- but
-without table of contents, by now).  Man pages are automatically
+without table of contents, for now).  Man pages are automatically
 extracted from the info file, and are installed with "make install"
 
 =========== BUG REPORTS
@@ -275,7 +275,7 @@
 		t-mouse: yet another regexp possibility
 
 Ian Zimmerman is now actively cooperating in maintaining gpm, so
-he'll no longer appear in the acknoledgements ;-)
+he'll no longer appear in the acknowledgements ;-)
 
 David Given (dg@tao.co.uk)
 		Offered support for joystick mouse emulation (1.14)
diff -urN gpm-1.19.6/doc/Makefile.in gpm-1.19.6.new/doc/Makefile.in
--- gpm-1.19.6/doc/Makefile.in	Wed Oct  3 22:51:46 2001
+++ gpm-1.19.6.new/doc/Makefile.in	Sat Feb  9 00:51:41 2002
@@ -79,7 +79,7 @@
 
 
 clean:
-	rm -f gpmdoc.ps gpm.info gpmdoc.txt $(MANPAGES) *~ 
+	rm -f gpmdoc.ps gpm.info gpmdoc.txt doc.gpm $(MANPAGES) *~ 
 	rm -f gpm.?? gpm.???
 	rm -f gpm.texinfo
 
diff -urN gpm-1.19.6/doc/doc.gpm.in gpm-1.19.6.new/doc/doc.gpm.in
--- gpm-1.19.6/doc/doc.gpm.in	Wed Oct  3 23:35:54 2001
+++ gpm-1.19.6.new/doc/doc.gpm.in	Sat Feb  9 00:54:55 2002
@@ -86,7 +86,7 @@
 @subtitle A general purpose mouse server for the Linux console
 @subtitle @value{update-month}
 
-@author by Nico Schottelius <nico@schottelius.org>
+@author by Nico Schottelius <nico@@schottelius.org>
 
 @end titlepage
 @setchapternewpage off
diff -urN gpm-1.19.6/doc/manpager gpm-1.19.6.new/doc/manpager
--- gpm-1.19.6/doc/manpager	Sun Sep 23 21:00:03 2001
+++ gpm-1.19.6.new/doc/manpager	Thu Feb  7 20:25:05 2002
@@ -37,12 +37,12 @@
 } 
 
 /@xref\{.*\}\./ {
-  gsub(/@xref\{.*\}\./,"");
+  gsub(/@xref{.*}\./,"");
 }
 
 /@ref\{.*\}/ {
-  gsub("@ref\{","");
-  gsub("\}","");
+  gsub("@ref{","");
+  gsub("}","");
 }
 
 /@\*/ {
diff -urN gpm-1.19.6/doc/mktxt gpm-1.19.6.new/doc/mktxt
--- gpm-1.19.6/doc/mktxt	Sun Sep 23 21:00:03 2001
+++ gpm-1.19.6.new/doc/mktxt	Thu Feb  7 20:22:46 2002
@@ -29,7 +29,7 @@
 NODELINE==5  { printf "\t\t\t\t"; NODELINE=0}
 
 
-/^* Menu:$/  { KEEP=0 }
+/^.* Menu:$/  { KEEP=0 }
 
 
 
diff -urN gpm-1.19.6/src/Makefile.in gpm-1.19.6.new/src/Makefile.in
--- gpm-1.19.6/src/Makefile.in	Tue Oct  2 16:26:25 2001
+++ gpm-1.19.6.new/src/Makefile.in	Sat Feb  9 01:02:15 2002
@@ -113,9 +113,10 @@
 	$(sbindir)/gpm $(libdir)/libgpm.a $(libdir)/libgpm.so $(includedir)/gpm.h 
 
 clean:
-	rm -f gpm $(PROG) libgpm.a libgpm.so.@abi_full@ $(RDEPS) core *~
+	rm -f gpm $(PROG) libgpm.a libgpm.so.@abi_full@ $(RDEPS) gpm-root.c core *~
 	rm -f *.elc TAGS
 	rm -f $(GOBJ) $(LOBJ) $(POBJ) $(PICS)
+	rm -r .depend
 
 # Configure & unconfigure
 
diff -urN gpm-1.19.6/src/gpm.c gpm-1.19.6.new/src/gpm.c
--- gpm-1.19.6/src/gpm.c	Mon Oct  1 22:02:25 2001
+++ gpm-1.19.6.new/src/gpm.c	Sat Feb  9 00:07:35 2002
@@ -333,6 +333,8 @@
 /*-------------------------------------------------------------------*/
 /*-------------------------------------------------------------------*/
 /*-------------------------------------------------------------------*/
+/* fetch the actual device data from the mouse device, dependent on
+ * what Gpm_Type is being passed. */
 static inline char *getMouseData(int fd, Gpm_Type *type, int kd_mode)
 {
   static unsigned char data[32]; /* quite a big margin :) */
@@ -401,6 +403,9 @@
 void get_console_size(Gpm_Event *ePtr);
 
 /*-------------------------------------------------------------------*/
+/* call getMouseData to get hardware device data, call mouse device's fun()
+ * to retrieve the hardware independent event data, then optionally repeat
+ * the data via repeat_fun() to the repeater device */
 static inline int processMouse(int fd, Gpm_Event *event, Gpm_Type *type,
 			       int kd_mode)
 {
@@ -498,7 +503,7 @@
     if (fifofd != -1 && ! opt_rawrep)
       {
         if (m_type->absolute) /* hof Wed Feb  3 21:43:28 MET 1999 */ 
-          { /*prepare the values from a absolute device for repeatermode */
+          { /* prepare the values from an absolute device for repeater mode */
              static struct timeval rept1,rept2;
              gettimeofday(&rept2, (struct timezone *)NULL);
              if (((rept2.tv_sec -rept1.tv_sec) *1000+(rept2.tv_usec-rept1.tv_usec)/1000)>250) 
@@ -1128,7 +1133,7 @@
     }
 /*....................................... got mouse, process event */
 /*
- * Well, actually, run a loop to mantain inlining of functions without
+ * Well, actually, run a loop to maintain inlining of functions without
  * lenghtening the file. This is not too clean a code, but it works....
  */
 
diff -urN gpm-1.19.6/src/gpn.c gpm-1.19.6.new/src/gpn.c
--- gpm-1.19.6/src/gpn.c	Sun Sep 23 21:00:03 2001
+++ gpm-1.19.6.new/src/gpn.c	Sat Feb  9 01:07:08 2002
@@ -184,13 +184,13 @@
   return 1;
 }
 
-/* itz Sat Sep 12 10:55:51 PDT 1998 Added this is replacement for the
+/* itz Sat Sep 12 10:55:51 PDT 1998 Added this as replacement for the
    unwanted functionality in check_uniqueness. */
 
 static void
 check_kill(void)
 {
-  int old_pid;
+  int old_pid, stale = 0;
   FILE* fp = fopen(GPM_NODE_PID, "r");
 
   if (0 == fp) {
@@ -201,14 +201,19 @@
     } /*if*/
   } /*if*/
   
-  if (1 != fscanf(fp,"%d",&old_pid)) {
-    oops(GPM_NODE_PID);
-  } /*if*/
+  if (1 != fscanf(fp,"%d",&old_pid))
+      stale = 1; /* file can't be parsed properly */
+
   fclose(fp);
 
-  if (-1 == kill(old_pid,0)) {
+  if (-1 == kill(old_pid,0))
+      stale = 1; /* kill() didn't work on this pid - wrong pid */
+
+  if (stale)
+  {
     gpm_debug_log(LOG_NOTICE, "Removing stale pid file %s", GPM_NODE_PID);
     unlink(GPM_NODE_PID);
+    exit(0);
   } /*if*/
 
   if (opt_kill) {
diff -urN gpm-1.19.6/src/headers/gpmInt.h gpm-1.19.6.new/src/headers/gpmInt.h
--- gpm-1.19.6/src/headers/gpmInt.h	Thu Sep 27 14:52:30 2001
+++ gpm-1.19.6.new/src/headers/gpmInt.h	Thu Feb  7 21:46:50 2002
@@ -62,7 +62,7 @@
   unsigned short flags;
   unsigned char proto[4];
   int packetlen;
-  int howmany;            /* howmany bytes to read at a time */
+  int howmany;            /* how many bytes to read at a time */
   int getextra;           /* does it get an extra byte? (only mouseman) */
   int absolute;           /* flag indicating absolute pointing device */
 
diff -urN gpm-1.19.6/src/mice.c gpm-1.19.6.new/src/mice.c
--- gpm-1.19.6/src/mice.c	Thu Sep 27 14:50:29 2001
+++ gpm-1.19.6.new/src/mice.c	Sat Feb  9 00:47:24 2002
@@ -356,7 +356,7 @@
   /* this is a little confusing. If we use the stylus, we
    * have three buttons (tip, lower, upper), and if
    * we use the puck we have four buttons. (And the
-   * protocol i a little mangled if several of the buttons
+   * protocol is a little mangled if several of the buttons
    * on the puck are pressed simultaneously. 
    * I don't use the puck, hence I try to decode three buttons
    * only. tip = left, lower = middle, upper = right
@@ -444,9 +444,9 @@
   /* sluggish... */
   buffer[0]=(state->buttons ^ 0x07) | 0x80;
   dx = limit_delta(state->dx, -256, 254);
-  buffer[3] =  state->dx - (buffer[1] = state->dx/2); /* Markus */
+  buffer[3] =  dx - (buffer[1] = dx/2); /* Markus */
   dy = limit_delta(state->dy, -256, 254);
-  buffer[4] = -state->dy - (buffer[2] = -state->dy/2);
+  buffer[4] = -dy - (buffer[2] = -dy/2);
   return write(fd,buffer,5);
 
 }
@@ -483,10 +483,22 @@
   return 0;
 }
 
+static Gpm_Type *I_ps2(int fd, unsigned short flags,
+	 struct Gpm_Type *type, int argc, char **argv)
+{
+  static unsigned char s[] = { 246, 230, 244, 243, 100, 232, 3, };
+  write (fd, s, sizeof (s));
+  usleep (30000);
+  tcflush (fd, TCIFLUSH);
+  return type;
+}
+
 static int M_ps2(Gpm_Event *state,  unsigned char *data)
 {
   static int tap_active=0; /* there exist glidepoint ps2 mice */
 
+  /*fprintf(stderr, "data   %02x/%02x/%02x\n", data[0], data[1], data[2]);*/
+
   state->buttons=
     !!(data[0]&1) * GPM_B_LEFT +
     !!(data[0]&2) * GPM_B_RIGHT +
@@ -518,9 +530,25 @@
   return 0;
 }
 
+static int R_ps2(Gpm_Event *state, int fd)
+{
+  signed char buffer[3];
+
+  buffer[0]=((state->buttons & GPM_B_LEFT  ) > 0)*1 +
+	    ((state->buttons & GPM_B_RIGHT ) > 0)*2 +
+	    ((state->buttons & GPM_B_MIDDLE) > 0)*4;
+  buffer[0] |= 8 +
+	      ((state->dx < 0) ? 0x10 : 0) +
+	      ((state->dy > 0) ? 0x20 : 0);
+  buffer[1] = limit_delta(state->dx, -128, 127);
+  buffer[2] = limit_delta(-state->dy, -128, 127);
+  /*fprintf(stderr, "buffer %02x/%02x/%02x\n", (char)buffer[0], (char)buffer[1], (char)buffer[2]);*/
+  return write(fd,buffer,3);
+}
+
 static int M_netmouse(Gpm_Event *state,  unsigned char *data)
 {
-  /* Avoid this beasts if you can.  They connect to normal PS/2 port,
+  /* Avoid these beasts if you can.  They connect to normal PS/2 port,
      but their protocol is one byte longer... So if you have notebook
      (like me) with internal PS/2 mouse, it will not work
      together. They have four buttons, but two middle buttons can not
@@ -665,10 +693,10 @@
   int  treshold;
 } wcmodell[] = {
   /* ModellName    Magic     MaxX     MaxY  Border  Tresh */
-     "UltraPad"  , "UD",        0,       0,    250,    20, 
-  /* "Intuos"    , "GD",        0,       0,      0,    20, not yet supported */
-     "PenPartner", "CT",        0,       0,      0,    20, 
-     "Graphire"  , "ET",     5103,    3711,      0,    20
+	{"UltraPad"  , "UD",        0,       0,    250,    20}, 
+  /* {"Intuos"    , "GD",        0,       0,      0,    20}, not yet supported */
+	{"PenPartner", "CT",        0,       0,      0,    20}, 
+	{"Graphire"  , "ET",     5103,    3711,      0,    20}
   };
 
 #define IsA(m) ((WacomModell==(-1))? 0:!strcmp(#m,wcmodell[WacomModell].name))
@@ -1687,7 +1715,8 @@
 
 /* intellimouse, ps2 version: Ben Pfaff and Colin Plumb */
 /* Autodetect: Steve Bennett */
-static Gpm_Type *I_imps2(int fd, unsigned short flags, struct Gpm_Type *type)
+static Gpm_Type *I_imps2(int fd, unsigned short flags,
+			 struct Gpm_Type *type, int argc, char **argv)
 {
   int id;
   static unsigned char basic_init[] = { GPM_AUX_ENABLE_DEV, GPM_AUX_SET_SAMPLE, 100 };
@@ -2096,8 +2125,8 @@
            "BusMouse", M_bm, I_empty, STD_FLG, /* bm is sun */
                                 {0xf8, 0x80, 0x00, 0x00}, 3, 3, 0, 0, 0},
   {"ps2",  "Busmice of the ps/2 series. Most busmice, actually.",
-           "PS/2", M_ps2, I_empty, STD_FLG,
-                                {0xc0, 0x00, 0x00, 0x00}, 3, 1, 0, 0, 0},
+           "PS/2", M_ps2, I_ps2, STD_FLG,
+                                {0xc0, 0x00, 0x00, 0x00}, 3, 1, 0, 0, R_ps2},
   {"ncr",  "Ncr3125pen, found on some laptops",
            "", M_ncr, NULL, STD_FLG,
                                 {0x08, 0x08, 0x00, 0x00}, 7, 7, 0, 1, 0},
diff -urN gpm-1.19.6/src/twiddler.c gpm-1.19.6.new/src/twiddler.c
--- gpm-1.19.6/src/twiddler.c	Thu Sep 27 14:52:18 2001
+++ gpm-1.19.6.new/src/twiddler.c	Thu Feb  7 21:27:43 2002
@@ -274,7 +274,7 @@
   char **table = twiddler_get_table(message);
   char *val;
   /*
-   * These two are needed to avoid trasmitting single keys when typing
+   * These two are needed to avoid transmitting single keys when typing
    * chords. When the number of keys being held down decreases, data
    * is transmitted; but as soon as it increases the cycle is restarted.
    */
