Mice, Linux, and KVM switches

Mice, Linux, and KVM switches

Post by Tim Smit » Wed, 26 Feb 2003 16:53:16



I spent a little while today looking at what the mouse sends when it is
working normally, and when it is screwed up after switching with a KVM
switch.  Here's what I saw.

1. When everything is happy, the mouse sends 4 bytes whenever anything
happens.  Here's what the bytes look like:

    +-------+-------+-------+-------+-------+-------+-------+-------+
    |   0   |   0   | Ymore | Xmore |   1   |   B3  |   B2  |   B1  |
    +-------+-------+-------+-------+-------+-------+-------+-------+
    |                       X position change                       |
    +-------+-------+-------+-------+-------+-------+-------+-------+
    |                       Y position change                       |
    +-------+-------+-------+-------+-------+-------+-------+-------+
    |                     wheel position change                     |
    +-------+-------+-------+-------+-------+-------+-------+-------+

The position changes are signed numbers, in ordinary two's compliment form.
For X, positive is right.  For Y, positive is away from you on the desk.
For the mouse, positive is scrolling down.

The B1, B2, and B3 bits are set when button's 1, 2, and 3, respectively are
down.

The Xmore and Ymore bits are one of the following:

    A. A copy of the high order bit of the corresponding position change
    byte.

    B. The X and Y position changes are really 9 bit two's compliment signed
    numbers, and Xmore and Ymore are the high order bit.

I was not able to move the mouse fast enough to make a big enough change to
tell those two possiblilities apart.

2. When the mouse gets borked so that the movement is not erratic, but the
wheel will only scroll down, it is still sending 4 bytes, but wheel position
changes are being truncated to 4 bits, so the last byte looks like this:

    +-------+-------+-------+-------+-------+-------+-------+-------+
    |   0   |   0   |   0   |   0   |    wheel position change      |
    +-------+-------+-------+-------+-------+-------+-------+-------+

This means that movement up one unit, instead of 0xFF, the computer gets
0x0F.  X seems to ignore that, so I'm *guessing* that they sanity check the
wheel input, and 0x0F is seen as too high, and discarded.

3. When the mouse gets into the "movement is totally erratic, and buttons
are being randomly pressed" mode, what has happened is that it has switched
to a non-wheel protocol.  That protocol seems to be basically the same as
the wheel protocol, except there is no wheel byte, so every mouse change
results in 3 bytes being sent, not 4.

4. It should not be too hard to detect case #3 in software.  The first byte
of the packet is of the form 00xx1xxx.  The X and Y movement bytes can only
match that pattern on a positive movement of [8,15], [24,31], [40,47], etc.

5. It should also not be too hard to detect case #2, because even when
trying, it was very hard to spin the wheel fast enough to get 0x0F.

6. I wonder how mice with more than three buttons work?  There are two bits
that were always 0 in the first byte...I wonder if those are for buttons 4
and 5?  I may have a mouse with more buttons lying around at work...if I can
find it, I'll have to check that out.

--
Evidence Eliminator is worthless: "www.evidence-eliminator-sucks.com"
--Tim Smith

 
 
 

Mice, Linux, and KVM switches

Post by Erik Funkenbusc » Wed, 26 Feb 2003 18:27:10



Quote:> I spent a little while today looking at what the mouse sends when it is
> working normally, and when it is screwed up after switching with a KVM
> switch.  Here's what I saw.

How were you measuring this?  Are you certain that this is the raw data from
the mouse, and not data which has been corrupted by a confused driver?

-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
   http://www.newsfeed.com       The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----

 
 
 

Mice, Linux, and KVM switches

Post by Jim Richardso » Thu, 27 Feb 2003 04:36:55


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 25 Feb 2003 08:53:16 -0600,

Quote:> I spent a little while today looking at what the mouse sends when it is
> working normally, and when it is screwed up after switching with a KVM
> switch.  Here's what I saw.

<snip>

I have been reading this from the sidelines but since I don't use a kvm
switch thingy haven't paid much attention. But I wondered, do you have a
mouse plugged into the ps-2 port on the computer in question? The reason
I ask, is I have seen problems with headless machines, with no ps-2
mouse or kbd, not responding to one that was plugged in later, after
bootup. Since Linux ignores much of the bios, in favour of "going it's
own" on the hardware detection route, it's possible that some of the
bios set up stuff doesn't happen, when the ps-2 ports have no devices
plugged into them. Just a thought.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+XChHd90bcYOAWPYRAk+SAJ9YQNxzeheZmOog0GZ6rnbLWuTzGQCdFwmQ
VHjKuQKeKnZGzoOHYiqGeEg=
=7yrB
-----END PGP SIGNATURE-----

--
Jim Richardson         http://www.eskimo.com/~warlock
A bad day, is when aliens attack, the dog bites you, and your boss tells
 you that the new client wants to make a few changes before delivery.
Linux, super computers, office computers, or home computers, it works.

 
 
 

Mice, Linux, and KVM switches

Post by Nucleo » Thu, 27 Feb 2003 08:07:21


<snip>

This sounds like a job for comp.os.linux.system, or whoever does the mouse
stuff in the kernel.

What are you getting this data from, the new input layer? some ps2 port
device?  X?

--

The more there are the better the best will be.

 
 
 

Mice, Linux, and KVM switches

Post by Tim Smit » Thu, 27 Feb 2003 08:12:49



> How were you measuring this?  Are you certain that this is the raw data
> from the mouse, and not data which has been corrupted by a confused
> driver?

I was reading /dev/mouse, which is a symlink to /dev/psaux on my system.  I
think that is raw data for PS/2 mice, although in a bit of brief looking, I
wasn't able to find the source for whatever is supplying the data.

--
Evidence Eliminator is worthless: "www.evidence-eliminator-sucks.com"
--Tim Smith

 
 
 

1. KVM switch's and linux mouse problem

I searched through google groups and found a solution that works for me.
psmouse.proto=bare
I placed this in line with my grub setting in
/boot/grub/menu.lst
It is near the end of the line that points to the "vmlinuz" kernel.
So far so good.
I am using the Belkin SOHO PS2 Omniview 4 port KVM.
so far I am in my happy place.

ronin42

2. Epson Stylus Color 640 and file size

3. KVM switch and wheel mouse

4. Allied Telesyn AT2560 Network card?

5. pc locks up when ps2 mouse is removed [via KVM switch]

6. Linux/PPP/routing problems

7. Mouse Problems With KVM Switches

8. Binutils 2.7.0.3 is released.

9. kvm switch mouse trouble

10. Mouse not recognized with KVM switch

11. Mouse Stops Functioning After KVM Is Switched

12. Kvm Switch and Erratic Mouse

13. USB keyboard/mouse with USB/KVM switch?