2001-03-25 22:34:59

by Linas Vepstas

[permalink] [raw]
Subject: mouse problems in 2.4.2



Hi,

I am experiencing debilitating intermittent mouse problems & was about
to dive into the kernel to see if I could debug it. But first, I thought
a quick note to the mailing list may help.

Symptoms:
After a long time of flawless operation (ranging from nearly a week to
as little as five minutes), the X11 pointer flies up to top-right corner,
and mostly wants to stay there. Moving the mouse causes a cascade of
spurious button-press events get generated.

This did not occur with 2.4.0test2 or 2.2.16 (to the best of my
recollection) and first showed up in 2.4.0test7 or 2.4.1 (not sure).
With 2.4.2, the symptoms seem slightly different (almost all pointer
movement events seem to be lost; although spurious button-press events
still happen).

Mouse is a logitech trackman marble, with USB connector to
logitech-supplied USB to ps/2 DIN plug. Configured as a PS/2 mouse.
Motherboard is a Athalon/VIA Apollo KA7.

Unplugging mouse for 10 seconds sometimes fixes the problem on the sixth
try, sometimes.

Switching to virtual terminal running gpm, and back to X11 used to fix
the problem, sometimes, after some magic incantations, unplugging,
starting gpm, moving mouse, etc. This no longer does the trick w/
2.4.2.

Rebooting X11 frequently, but not always, fixed the problem.

The *only* sure-fire fix is to reboot the system.

Sometimes, the mouse seemed usable with gpm even as it wasn't with X11;
sometimes it had the same bad behaviour (scooting to the corner,
spurious button-press) even under gpm.

Changing mouse protocols to imps2 from ps2 in gpm/X11 seems to make no
difference.

Disabling power management in kernel and bios to various degrees (including
disabling *all* power management) doesn't seem to fix anything. (It
was suggested to me that this was an APM bug; indeed, an early
manifestation of the bug seemed to be that it triggered if/when I moved
the mouse just as the video-powersave triggered. )

Sometimes, the problem seems to be associated with moving the mouse
during CPU-intensive or disk-i/o intensive operations (e.g. a large
file copy, compile; or system activity during mp3 playing) Lost
interrupt?

On rare ocasions, its associated with system lockup. (specifically,
some keyboard buffer seems to fill up, and everything seems hung,
not even ctrl-alt-del works). (I haven't checked to see if I can
still telnet in).

I've been living with this problem for 6+ months, and it is getting to
be infuriating. As you can see above, all sorts of different attempts
above make subtle variations in the symptoms, but no fixes.

I conclude that this is probably a hardware (motherboard chipset)
bug, that its rare (google/deja searches are unfruitful) and that
the only place to hunt is in the kernel.

---------------
So: any advice, comments, suggestions before I embark on a long and
possibly fruitless hunt? Any recommendations for best tools/proceedures
to catch it 'in the act'?

--linas

p.s. direct replies to [email protected] appreciated.




2001-03-26 00:28:52

by Stephen Satchell

[permalink] [raw]
Subject: Re: mouse problems in 2.4.2

I'm experiencing the same thing with an ASUS P5A-B running a K6-2/266 with
Linux 2.2.17, and Windows 98. Central problem appears to be the KVM
switch I'm using. Save yourself the problem.

I had to reboot all the systems to get regular mouse operation back with
the Logitech.

Satch


At 04:33 PM 3/25/01 -0600, you wrote:
>I am experiencing debilitating intermittent mouse problems & was about
>to dive into the kernel to see if I could debug it. But first, I thought
>a quick note to the mailing list may help.
>
>Symptoms:
>After a long time of flawless operation (ranging from nearly a week to
>as little as five minutes), the X11 pointer flies up to top-right corner,
>and mostly wants to stay there. Moving the mouse causes a cascade of
>spurious button-press events get generated.
>
>This did not occur with 2.4.0test2 or 2.2.16 (to the best of my
>recollection) and first showed up in 2.4.0test7 or 2.4.1 (not sure).
>With 2.4.2, the symptoms seem slightly different (almost all pointer
>movement events seem to be lost; although spurious button-press events
>still happen).
>
>Mouse is a logitech trackman marble, with USB connector to
>logitech-supplied USB to ps/2 DIN plug. Configured as a PS/2 mouse.
>Motherboard is a Athalon/VIA Apollo KA7.

2001-03-26 00:48:24

by Keith Owens

[permalink] [raw]
Subject: Re: mouse problems in 2.4.2

