summaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/trackpoint.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2009-11-17 07:12:21 +0100
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-11-20 09:52:12 +0100
commit315eb996d5505112b22452ccbc7e01fb02eaae81 (patch)
tree86abf8a390575efe1bc0b678dbd27310ff351f59 /drivers/input/mouse/trackpoint.c
parentInput: lifebook - do not advertise unsupported buttons (diff)
downloadlinux-315eb996d5505112b22452ccbc7e01fb02eaae81.tar.xz
linux-315eb996d5505112b22452ccbc7e01fb02eaae81.zip
Input: psmouse - rework setting of BTN_MIDDLE capability
Do not start protocol detection assuming that middle mouse is present, instead let individual protocols explicitly set this capability. This fixes issue with Synaptics touchpads pretending that they have middle button when hardware clearly reports otherwise. Reported-and-tested-by: Andrey Borzenkov <arvidjaar@mail.ru> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse/trackpoint.c')
-rw-r--r--drivers/input/mouse/trackpoint.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c
index e354362f2971..63d4a67830f2 100644
--- a/drivers/input/mouse/trackpoint.c
+++ b/drivers/input/mouse/trackpoint.c
@@ -284,7 +284,6 @@ static int trackpoint_reconnect(struct psmouse *psmouse)
int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
{
- struct trackpoint_data *priv;
struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char firmware_id;
unsigned char button_info;
@@ -301,8 +300,8 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
button_info = 0;
}
- psmouse->private = priv = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL);
- if (!priv)
+ psmouse->private = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL);
+ if (!psmouse->private)
return -1;
psmouse->vendor = "IBM";
@@ -311,7 +310,10 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
psmouse->reconnect = trackpoint_reconnect;
psmouse->disconnect = trackpoint_disconnect;
- trackpoint_defaults(priv);
+ if ((button_info & 0x0f) >= 3)
+ __set_bit(BTN_MIDDLE, psmouse->dev->keybit);
+
+ trackpoint_defaults(psmouse->private);
trackpoint_sync(psmouse);
error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group);
@@ -319,7 +321,8 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
printk(KERN_ERR
"trackpoint.c: failed to create sysfs attributes, error: %d\n",
error);
- kfree(priv);
+ kfree(psmouse->private);
+ psmouse->private = NULL;
return -1;
}