patch: logips2pp.c - Wheel(middle) button fix

From: Junji Kanemaru
Date: Thu Oct 30 2003 - 23:56:26 EST


Dear Linux Kernel Hackers

Recently I switched to 2.6.0-test8,9 kernel and encountered
a problem that my mouse's middle button no longer works.
My mouse, Arvel MFS07MT, has a wheel and it is also
a button, I was able to paste text by pressing it with 2.4.x
kernel but 2.6.0-8,9.

I looked into input driver code and found where the problem
resides. The problem is my mouse is buggy.
There's code that clears BTN_MIDDLE bit in logips2pp.c
line 157-158 if the mouse says it has less than 3 buttons.
My mouse should set 3 in param[1] but it sets 2.
So that's why my mouse's middle button gets disabled.
But I really need my mouse's middle button working and
I think there may be other mice have same problem out
there we have to work out on this problem.

First I thought setting the BTN_MIDDLE bit back at the enf of
ps2pp_detect_model() function, right before it's returning
zero(0) when it fails to detect model. But even with this fix
there might be some buggy mice are still there that they are
detected as valid model and report they have two buttons
though they have wheel-button at middle.
So probably the best way to fix this problem without getting
into complicated mouse detection, just leave BTN_MIDDLE bit
on if param[1] >= 2, clear it when param[1] < 2.

Below is my tiny fix. Not 100% sure if I did right thing or not.
If this fix is acceptable for maintainer of logips2pp.c then
please apply.

Thanks,

-- Junji Kanemaru
Data Centrix Co., Ltd.
Tokyo Japan


--- linux-2.6.0-test9/drivers/input/mouse/logips2pp.c 2003-10-26
03:43:59.000000000 +0900
+++ linux-2.6.0-test9-debug/drivers/input/mouse/logips2pp.c 2003-10-31
13:48:38.000000000 +0900
@@ -154,10 +154,18 @@
psmouse->vendor = "Logitech";
psmouse->model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78);

- if (param[1] < 3)
- clear_bit(BTN_MIDDLE, psmouse->dev.keybit);
- if (param[1] < 2)
+ /*
+ * We clear middle BTN_MIDDLE only when the mouse says
+ * there's only one button on it(param[1] < 2).
+ * This is a workaround for some buggy mice which report
+ * they have only 2 buttons though they have wheel-button
+ * which also works as middle button.
+ * 10/31/2003 - junji.kanemaru@xxxxxxxxxxxxxxxxx
+ */
+ if (param[1] < 2) {
clear_bit(BTN_RIGHT, psmouse->dev.keybit);
+ clear_bit(BTN_MIDDLE, psmouse->dev.keybit);
+ }

psmouse->type = PSMOUSE_PS2;



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/