Skip to contentSkip to conversation

KVM & mouse wheel

PATCH Marko Macek 5 participants 11 messages Aug 3, 2004 – Aug 4, 2004

lore
Share & tools
lore
#0 lore raw

Hello!

A few months ago I posted about problems with 2.6 kernel, KVM and mouse wheel.

I was using 2.4 kernel until recently, but with the switch to FC2 with 2.6 kernel this problem became much more annoying.

My mouse is Logitech MX 510.

I figured out a few things.

1. Trying to set the mouse/kvm into a stream mode makes things insane. Since streaming mode is supposed to be the default, I propose not doing this at all. I haven't researched this further.

- psmouse_command(psmouse, param, PSMOUSE_CMD_SETSTREAM);

2. synaptics_detect hoses imps and exps detection. Resetting the mouse after failed detect fixes it. This makes 'imps' and 'exps' protocols work when used as proto=imps or proto=exps. Wheel works, I haven't tried the buttons.

3. PS2++ detection correctly detects Logitech MX mouse but doesn't enable the PS2PP protocol, because of unexpected results in this code:

	param[0] = param[1] = param[2] = 0;
        ps2pp_cmd(psmouse, param, 0x39); /* Magic knock */
        ps2pp_cmd(psmouse, param, 0xDB);

        if ((param[0] & 0x78) == 0x48 &&
            (param[1] & 0xf3) == 0xc2 &&
            (param[2] & 0x03) == ((param[1] >> 2) & 3)) {
                ps2pp_set_smartscroll(psmouse);
	        protocol = PSMOUSE_PS2PP;
        }

The returned param array in my case is: 08 01 00 or 08 00 00 (hex) (without KVM: C8 C2 64)

I don't understand what this code is trying to check or why the protocol is only set conditionally. If I set it unconditionally (swap last 2 lines) the PS2++ protocol now works including detection of all buttons (I don't really need the buttons, just the wheel).

This is not included in the patch. The alternative solution is to reset the mouse again and resume probing for imps or exps.

I plan on using the mouse in 'exps' mode since I haven't yet determined out how the PS2++ mode will cooperate with the other OS.

Please consider the patch.

Regards,
Mark

psmouse-base.c renamed from psmouse-base.c.orig +26 -20
@@ -418,28 +418,36 @@
 /*
  * Try Synaptics TouchPad
  */
-	if (max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse)) {
-		synaptics_hardware = 1;
-
-		if (set_properties) {
-			psmouse->vendor = "Synaptics";
-			psmouse->name = "TouchPad";
-		}
-
-		if (max_proto > PSMOUSE_IMEX) {
-			if (!set_properties || synaptics_init(psmouse) == 0)
-				return PSMOUSE_SYNAPTICS;
+	if (max_proto > PSMOUSE_PS2) {
+		if (synaptics_detect(psmouse)) {
+			synaptics_hardware = 1;
+
+			if (set_properties) {
+				psmouse->vendor = "Synaptics";
+				psmouse->name = "TouchPad";
+			}
+
+			if (max_proto > PSMOUSE_IMEX) {
+				if (!set_properties || synaptics_init(psmouse) == 0)
+					return PSMOUSE_SYNAPTICS;
 /*
  * Some Synaptics touchpads can emulate extended protocols (like IMPS/2).
  * Unfortunately Logitech/Genius probes confuse some firmware versions so
  * we'll have to skip them.
  */
-			max_proto = PSMOUSE_IMEX;
-		}
+				max_proto = PSMOUSE_IMEX;
+			}
 /*
  * Make sure that touchpad is in relative mode, gestures (taps) are enabled
  */
-		synaptics_reset(psmouse);
+			synaptics_reset(psmouse);
+		} else {
+/* 
+ * Reset mouse if synaptics detect failed (KVM switch problem)
+ */
+			psmouse_reset(psmouse);
+			psmouse_command(psmouse, NULL, PSMOUSE_CMD_RESET_DIS);
+		}
 	}
 
 	if (max_proto > PSMOUSE_IMEX && genius_detect(psmouse)) {
@@ -459,6 +467,10 @@
 		int type = ps2pp_init(psmouse, set_properties);
 		if (type > PSMOUSE_PS2)
 			return type;
+		else {
+			psmouse_reset(psmouse);
+			psmouse_command(psmouse, NULL, PSMOUSE_CMD_RESET_DIS);
+		}
 	}
 
 	if (max_proto >= PSMOUSE_IMEX && im_explorer_detect(psmouse)) {
@@ -589,12 +601,6 @@
 		psmouse_set_resolution(psmouse);
 		psmouse_command(psmouse,  NULL, PSMOUSE_CMD_SETSCALE11);
 	}
-
-/*
- * We set the mouse into streaming mode.
- */
-
-	psmouse_command(psmouse, param, PSMOUSE_CMD_SETSTREAM);
 }
 
 /*
#1 lore raw

Hi,

Quoted 10 lines · Marko Macek

Hello!

A few months ago I posted about problems with 2.6 kernel, KVM and mouse wheel.

I was using 2.4 kernel until recently, but with the switch to FC2 with 2.6 kernel this problem became much more annoying.

My mouse is Logitech MX 510.

Quoted 7 lines

I figured out a few things.

1. Trying to set the mouse/kvm into a stream mode makes things insane. Since streaming mode is supposed to be the default, I propose not doing this at all. I haven't researched this further.

- psmouse_command(psmouse, param, PSMOUSE_CMD_SETSTREAM);

Could you describe what insane mean? If you take the KVM out of the picture is the mouse still instane?

Quoted 6 lines

2. synaptics_detect hoses imps and exps detection. Resetting the mouse after failed detect fixes it. This makes 'imps' and 'exps' protocols work when used as proto=imps or proto=exps. Wheel works, I haven't tried the buttons.

Again, does it work without the KVM?

Quoted 14 lines

3. PS2++ detection correctly detects Logitech MX mouse but doesn't enable the PS2PP protocol, because of unexpected results in this code:

	param[0] = param[1] = param[2] = 0;
         ps2pp_cmd(psmouse, param, 0x39); /* Magic knock */
         ps2pp_cmd(psmouse, param, 0xDB);

         if ((param[0] & 0x78) == 0x48 &&
             (param[1] & 0xf3) == 0xc2 &&
             (param[2] & 0x03) == ((param[1] >> 2) & 3)) {
                 ps2pp_set_smartscroll(psmouse);
	        protocol = PSMOUSE_PS2PP;
         }
