]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] logips2pp driver update (MX510/310 support), cleanup
authorEric Wong <eric@yhbt.net>
Thu, 6 May 2004 23:41:02 +0000 (16:41 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 6 May 2004 23:41:02 +0000 (16:41 -0700)
I've updated the logips2pp driver to detect the MX310 and MX510 mice
and also made it more maintainable by putting everything into one
table instead of having 4 arrays for them (the MX700 support wasn't
added correctly in the last revision).

drivers/input/mouse/logips2pp.c
drivers/input/mouse/logips2pp.h

index e9dac656cee17b74b9bb82295317ef65cc322046..846b5e88053790e2a2a966f415d5e85e2ff76e78 100644 (file)
@@ -146,11 +146,35 @@ void ps2pp_set_800dpi(struct psmouse *psmouse)
 static int ps2pp_detect_model(struct psmouse *psmouse, unsigned char *param)
 {
        int i;
-       static int logitech_4btn[] = { 12, 40, 41, 42, 43, 52, 73, 80, -1 };
-       static int logitech_wheel[] = { 52, 53, 75, 76, 80, 81, 83, 88, 112, -1 };
-       static int logitech_ps2pp[] = { 12, 13, 40, 41, 42, 43, 50, 51, 52, 53, 73, 75,
-                                               76, 80, 81, 83, 88, 96, 97, 112, -1 };
-       static int logitech_mx[] = { 61, 112, -1 };
+       static struct _logips2_list {
+               const int model;
+               unsigned const int features;
+       } logips2pp_list [] = {
+               { 12,   PS2PP_4BTN},
+               { 13,   0 },
+               { 40,   PS2PP_4BTN },
+               { 41,   PS2PP_4BTN },
+               { 42,   PS2PP_4BTN },
+               { 43,   PS2PP_4BTN },
+               { 50,   0 },
+               { 51,   0 },
+               { 52,   PS2PP_4BTN | PS2PP_WHEEL },
+               { 53,   PS2PP_WHEEL },
+               { 61,   PS2PP_WHEEL | PS2PP_MX },       /* MX700 */
+               { 73,   PS2PP_4BTN },
+               { 75,   PS2PP_WHEEL },
+               { 76,   PS2PP_WHEEL },
+               { 80,   PS2PP_4BTN | PS2PP_WHEEL },
+               { 81,   PS2PP_WHEEL },
+               { 83,   PS2PP_WHEEL },
+               { 88,   PS2PP_WHEEL },
+               { 96,   0 },
+               { 97,   0 },
+               { 100 , PS2PP_WHEEL | PS2PP_MX },       /* MX510 */
+               { 112 , PS2PP_WHEEL | PS2PP_MX },       /* MX500 */
+               { 114 , PS2PP_WHEEL | PS2PP_MX | PS2PP_MX310 }, /* MX310 */
+               { }
+       };
 
        psmouse->vendor = "Logitech";
        psmouse->model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78);
@@ -162,35 +186,33 @@ static int ps2pp_detect_model(struct psmouse *psmouse, unsigned char *param)
 
        psmouse->type = PSMOUSE_PS2;
 
-       for (i = 0; logitech_ps2pp[i] != -1; i++)
-               if (logitech_ps2pp[i] == psmouse->model)
+       for (i = 0; logips2pp_list[i].model; i++){
+               if (logips2pp_list[i].model == psmouse->model){
                        psmouse->type = PSMOUSE_PS2PP;
-
-       if (psmouse->type == PSMOUSE_PS2PP) {
-
-               for (i = 0; logitech_4btn[i] != -1; i++)
-                       if (logitech_4btn[i] == psmouse->model)
+                       if (logips2pp_list[i].features & PS2PP_4BTN)
                                set_bit(BTN_SIDE, psmouse->dev.keybit);
 
-               for (i = 0; logitech_wheel[i] != -1; i++)
-                       if (logitech_wheel[i] == psmouse->model) {
+                       if (logips2pp_list[i].features & PS2PP_WHEEL){
                                set_bit(REL_WHEEL, psmouse->dev.relbit);
                                psmouse->name = "Wheel Mouse";
                        }
-
-               for (i = 0; logitech_mx[i] != -1; i++)
-                       if (logitech_mx[i]  == psmouse->model) {
+                       if (logips2pp_list[i].features & PS2PP_MX) {
                                set_bit(BTN_SIDE, psmouse->dev.keybit);
                                set_bit(BTN_EXTRA, psmouse->dev.keybit);
-                               set_bit(BTN_BACK, psmouse->dev.keybit);
-                               set_bit(BTN_FORWARD, psmouse->dev.keybit);
                                set_bit(BTN_TASK, psmouse->dev.keybit);
+                               if (!(logips2pp_list[i].features & PS2PP_MX310)){
+                                       set_bit(BTN_BACK, psmouse->dev.keybit);
+                                       set_bit(BTN_FORWARD, psmouse->dev.keybit);
+                               }
                                psmouse->name = "MX Mouse";
                        }
-
+                       break;
+               }
+       }
 /*
  * Do Logitech PS2++ / PS2T++ magic init.
  */
+       if (psmouse->type == PSMOUSE_PS2PP) {
 
                if (psmouse->model == 97) { /* TouchPad 3 */
 
index b09a1ed9707192d119a6df16733514d6eea2cebb..d5e05defe9b631a14fb7fc24fd5ebd69a86858ef 100644 (file)
 
 #ifndef _LOGIPS2PP_H
 #define _LOGIPS2PP_H
+
+#define PS2PP_4BTN     0x01
+#define PS2PP_WHEEL    0x02
+#define PS2PP_MX       0x04
+#define PS2PP_MX310    0x08
+
 struct psmouse;
 void ps2pp_process_packet(struct psmouse *psmouse);
 void ps2pp_set_800dpi(struct psmouse *psmouse);