On Sun, 25 Mar 2001 16:27:37 -0800,
Stephen Satchell <[email protected]> wrote:
>I'm experiencing the same thing with an ASUS P5A-B running a K6-2/266 with
>Linux 2.2.17, and Windows 98. Central problem appears to be the KVM
>switch I'm using. Save yourself the problem.
>
>I had to reboot all the systems to get regular mouse operation back with
>the Logitech.

I sometimes have keyboard and mouse problems after changing machines
using a mechanical KVM, on a Logitech mouse. This script fixes it for
me.

/usr/local/bin/switched

#!/bin/sh
/etc/rc.d/init.d/gpm restart
/sbin/kbdrate -r 30

I run gpm in redirect -R mode as
daemon gpm -t $MOUSETYPE -R -m /dev/ttyS0
and tell X11 to read from /dev/gpmdata as
Protocol "MouseSystems"
Device "/dev/gpmdata"
not directly from the mouse; the redirect protocol is always
MouseSystems, no matter what the underlying mouse type is. Restarting
gpm after KVM switch then fixes everything else.

2001-03-26 03:23:24

by Linas Vepstas

[permalink] [raw]
Subject: Re: mouse problems in 2.4.2

It's been rumoured that Stephen Satchell said:
>
> I'm experiencing the same thing
[...]
> Central problem appears to be the KVM
> switch I'm using. Save yourself the problem.

Am not using a KVM switch, or any cable extenders, etc. The USB-to-PS2
connecter came with the mouse, so I assume its OK ... Besides, the
symptoms don't point at the connector.

--linas

2001-03-27 20:16:00

by Gunther.Mayer

[permalink] [raw]
Subject: Re: mouse problems in 2.4.2 -> lost byte

[email protected] wrote:

>
> I am experiencing debilitating intermittent mouse problems & was about
...
> Symptoms:
> After a long time of flawless operation (ranging from nearly a week to
> as little as five minutes), the X11 pointer flies up to top-right corner,
^^^^^^^^^^^^^^^^
> and mostly wants to stay there. Moving the mouse causes a cascade of
> spurious button-press events get generated.

This is easily explained: some byte of the mouse protocol was lost.
(Some mouse protocols are even designed to allow
easy resync/recovery by fixed bit patterns!)

Write an intelligent mouse driver for XFree86 to compensate for
lost bytes.

Regards, Gunther

APPENDIX
========

Output ot litte test program:
> a.out
Simulating 1 lost byte
1 -- ff 00 08 --- -256 : -248 Buttons=MRL Overflow/errors:XY
2 -- 00 04 08 --- 4 : 8 Buttons= Overflow/errors: T
3 -- 00 04 08 --- 4 : 8 Buttons= Overflow/errors: T
4 -- 00 03 08 --- 3 : 8 Buttons= Overflow/errors: T
5 -- 00 03 18 --- 3 : 24 Buttons= Overflow/errors: T
6 -- ff 02 08 --- -254 : -248 Buttons=MRL Overflow/errors:XY
7 -- 00 02 08 --- 2 : 8 Buttons= Overflow/errors: T
8 -- 00 03 18 --- 3 : 24 Buttons= Overflow/errors: T
9 -- ff 03 18 --- -253 : -232 Buttons=MRL Overflow/errors:XY
10 -- ff 03 08 --- -253 : -248 Buttons=MRL Overflow/errors:XY
...

Probably XFree ignores data packets with XY overflow set. All other
packets move you to top-right corner.

Moving your mouse will quickly show button mania, as described by your post.


Attachments:
gm_psauxprint.c (771.00 B)

2001-03-27 20:47:10

by Linas Vepstas

[permalink] [raw]
Subject: Re: mouse problems in 2.4.2 -> lost byte

It's been rumoured that Gunther Mayer said:
>
> > I am experiencing debilitating intermittent mouse problems & was about
> ...
> > Symptoms:
> > After a long time of flawless operation (ranging from nearly a week to
> > as little as five minutes), the X11 pointer flies up to top-right corner,
> ^^^^^^^^^^^^^^^^
> > and mostly wants to stay there. Moving the mouse causes a cascade of
> > spurious button-press events get generated.
>
> This is easily explained: some byte of the mouse protocol was lost.

Bing!

That's it! This would also explain why gpm seems to work i.e. correctly
process the events, even when X11 can't. I will take this up on the
Xf86 lists ...

> (Some mouse protocols are even designed to allow
> easy resync/recovery by fixed bit patterns!)

This mouse seems to set every fourth byte to zero, which should allow
syncing ...
I'm still investigating to see if the kernel buffer is overflowing ...


--linas