Quoted 8 lines

The returned param array in my case is: 08 01 00 or 08 00 00 (hex) (without KVM: C8 C2 64)

I don't understand what this code is trying to check or why the protocol is only set conditionally. If I set it unconditionally (swap last 2 lines) the PS2++ protocol now works including detection of all buttons (I don't really need the buttons, just the wheel).

Apparently your KVM doctors the data stream from the mouse. The driver tries to play safe and only switches to PS2++ protocol if mouse responds properly, otherwise there is a chance that it uses PS2++ with mouse that does not actually support it.

Quoted 3 lines

This is not included in the patch. The alternative solution is to reset the mouse again and resume probing for imps or exps.

It will be probed for imps/exps if PS2++ fails. Now I suspect that your particular KVM does not expect any extended probes and gets confused by them.

Signature · 1 line
Dmitry
#2 lore raw

Re: KVM & mouse wheel [was PATCH]

Quoted 21 lines · Dmitry Torokhov

Hi,

Quoted 16 lines · Marko Macek

Hello!

A few months ago I posted about problems with 2.6 kernel, KVM and mouse wheel.

I was using 2.4 kernel until recently, but with the switch to FC2 with 2.6 kernel this problem became much more annoying.

My mouse is Logitech MX 510.

I figured out a few things.

1. Trying to set the mouse/kvm into a stream mode makes things insane. Since streaming mode is supposed to be the default, I propose not doing this at all. I haven't researched this further.

Quoted 8 lines
Quoted 3 lines

- psmouse_command(psmouse, param, PSMOUSE_CMD_SETSTREAM);

Could you describe what insane mean? If you take the KVM out of the picture is the mouse still instane?

Insane means that the mouse is moving really slowly, jumping around and buttons work erratically. I did some more experiments and it seems that if I put this command before the resolution/rate/scaling setting it seems to do no harm (the mouse works perfectly). I'd still prefer to remove it since I see no need for it.

Quoted 11 lines
Quoted 7 lines

2. synaptics_detect hoses imps and exps detection. Resetting the mouse after failed detect fixes it. This makes 'imps' and 'exps' protocols work when used as proto=imps or proto=exps. Wheel works, I haven't tried the buttons.

Again, does it work without the KVM?

Yes, without the KVM the mouse works perfectly.

Quoted 27 lines
Quoted 16 lines

