[Gpm] Summa graphics tablet and Linux 2.4.3

Frank Heckenbach gpm@lists.prosa.it
Tue, 24 Apr 2001 02:50:36 +0200


Dear GPM developers,

I have a Summa compatible graphics tablet. After upgrading to kernel
2.4.3, gpm (1.19.3) stopped working correctly. strace showed that it
read some invalid bytes after the setspeed(). That prevented proper
detection of the tablet. (Apparently something about setting the
speed has changed in the kernel, but I don't know exactly.)

So I made the following change to just read off those bytes, and now
it works again for me. (I tried using tcflush(TCIFLUSH) instead, but
this didn't work, I don't know why.)

BTW, the `write(fd,0,1)' in the original code was wrong, since it
would not write a 0 byte, but rather a byte at address 0 (which
would result in EFAULT). I don't know what it was supposed to do, so
I removed it, apparently without harm.

Feel free to use my patch in future versions.

For replies, please note that I'm not subscribed to this list, so
please CC.

--- mice.c.orig	Tue Mar  7 15:10:00 2000
+++ mice.c	Sat Apr 14 17:15:47 2001
@@ -1674,11 +1674,6 @@
 static Gpm_Type *I_summa(int fd, unsigned short flags,
 			 struct Gpm_Type *type, int argc, char **argv) 
 {
-   void resetsumma()
-   {
-    write(fd,0,1); /* Reset */
-    usleep(400000); /* wait */
-   }
    int waitsumma()
    {
     struct timeval timeout;
@@ -1688,6 +1683,12 @@
     timeout.tv_sec = 0; timeout.tv_usec = 200000;
     err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout);
     return(err);
+   }
+   void resetsumma()
+   {
+    char dummy[100];
+    usleep(400000); /* wait */
+    while (waitsumma()>0)read(fd,dummy,100);
    }
   int err;
   char buffer[255];

Frank

-- 
Frank Heckenbach, frank@g-n-u.de
http://fjf.gnu.de/
PGP and GPG keys: http://fjf.gnu.de/plan