Skip to contentSkip to conversation

psmouse fixes for 2.6.5

PATCH In review Kim Holviala 2 participants 7 messages Apr 20, 2004 – Apr 21, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 psmouse fixes for 2.6.5

Some fixes for PS/2 mice:

- fixed hotplugging (real reset of device instead of softreset)
- support for Targus Scroller mice (from my last weeks patch)
- extended protocol probing fixed

The major change is that the probing of extended protocols is now changed to be more configurable. Previously the driver probed for all the protocols it knew about and stopped when it found one that the mouse accepted. This didn't work with a bunch of mice so now you can choose the protocols which are to be probed.

In current 2.6.5 the parameter "proto=imps" probes all protocols up to ImPS/2. The patch changes this so that "proto=imps" ONLY probes for ImPS/2 and if that fails uses regular PS/2. Similarly "proto=ps2pp,genps,exps" probes for Logitech, Genius and Intellimouse Expolorer and if none found uses the bare PS/2.

To be continued.....

Kim

Documentation/kernel-parameters.txt +2 -2
diff -ruN linux-2.6.5-orig/Documentation/kernel-parameters.txt linux-2.6.5-mouse/Documentation/kernel-parameters.txt
@@ -874,8 +874,8 @@
 			before loading.
 			See Documentation/ramdisk.txt.
 
-	psmouse.proto=  [HW,MOUSE] Highest PS2 mouse protocol extension to
-			probe for (bare|imps|exps).
+	psmouse.proto=  [HW,MOUSE] PS2 mouse protocols to probe for (probes all except targus default)
+			{ bare | ps2pp | genps | imps | exps | targus | synaptics }
 	psmouse.rate=	[HW,MOUSE] Set desired mouse report rate, in reports
 			per second.
 	psmouse.resetafter=
drivers/input/mouse/Kconfig +3 -0
diff -ruN linux-2.6.5-orig/drivers/input/mouse/Kconfig linux-2.6.5-mouse/drivers/input/mouse/Kconfig
@@ -33,6 +33,9 @@
 	  If you do not want install specialized drivers but want tapping
 	  working please use option psmouse.proto=imps.
 
+	  If you have a Targus Scroller mouse and the scroll wheel moves the
+	  cursor instead of scrolling, use option psmouse.proto=targus.
+
 	  If unsure, say Y.
 
 	  To compile this driver as a module, choose M here: the
drivers/input/mouse/logips2pp.c +4 -6
diff -ruN linux-2.6.5-orig/drivers/input/mouse/logips2pp.c linux-2.6.5-mouse/drivers/input/mouse/logips2pp.c
@@ -152,6 +152,7 @@
 						76, 80, 81, 83, 88, 96, 97, 112, -1 };
 	static int logitech_mx[] = { 61, 112, -1 };
 
+	psmouse->proto = "PS2++";
 	psmouse->vendor = "Logitech";
 	psmouse->model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78);
 
@@ -167,7 +168,6 @@
 			psmouse->type = PSMOUSE_PS2PP;
 
 	if (psmouse->type == PSMOUSE_PS2PP) {
-
 		for (i = 0; logitech_4btn[i] != -1; i++)
 			if (logitech_4btn[i] == psmouse->model)
 				set_bit(BTN_SIDE, psmouse->dev.keybit);
@@ -191,9 +191,7 @@
 /*
  * Do Logitech PS2++ / PS2T++ magic init.
  */
-
 		if (psmouse->model == 97) { /* TouchPad 3 */
-
 			set_bit(REL_WHEEL, psmouse->dev.relbit);
 			set_bit(REL_HWHEEL, psmouse->dev.relbit);
 
@@ -206,19 +204,19 @@
 
 			param[0] = 0;
 			if (!psmouse_command(psmouse, param, 0x13d1) &&
-				param[0] == 0x06 && param[1] == 0x00 && param[2] == 0x14) {
+			     param[0] == 0x06 && param[1] == 0x00 && param[2] == 0x14) {
+				psmouse->proto = "PS2T++";
 				psmouse->name = "TouchPad 3";
 				return PSMOUSE_PS2TPP;
 			}
 
 		} else {
-
 			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] & 3) == ((param[1] >> 2) & 3)) {
+			    (param[2] & 3) == ((param[1] >> 2) & 3)) {
 					ps2pp_set_smartscroll(psmouse);
 					return PSMOUSE_PS2PP;
 			}
drivers/input/mouse/psmouse-base.c +77 -42

270 lines not on this page · raw message

drivers/input/mouse/psmouse.h +10 -7
diff -ruN linux-2.6.5-orig/drivers/input/mouse/psmouse.h linux-2.6.5-mouse/drivers/input/mouse/psmouse.h
@@ -36,6 +36,7 @@
 	struct input_dev dev;
 	struct serio *serio;
 	struct psmouse_ptport *ptport;
+	char *proto;
 	char *vendor;
 	char *name;
 	unsigned char cmdbuf[8];