3. PS2++ detection correctly detects Logitech MX mouse but doesn't enable the PS2PP protocol, because of unexpected results in this code:

	param[0] = param[1] = param[2] = 0;
        ps2pp_cmd(psmouse, param, 0x39); /* Magic knock */
        ps2pp_cmd(psmouse, param, 0xDB);

        if ((param[0] & 0x78) == 0x48 &&
            (param[1] & 0xf3) == 0xc2 &&
            (param[2] & 0x03) == ((param[1] >> 2) & 3)) {
                ps2pp_set_smartscroll(psmouse);
	        protocol = PSMOUSE_PS2PP;
        }
Quoted 10 lines

The returned param array in my case is: 08 01 00 or 08 00 00 (hex) (without KVM: C8 C2 64)

I don't understand what this code is trying to check or why the protocol is only set conditionally. If I set it unconditionally (swap last 2 lines) the PS2++ protocol now works including detection of all buttons (I don't really need the buttons, just the wheel).

Quoted 7 lines

Apparently your KVM doctors the data stream from the mouse. The driver tries to play safe and only switches to PS2++ protocol if mouse responds properly, otherwise there is a chance that it uses PS2++ with mouse that does not actually support it.

Yeah, that's why I decided to fallback to im/exps modes instead.

I have now also successfuly used the extra mouse buttons with 'exps' protocol. So only the 'task' button is not supported with my previous patch (because it requires PS2++ mode).

Quoted 11 lines
Quoted 5 lines

This is not included in the patch. The alternative solution is to reset the mouse again and resume probing for imps or exps.

It will be probed for imps/exps if PS2++ fails. Now I suspect that your particular KVM does not expect any extended probes and gets confused by them.

I have also seen comments in X sources about needing to reset the mouse after each unsuccessful probe for best compatibility.

Mark

#3 lore raw
In reply to Dmitry Torokhov
Quoted 20 lines · Dmitry Torokhov

Hi,

Quoted 16 lines · Marko Macek

Hello!

A few months ago I posted about problems with 2.6 kernel, KVM and mouse wheel.

I was using 2.4 kernel until recently, but with the switch to FC2 with 2.6 kernel this problem became much more annoying.

My mouse is Logitech MX 510.

I figured out a few things.

1. Trying to set the mouse/kvm into a stream mode makes things insane. Since streaming mode is supposed to be the default, I propose not doing this at all. I haven't researched this further.

Quoted 6 lines
Quoted 1 line

- psmouse_command(psmouse, param, PSMOUSE_CMD_SETSTREAM);

Could you describe what insane mean? If you take the KVM out of the picture is the mouse still instane?

Insane means that the mouse is moving really slowly, jumping around and buttons work erratically. I did some more experiments and it seems that if I put this command before the resolution/rate/scaling setting it seems to do no harm (the mouse works perfectly). I'd still prefer to remove it since I see no need for it.

Quoted 8 lines
Quoted 5 lines

2. synaptics_detect hoses imps and exps detection. Resetting the mouse after failed detect fixes it. This makes 'imps' and 'exps' protocols work when used as proto=imps or proto=exps. Wheel works, I haven't tried the buttons.

Again, does it work without the KVM?

Yes, without the KVM the mouse works perfectly.

Quoted 24 lines
Quoted 15 lines

3. PS2++ detection correctly detects Logitech MX mouse but doesn't enable the PS2PP protocol, because of unexpected results in this code:

   param[0] = param[1] = param[2] = 0;
        ps2pp_cmd(psmouse, param, 0x39); /* Magic knock */
        ps2pp_cmd(psmouse, param, 0xDB);
        if ((param[0] & 0x78) == 0x48 &&
            (param[1] & 0xf3) == 0xc2 &&
            (param[2] & 0x03) == ((param[1] >> 2) & 3)) {
                ps2pp_set_smartscroll(psmouse);
           protocol = PSMOUSE_PS2PP;
        }
Quoted 8 lines

The returned param array in my case is: 08 01 00 or 08 00 00 (hex) (without KVM: C8 C2 64)

I don't understand what this code is trying to check or why the protocol is only set conditionally. If I set it unconditionally (swap last 2 lines) the PS2++ protocol now works including detection of all buttons (I don't really need the buttons, just the wheel).

Quoted 5 lines

Apparently your KVM doctors the data stream from the mouse. The driver tries to play safe and only switches to PS2++ protocol if mouse responds properly, otherwise there is a chance that it uses PS2++ with mouse that does not actually support it.

Yeah, that's why I decided to fallback to im/exps modes instead.

