public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* KVM & mouse wheel
@ 2004-08-03 15:26 Marko Macek
  2004-08-03 17:53 ` Dmitry Torokhov
  2004-08-03 21:02 ` Jesper Juhl
  0 siblings, 2 replies; 12+ messages in thread
From: Marko Macek @ 2004-08-03 15:26 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: linux-kernel, Eric Wong

[-- Attachment #1: Type: text/plain, Size: 1927 bytes --]

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


[-- Attachment #2: linux-2.6.7-kvm-mouse.patch --]
[-- Type: text/x-patch, Size: 1996 bytes --]

--- psmouse-base.c.orig	2004-06-16 07:19:01.000000000 +0200
+++ psmouse-base.c	2004-08-03 17:21:24.948668832 +0200
@@ -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);
 }
 
 /*

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: KVM & mouse wheel
@ 2004-08-04 17:41 Dmitry Torokhov
  0 siblings, 0 replies; 12+ messages in thread
From: Dmitry Torokhov @ 2004-08-04 17:41 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: Marko Macek, Jesper Juhl, Eric Wong, LKML

[-- Attachment #1: Type: text/plain, Size: 2019 bytes --]

Vojtech Pavlik wrote:
> On Wed, Aug 04, 2004 at 07:38:55AM -0500, Dmitry Torokhov wrote:
> > On Wednesday 04 August 2004 02:18 am, Vojtech Pavlik wrote:
> > > On Wed, Aug 04, 2004 at 12:25:19AM -0500, Dmitry Torokhov wrote:
> > >
> > > > On Tuesday 03 August 2004 11:29 pm, Marko Macek wrote:
> > > > > Jesper Juhl wrote:
> > > > >
> > > > > > <>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.
> > > > >
> > > >
> > > > 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.
> 

Synaptics requires full reset, reset-disable alone is not enough.
Plus, when synaptics is detected but left in emulation mode, the
driver does synaptics-specific reset which initializes stuff that
survives reset-disable (for example it enables gestures so tapping
is guaranteed to work).

Additionally I think it's a good idea to detect hardware regardless
of the protocol it is using so user can see what he has. 

Anyway, I think that explicitely calling reset-disable after each
failed probe is a good idea... or maybe not after each probe but just
once, before probing for generic protocols (imps/exps), like in the
attached patch.

--
Dmitry



[-- Attachment #2: psmouse-probe.patch --]
[-- Type: application/octet-stream, Size: 471 bytes --]

--- linux-2.6.7/drivers/input/mouse/psmouse-base.c.orig	2004-08-04 12:30:55.985806400 -0500
+++ linux-2.6.7/drivers/input/mouse/psmouse-base.c	2004-08-04 12:34:15.392539200 -0500
@@ -461,6 +461,12 @@
 			return type;
 	}
 
+/*
+ * Reset to defaults in case the device got confused by extended
+ * protocol probes.
+ */
+	psmouse_command(psmouse, NULL, PSMOUSE_CMD_RESET_DIS);
+
 	if (max_proto >= PSMOUSE_IMEX && im_explorer_detect(psmouse)) {
 
 		if (set_properties) {

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-08-04 17:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-03 15:26 KVM & mouse wheel Marko Macek
2004-08-03 17:53 ` Dmitry Torokhov
2004-08-03 19:36   ` KVM & mouse wheel [was PATCH] Marko Macek
2004-08-03 19:42   ` KVM & mouse wheel Marko Macek
2004-08-03 23:14   ` David Ford
2004-08-03 21:02 ` Jesper Juhl
2004-08-04  4:29   ` Marko Macek
2004-08-04  5:25     ` Dmitry Torokhov
2004-08-04  7:18       ` Vojtech Pavlik
2004-08-04 12:38         ` Dmitry Torokhov
2004-08-04 12:56           ` Vojtech Pavlik
  -- strict thread matches above, loose matches on Subject: below --
2004-08-04 17:41 Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox