diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2006-08-04 22:52:26 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2006-08-04 22:52:26 -0400 |
commit | 184dd2751c653a572c79c1fff969000b8880da40 (patch) | |
tree | 111bb3520856da60d4d32bb12b1cebaf46534ad2 /drivers | |
parent | 0c19fcd83793be248f8108a52f895c8d0034b182 (diff) |
Input: trackpoint - activate protocol when resuming
Trackpoint driver was not sending the magic knock sequence upon resume
causing incorrect device behavior after resuming from disk.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/input/mouse/trackpoint.c | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index 6d9ec9ab1b90..ae5871a0e060 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
@@ -183,21 +183,26 @@ static struct attribute_group trackpoint_attr_group = { | |||
183 | .attrs = trackpoint_attrs, | 183 | .attrs = trackpoint_attrs, |
184 | }; | 184 | }; |
185 | 185 | ||
186 | static void trackpoint_disconnect(struct psmouse *psmouse) | 186 | static int trackpoint_start_protocol(struct psmouse *psmouse, unsigned char *firmware_id) |
187 | { | 187 | { |
188 | sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, &trackpoint_attr_group); | 188 | unsigned char param[2] = { 0 }; |
189 | 189 | ||
190 | kfree(psmouse->private); | 190 | if (ps2_command(&psmouse->ps2dev, param, MAKE_PS2_CMD(0, 2, TP_READ_ID))) |
191 | psmouse->private = NULL; | 191 | return -1; |
192 | |||
193 | if (param[0] != TP_MAGIC_IDENT) | ||
194 | return -1; | ||
195 | |||
196 | if (firmware_id) | ||
197 | *firmware_id = param[1]; | ||
198 | |||
199 | return 0; | ||
192 | } | 200 | } |
193 | 201 | ||
194 | static int trackpoint_sync(struct psmouse *psmouse) | 202 | static int trackpoint_sync(struct psmouse *psmouse) |
195 | { | 203 | { |
196 | unsigned char toggle; | ||
197 | struct trackpoint_data *tp = psmouse->private; | 204 | struct trackpoint_data *tp = psmouse->private; |
198 | 205 | unsigned char toggle; | |
199 | if (!tp) | ||
200 | return -1; | ||
201 | 206 | ||
202 | /* Disable features that may make device unusable with this driver */ | 207 | /* Disable features that may make device unusable with this driver */ |
203 | trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, &toggle); | 208 | trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, &toggle); |
@@ -263,27 +268,38 @@ static void trackpoint_defaults(struct trackpoint_data *tp) | |||
263 | tp->ext_dev = TP_DEF_EXT_DEV; | 268 | tp->ext_dev = TP_DEF_EXT_DEV; |
264 | } | 269 | } |
265 | 270 | ||
271 | static void trackpoint_disconnect(struct psmouse *psmouse) | ||
272 | { | ||
273 | sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, &trackpoint_attr_group); | ||
274 | |||
275 | kfree(psmouse->private); | ||
276 | psmouse->private = NULL; | ||
277 | } | ||
278 | |||
279 | static int trackpoint_reconnect(struct psmouse *psmouse) | ||
280 | { | ||
281 | if (trackpoint_start_protocol(psmouse, NULL)) | ||
282 | return -1; | ||
283 | |||
284 | if (trackpoint_sync(psmouse)) | ||
285 | return -1; | ||
286 | |||
287 | return 0; | ||
288 | } | ||
289 | |||
266 | int trackpoint_detect(struct psmouse *psmouse, int set_properties) | 290 | int trackpoint_detect(struct psmouse *psmouse, int set_properties) |
267 | { | 291 | { |
268 | struct trackpoint_data *priv; | 292 | struct trackpoint_data *priv; |
269 | struct ps2dev *ps2dev = &psmouse->ps2dev; | 293 | struct ps2dev *ps2dev = &psmouse->ps2dev; |
270 | unsigned char firmware_id; | 294 | unsigned char firmware_id; |
271 | unsigned char button_info; | 295 | unsigned char button_info; |
272 | unsigned char param[2]; | ||
273 | |||
274 | param[0] = param[1] = 0; | ||
275 | 296 | ||
276 | if (ps2_command(ps2dev, param, MAKE_PS2_CMD(0, 2, TP_READ_ID))) | 297 | if (trackpoint_start_protocol(psmouse, &firmware_id)) |
277 | return -1; | ||
278 | |||
279 | if (param[0] != TP_MAGIC_IDENT) | ||
280 | return -1; | 298 | return -1; |
281 | 299 | ||
282 | if (!set_properties) | 300 | if (!set_properties) |
283 | return 0; | 301 | return 0; |
284 | 302 | ||
285 | firmware_id = param[1]; | ||
286 | |||
287 | if (trackpoint_read(&psmouse->ps2dev, TP_EXT_BTN, &button_info)) { | 303 | if (trackpoint_read(&psmouse->ps2dev, TP_EXT_BTN, &button_info)) { |
288 | printk(KERN_WARNING "trackpoint.c: failed to get extended button data\n"); | 304 | printk(KERN_WARNING "trackpoint.c: failed to get extended button data\n"); |
289 | button_info = 0; | 305 | button_info = 0; |
@@ -296,7 +312,7 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties) | |||
296 | psmouse->vendor = "IBM"; | 312 | psmouse->vendor = "IBM"; |
297 | psmouse->name = "TrackPoint"; | 313 | psmouse->name = "TrackPoint"; |
298 | 314 | ||
299 | psmouse->reconnect = trackpoint_sync; | 315 | psmouse->reconnect = trackpoint_reconnect; |
300 | psmouse->disconnect = trackpoint_disconnect; | 316 | psmouse->disconnect = trackpoint_disconnect; |
301 | 317 | ||
302 | trackpoint_defaults(priv); | 318 | trackpoint_defaults(priv); |