I have now also successfuly used the extra mouse buttons with 'exps' protocol. So only the 'task' button is not supported with my previous patch (because it requires PS2++ mode).

Quoted 8 lines
Quoted 3 lines

This is not included in the patch. The alternative solution is to reset the mouse again and resume probing for imps or exps.

It will be probed for imps/exps if PS2++ fails. Now I suspect that your particular KVM does not expect any extended probes and gets confused by them.

I have also seen comments in X sources about needing to reset the mouse after each unsuccessful probe for best compatibility.

Mark

#5 lore raw
In reply to Marko Macek
Quoted 5 lines · Marko Macek

Hello!
A few months ago I posted about problems with 2.6 kernel, KVM and mouse wheel.
I was using 2.4 kernel until recently, but with the switch to FC2 with 2.6 kernel this problem became much more annoying.

I also had problems with my KVM switch and mouse when I initially moved to 2.6, but adding this kernel boot parameter fixed it, meybe it will help you as well : psmouse.proto=imps

My mouse was jumping all over the screen, clicking buttons at random, but since I added
append="psmouse.proto=imps"
to my lilo.conf everything has been working perfectly with every 2.6 kernel I've tried.

My mouse is a "Logitec MouseMan Wheel" (USB mouse, but connected to the KVM with a USB->PS/2 adapter), my KVM switch is an old 8port thing that I unfortunately don't know the name/brand of since I got it used and the label with that info on it is gone.

Hope that helps you :)

--
Jesper Juhl <[email protected]>

#4 lore raw
In reply to Dmitry Torokhov

I have a customer using a KVM device, the mouse works fine -until- the KVM is switched elsewhere and back. After that, the mouse sends garbage. X+Y movement data is completely hosed causing the mouse to jump around everywhere. If I remove the module and reload it, the mouse partially returns. X+Y movement is normal again however the buttons are now messed up. Sometimes the buttons seem constantly pressed or constantly released. The only way to recover normal mousing is to reboot.

This didn't happen back on 2.6.0-test8 and I don't think it happened on 2.6.7.

David

Quoted 80 lines · Dmitry Torokhov

Hi,

Quoted 10 lines · Marko Macek

Hello!

A few months ago I posted about problems with 2.6 kernel, KVM and mouse wheel.

I was using 2.4 kernel until recently, but with the switch to FC2 with 2.6 kernel this problem became much more annoying.

My mouse is Logitech MX 510.

Quoted 9 lines

I figured out a few things.

1. Trying to set the mouse/kvm into a stream mode makes things insane. Since streaming mode is supposed to be the default, I propose not doing this at all. I haven't researched this further.

- psmouse_command(psmouse, param, PSMOUSE_CMD_SETSTREAM);

Could you describe what insane mean? If you take the KVM out of the picture is the mouse still instane?

Quoted 7 lines

2. synaptics_detect hoses imps and exps detection. Resetting the mouse after failed detect fixes it. This makes 'imps' and 'exps' protocols work when used as proto=imps or proto=exps. Wheel works, I haven't tried the buttons.

Again, does it work without the KVM?

Quoted 14 lines

3. PS2++ detection correctly detects Logitech MX mouse but doesn't enable the PS2PP protocol, because of unexpected results in this code:

	param[0] = param[1] = param[2] = 0;
        ps2pp_cmd(psmouse, param, 0x39); /* Magic knock */
        ps2pp_cmd(psmouse, param, 0xDB);

        if ((param[0] & 0x78) == 0x48 &&
            (param[1] & 0xf3) == 0xc2 &&
            (param[2] & 0x03) == ((param[1] >> 2) & 3)) {
                ps2pp_set_smartscroll(psmouse);
	        protocol = PSMOUSE_PS2PP;
        }
Quoted 10 lines

The returned param array in my case is: 08 01 00 or 08 00 00 (hex) (without KVM: C8 C2 64)

I don't understand what this code is trying to check or why the protocol is only set conditionally. If I set it unconditionally (swap last 2 lines) the PS2++ protocol now works including detection of all buttons (I don't really need the buttons, just the wheel).

Apparently your KVM doctors the data stream from the mouse. The driver tries to play safe and only switches to PS2++ protocol if mouse responds properly, otherwise there is a chance that it uses PS2++ with mouse that does not actually support it.

Quoted 5 lines

This is not included in the patch. The alternative solution is to reset the mouse again and resume probing for imps or exps.

Quoted 6 lines