@@ -56,13 +57,15 @@
 	void (*disconnect)(struct psmouse *psmouse);
 };
 
-#define PSMOUSE_PS2		1
-#define PSMOUSE_PS2PP		2
-#define PSMOUSE_PS2TPP		3
-#define PSMOUSE_GENPS		4
-#define PSMOUSE_IMPS		5
-#define PSMOUSE_IMEX		6
-#define PSMOUSE_SYNAPTICS 	7
+#define PSMOUSE_ANY		0xFFFF
+#define PSMOUSE_PS2		0x0001
+#define PSMOUSE_TARGUS		0x0002
+#define PSMOUSE_PS2PP		0x0004
+#define PSMOUSE_PS2TPP		0x0008
+#define PSMOUSE_GENPS		0x0010
+#define PSMOUSE_IMPS		0x0020
+#define PSMOUSE_IMEX		0x0040
+#define PSMOUSE_SYNAPTICS 	0x0080
 
 int psmouse_command(struct psmouse *psmouse, unsigned char *param, int command);
 int psmouse_reset(struct psmouse *psmouse);
#1 lore raw
Quoted 5 lines · Kim Holviala

Some fixes for PS/2 mice:

- fixed hotplugging (real reset of device instead of softreset)
- support for Targus Scroller mice (from my last weeks patch)
- extended protocol probing fixed

Why do you have Tragus as a config option - just set the protocol mask correctly by default...

Signature · 1 line
Dmitry
#2 lore raw
Quoted 9 lines · Dmitry Torokhov
Quoted 5 lines · Kim Holviala

Some fixes for PS/2 mice:

- fixed hotplugging (real reset of device instead of softreset)
- support for Targus Scroller mice (from my last weeks patch)
- extended protocol probing fixed

Why do you have Tragus as a config option - just set the protocol mask correctly by default...

Targus mice misuse the normal PS/2 protocol so that they can sneak through command-filtering PS/2 ports (like on my Digital HiNote 2000). Basically they output very strange but valid traffic when the wheel is moved. Anyway, this is Linux, and I'd rather force people to turn it on explicitly rather than take the risk of breaking some valid PS/2 device which might theoretically output the same stuff.

Kim

#3 lore raw
Quoted 11 lines · Kim Holviala
Quoted 9 lines · Dmitry Torokhov
Quoted 5 lines · Kim Holviala

Some fixes for PS/2 mice:

- fixed hotplugging (real reset of device instead of softreset)
- support for Targus Scroller mice (from my last weeks patch)
- extended protocol probing fixed

Why do you have Tragus as a config option - just set the protocol mask correctly by default...

Quoted 7 lines

Targus mice misuse the normal PS/2 protocol so that they can sneak through command-filtering PS/2 ports (like on my Digital HiNote 2000). Basically they output very strange but valid traffic when the wheel is moved. Anyway, this is Linux, and I'd rather force people to turn it on explicitly rather than take the risk of breaking some valid PS/2 device which might theoretically output the same stuff.

And I think you will achieve the desired result by just doing:

-static unsigned int psmouse_max_proto = -1U;
+static unsigned int psmouse_probe_proto = PSMOUSE_ANY & ~PSMOUSE_TARGUS;

Think about distributions, they will just have turn this option on anyway.

Signature · 1 line
Dmitry
#4 lore raw
Quoted 4 lines · Dmitry Torokhov
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

- support for Targus Scroller mice (from my last weeks patch)

Why do you have Tragus as a config option - just set the protocol mask correctly by default...

It's not a config option, I just have a little note on the Kconfig file for those that read the help pages.

Review

Quoted 4 lines

And I think you will achieve the desired result by just doing:

(quoted diff) +1 -1
-static unsigned int psmouse_max_proto = -1U;
+static unsigned int psmouse_probe_proto = PSMOUSE_ANY & ~PSMOUSE_TARGUS;

You're right... I did have a small logic problem there - that looks much better.

Kim

#5 lore raw

Taking it off list for now...

Quoted 9 lines · Kim Holviala
Quoted 4 lines · Dmitry Torokhov
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

- support for Targus Scroller mice (from my last weeks patch)

Why do you have Tragus as a config option - just set the protocol mask correctly by default...

It's not a config option, I just have a little note on the Kconfig file for those that read the help pages.

You right, sorry... I just glanced over it in the morning, saw Kconfig being changed and jumped to a conclusion. The only excuse: -ENOCOFFEE :)

I would recommend splitting your patch in 3 pieces - one for reset, one for targus and one for protocol selection. This way its easuier for Vojtech to apply them.

Question - why did you kill the protocol names array?

Btw, I am also trying to work in that area, might be beneficial if we combine our efforts. I just posted bunch of changes on the list, you may also grab them with

bk pull bk://dtor.bkbits.net/input

Signature · 1 line
Dmitry
#6 lore raw
Quoted 1 line · Dmitry Torokhov

Taking it off list for now...

Sleep, sleep...

Signature · 1 line
Dmitry