Commit f0cec6ad authored by Eric Wong's avatar Eric Wong Committed by Linus Torvalds

[PATCH] logips2pp driver update (MX510/310 support), cleanup

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).
parent f864a703
...@@ -146,11 +146,35 @@ void ps2pp_set_800dpi(struct psmouse *psmouse) ...@@ -146,11 +146,35 @@ void ps2pp_set_800dpi(struct psmouse *psmouse)
static int ps2pp_detect_model(struct psmouse *psmouse, unsigned char *param) static int ps2pp_detect_model(struct psmouse *psmouse, unsigned char *param)
{ {
int i; int i;
static int logitech_4btn[] = { 12, 40, 41, 42, 43, 52, 73, 80, -1 }; static struct _logips2_list {
static int logitech_wheel[] = { 52, 53, 75, 76, 80, 81, 83, 88, 112, -1 }; const int model;
static int logitech_ps2pp[] = { 12, 13, 40, 41, 42, 43, 50, 51, 52, 53, 73, 75, unsigned const int features;
76, 80, 81, 83, 88, 96, 97, 112, -1 }; } logips2pp_list [] = {
static int logitech_mx[] = { 61, 112, -1 }; { 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->vendor = "Logitech";
psmouse->model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78); 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) ...@@ -162,35 +186,33 @@ static int ps2pp_detect_model(struct psmouse *psmouse, unsigned char *param)
psmouse->type = PSMOUSE_PS2; psmouse->type = PSMOUSE_PS2;
for (i = 0; logitech_ps2pp[i] != -1; i++) for (i = 0; logips2pp_list[i].model; i++){
if (logitech_ps2pp[i] == psmouse->model) if (logips2pp_list[i].model == psmouse->model){
psmouse->type = PSMOUSE_PS2PP; psmouse->type = PSMOUSE_PS2PP;
if (logips2pp_list[i].features & PS2PP_4BTN)
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); set_bit(BTN_SIDE, psmouse->dev.keybit);
for (i = 0; logitech_wheel[i] != -1; i++) if (logips2pp_list[i].features & PS2PP_WHEEL){
if (logitech_wheel[i] == psmouse->model) {
set_bit(REL_WHEEL, psmouse->dev.relbit); set_bit(REL_WHEEL, psmouse->dev.relbit);
psmouse->name = "Wheel Mouse"; psmouse->name = "Wheel Mouse";
} }
if (logips2pp_list[i].features & PS2PP_MX) {
for (i = 0; logitech_mx[i] != -1; i++)
if (logitech_mx[i] == psmouse->model) {
set_bit(BTN_SIDE, psmouse->dev.keybit); set_bit(BTN_SIDE, psmouse->dev.keybit);
set_bit(BTN_EXTRA, psmouse->dev.keybit); set_bit(BTN_EXTRA, 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_BACK, psmouse->dev.keybit);
set_bit(BTN_FORWARD, psmouse->dev.keybit); set_bit(BTN_FORWARD, psmouse->dev.keybit);
set_bit(BTN_TASK, psmouse->dev.keybit); }
psmouse->name = "MX Mouse"; psmouse->name = "MX Mouse";
} }
break;
}
}
/* /*
* Do Logitech PS2++ / PS2T++ magic init. * Do Logitech PS2++ / PS2T++ magic init.
*/ */
if (psmouse->type == PSMOUSE_PS2PP) {
if (psmouse->model == 97) { /* TouchPad 3 */ if (psmouse->model == 97) { /* TouchPad 3 */
......
...@@ -10,6 +10,12 @@ ...@@ -10,6 +10,12 @@
#ifndef _LOGIPS2PP_H #ifndef _LOGIPS2PP_H
#define _LOGIPS2PP_H #define _LOGIPS2PP_H
#define PS2PP_4BTN 0x01
#define PS2PP_WHEEL 0x02
#define PS2PP_MX 0x04
#define PS2PP_MX310 0x08
struct psmouse; struct psmouse;
void ps2pp_process_packet(struct psmouse *psmouse); void ps2pp_process_packet(struct psmouse *psmouse);
void ps2pp_set_800dpi(struct psmouse *psmouse); void ps2pp_set_800dpi(struct psmouse *psmouse);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment