[gpm]imps2 repeater

Andrew Pimlott andrew@pimlott.ne.mediaone.net
Thu, 21 Feb 2002 02:44:24 -0500


On Thu, Feb 21, 2002 at 02:28:35AM +0100, Nico Schottelius wrote:
> We need someone to test this patch. I don't have a ms3 compatible
> mouse. ASA we found someone and he/she says it's okay, I can apply it.

Ok, I found an ms3 mouse.  The patch tests fine, but ...

-D is broken:

    # ./gpm -m /dev/ttyS0 -t ms3 -Rms3 -D
    info: [/home/pimlott/src/gpm-1.20.0-beta/src/gpn.c(362)]: 
    Started gpm successfully. Entered daemon mode.
    oops(): [/home/pimlott/src/gpm-1.20.0-beta/src/gpn.c(364)]: 
    Setsid failed

This also leaves behind a pid file.  I did not look into it.

More importantly, the ms3 mouse repeated to X via ms3 suffered from
terrible "feel".  Reading from both an imps2 mouse and an ms3 mouse,
the ms3 mouse was clearly jerkier and harder to control.  I tried
Debian's 1.19.3, and in that case, both mice were fine.

The difference came down to the value of DEF_CLUSTER.  In stock gpm,
it is 10.  In Debian gpm, it is patched to 0.  In the Debian
changelog, there is an entry (from 1999):

  * Turned off mouse movement clustering, helps for me...

Clustering controls how many input packets gpm will read from a
device at once, before processing (ie, moving the cursor or
repeating), as long as select indicates that more data are
immediately available (look in gpm.c for the comment "cluster loop".
I guess the theory is that processing more at once is more efficient
(?).

In fact, this appears to be a big mistake.  Even if select says more
data are available, it's only the first byte.  For my ms3 mouse,
subsequent bytes seem to come in .01 second intervals, so the next
packet may not be done for .03 seconds.  This delay is clearly
human-perceptible.

Why this affects ms3 but not imps2 is probably just an artifact of
the different busses.  On the ps2 bus, the select in the cluster
loop never returns readable, in my tests.

Anyone who wants to test this should try any serial mouse with and
without the patch, ideally using a repeater with X.  The jerkiness
is perceptible on the console, but it is much more obvious in X
where the resolution is higher.

I vote for this patch.

Andrew

--- headers/gpmCfg.h.orig       Thu Feb 21 02:52:44 2002
+++ headers/gpmCfg.h    Thu Feb 21 02:52:51 2002
@@ -53,7 +53,7 @@
 #define DEF_ACCEL            2
 #define DEF_SCALE           10
 #define DEF_TIME           250    /* time interval (ms) for multiple clicks */
-#define DEF_CLUSTER         10    /* maximum number of clustered events */
+#define DEF_CLUSTER          0    /* maximum number of clustered events */
 #define DEF_THREE            0    /* have three buttons? */
 #define DEF_KERNEL           0    /* no kernel module, by default */