It will be probed for imps/exps if PS2++ fails. Now I suspect that your particular KVM does not expect any extended probes and gets confused by them.

begin:vcard
fn:David Ford
n:Ford;David
email;internet:[email protected]
title:Industrial Geek
tel;home:Ask please
tel;cell:(203) 650-3611
x-mozilla-html:TRUE
version:2.1
end:vcard

#6 lore raw
In reply to Jesper Juhl
Quoted 3 lines · Jesper Juhl

<>I also had problems with my KVM switch and mouse when I initially moved to 2.6, but adding this kernel boot parameter fixed it, meybe it will help you as well : psmouse.proto=imps

This doesn't help. Only the patch I sent helps me. The problem is that the even with psmouse.proto=imps or exps, the driver still probes for synaptics which I consider a bug.

Quoted 2 lines

My mouse is a "Logitec MouseMan Wheel" (USB mouse, but connected to the

I have this one too (besides MX), same problem. The problem is really the KVM switch and the 2.6 mouse driver.

Mark

#7 lore raw
Quoted 7 lines · Marko Macek
Quoted 4 lines · Jesper Juhl

<>I also had problems with my KVM switch and mouse when I initially moved to
2.6, but adding this kernel boot parameter fixed it, meybe it will help you as well : psmouse.proto=imps

Quoted 5 lines

This doesn't help. Only the patch I sent helps me. The problem is that the even with psmouse.proto=imps or exps, the driver still probes for synaptics which I
consider a bug.

No it is not - Synaptics with a track-point on a passthrough port will have track-point disabled if it is not reset after probing for imps/exps.

Signature · 1 line
Dmitry
#8 lore raw
Quoted 8 lines · Dmitry Torokhov
Quoted 7 lines · Marko Macek
Quoted 4 lines · Jesper Juhl

<>I also had problems with my KVM switch and mouse when I initially moved to
2.6, but adding this kernel boot parameter fixed it, meybe it will help you as well : psmouse.proto=imps

Quoted 8 lines
Quoted 5 lines

This doesn't help. Only the patch I sent helps me. The problem is that the even with psmouse.proto=imps or exps, the driver still probes for synaptics which I
consider a bug.

No it is not - Synaptics with a track-point on a passthrough port will have track-point disabled if it is not reset after probing for imps/exps.

Hmm, does the imps/exps probe succeed in this case?

Signature · 2 lines
Vojtech Pavlik
SuSE Labs, SuSE CR
#9 lore raw
Quoted 16 lines · Vojtech Pavlik
Quoted 14 lines · Dmitry Torokhov
Quoted 12 lines · Marko Macek
Quoted 4 lines · Jesper Juhl

<>I also had problems with my KVM switch and mouse when I initially moved to
2.6, but adding this kernel boot parameter fixed it, meybe it will help you as well : psmouse.proto=imps

This doesn't help. Only the patch I sent helps me. The problem is that the even with psmouse.proto=imps or exps, the driver still probes for synaptics which I
consider a bug.

Quoted 5 lines
Quoted 2 lines

No it is not - Synaptics with a track-point on a passthrough port will have track-point disabled if it is not reset after probing for imps/exps.

Hmm, does the imps/exps probe succeed in this case?

No, it does not, at least not mine. It either does bare PS/2 or native, but there are other Synaptics touchpads that can also do imps.

Signature · 1 line
Dmitry
#10 lore raw
Quoted 17 lines · Dmitry Torokhov
Quoted 16 lines · Vojtech Pavlik
Quoted 14 lines · Dmitry Torokhov
Quoted 12 lines · Marko Macek
Quoted 4 lines · Jesper Juhl

<>I also had problems with my KVM switch and mouse when I initially moved to
2.6, but adding this kernel boot parameter fixed it, meybe it will help you as well : psmouse.proto=imps

This doesn't help. Only the patch I sent helps me. The problem is that the even with psmouse.proto=imps or exps, the driver still probes for synaptics which I
consider a bug.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

No it is not - Synaptics with a track-point on a passthrough port will have track-point disabled if it is not reset after probing for imps/exps.

Hmm, does the imps/exps probe succeed in this case?

No, it does not, at least not mine. It either does bare PS/2 or native, but there are other Synaptics touchpads that can also do imps.

Ok, so how about issuing a reset when the imps probe fails? That'd take care of all the cases, and I suppose a Synaptics pad that can do imps will not be confused by it.

Signature · 2 lines
Vojtech Pavlik
SuSE Labs, SuSE CR