logips2pp.c (b7e56edba4b02f2079042c326a8cd72a44635817) | logips2pp.c (a62f0d27b4196bad5e900d766b285feb7069cd16) |
---|---|
1/* 2 * Logitech PS/2++ mouse driver 3 * 4 * Copyright (c) 1999-2003 Vojtech Pavlik <vojtech@suse.cz> 5 * Copyright (c) 2003 Eric Wong <eric@yhbt.net> 6 * 7 * This program is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License version 2 as published by --- 42 unchanged lines hidden (view full) --- 51 * Full packet accumulated, process it 52 */ 53 54 if ((packet[0] & 0x48) == 0x48 && (packet[1] & 0x02) == 0x02) { 55 56 /* Logitech extended packet */ 57 switch ((packet[1] >> 4) | (packet[0] & 0x30)) { 58 | 1/* 2 * Logitech PS/2++ mouse driver 3 * 4 * Copyright (c) 1999-2003 Vojtech Pavlik <vojtech@suse.cz> 5 * Copyright (c) 2003 Eric Wong <eric@yhbt.net> 6 * 7 * This program is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License version 2 as published by --- 42 unchanged lines hidden (view full) --- 51 * Full packet accumulated, process it 52 */ 53 54 if ((packet[0] & 0x48) == 0x48 && (packet[1] & 0x02) == 0x02) { 55 56 /* Logitech extended packet */ 57 switch ((packet[1] >> 4) | (packet[0] & 0x30)) { 58 |
59 case 0x0d: /* Mouse extra info */ | 59 case 0x0d: /* Mouse extra info */ |
60 | 60 |
61 input_report_rel(dev, packet[2] & 0x80 ? REL_HWHEEL : REL_WHEEL, 62 (int) (packet[2] & 8) - (int) (packet[2] & 7)); 63 input_report_key(dev, BTN_SIDE, (packet[2] >> 4) & 1); 64 input_report_key(dev, BTN_EXTRA, (packet[2] >> 5) & 1); | 61 input_report_rel(dev, packet[2] & 0x80 ? REL_HWHEEL : REL_WHEEL, 62 (int) (packet[2] & 8) - (int) (packet[2] & 7)); 63 input_report_key(dev, BTN_SIDE, (packet[2] >> 4) & 1); 64 input_report_key(dev, BTN_EXTRA, (packet[2] >> 5) & 1); |
65 | 65 |
66 break; | 66 break; |
67 | 67 |
68 case 0x0e: /* buttons 4, 5, 6, 7, 8, 9, 10 info */ | 68 case 0x0e: /* buttons 4, 5, 6, 7, 8, 9, 10 info */ |
69 | 69 |
70 input_report_key(dev, BTN_SIDE, (packet[2]) & 1); 71 input_report_key(dev, BTN_EXTRA, (packet[2] >> 1) & 1); 72 input_report_key(dev, BTN_BACK, (packet[2] >> 3) & 1); 73 input_report_key(dev, BTN_FORWARD, (packet[2] >> 4) & 1); 74 input_report_key(dev, BTN_TASK, (packet[2] >> 2) & 1); | 70 input_report_key(dev, BTN_SIDE, (packet[2]) & 1); 71 input_report_key(dev, BTN_EXTRA, (packet[2] >> 1) & 1); 72 input_report_key(dev, BTN_BACK, (packet[2] >> 3) & 1); 73 input_report_key(dev, BTN_FORWARD, (packet[2] >> 4) & 1); 74 input_report_key(dev, BTN_TASK, (packet[2] >> 2) & 1); |
75 | 75 |
76 break; | 76 break; |
77 | 77 |
78 case 0x0f: /* TouchPad extra info */ | 78 case 0x0f: /* TouchPad extra info */ |
79 | 79 |
80 input_report_rel(dev, packet[2] & 0x08 ? REL_HWHEEL : REL_WHEEL, 81 (int) ((packet[2] >> 4) & 8) - (int) ((packet[2] >> 4) & 7)); 82 packet[0] = packet[2] | 0x08; 83 break; | 80 input_report_rel(dev, packet[2] & 0x08 ? REL_HWHEEL : REL_WHEEL, 81 (int) ((packet[2] >> 4) & 8) - (int) ((packet[2] >> 4) & 7)); 82 packet[0] = packet[2] | 0x08; 83 break; |
84 85#ifdef DEBUG | 84 85#ifdef DEBUG |
86 default: 87 printk(KERN_WARNING "psmouse.c: Received PS2++ packet #%x, but don't know how to handle.\n", 88 (packet[1] >> 4) | (packet[0] & 0x30)); | 86 default: 87 printk(KERN_WARNING "psmouse.c: Received PS2++ packet #%x, but don't know how to handle.\n", 88 (packet[1] >> 4) | (packet[0] & 0x30)); |
89#endif 90 } 91 } else { 92 /* Standard PS/2 motion data */ 93 input_report_rel(dev, REL_X, packet[1] ? (int) packet[1] - (int) ((packet[0] << 4) & 0x100) : 0); 94 input_report_rel(dev, REL_Y, packet[2] ? (int) ((packet[0] << 3) & 0x100) - (int) packet[2] : 0); 95 } 96 --- 148 unchanged lines hidden (view full) --- 245 PS2PP_TASK_BTN | PS2PP_EXTRA_BTN } 246 }; 247 int i; 248 249 for (i = 0; i < ARRAY_SIZE(ps2pp_list); i++) 250 if (model == ps2pp_list[i].model) 251 return &ps2pp_list[i]; 252 | 89#endif 90 } 91 } else { 92 /* Standard PS/2 motion data */ 93 input_report_rel(dev, REL_X, packet[1] ? (int) packet[1] - (int) ((packet[0] << 4) & 0x100) : 0); 94 input_report_rel(dev, REL_Y, packet[2] ? (int) ((packet[0] << 3) & 0x100) - (int) packet[2] : 0); 95 } 96 --- 148 unchanged lines hidden (view full) --- 245 PS2PP_TASK_BTN | PS2PP_EXTRA_BTN } 246 }; 247 int i; 248 249 for (i = 0; i < ARRAY_SIZE(ps2pp_list); i++) 250 if (model == ps2pp_list[i].model) 251 return &ps2pp_list[i]; 252 |
253 printk(KERN_WARNING "logips2pp: Detected unknown logitech mouse model %d\n", model); | |
254 return NULL; 255} 256 257/* 258 * Set up input device's properties based on the detected mouse model. 259 */ 260 261static void ps2pp_set_model_properties(struct psmouse *psmouse, --- 18 unchanged lines hidden (view full) --- 280 281 if (model_info->features & PS2PP_WHEEL) 282 __set_bit(REL_WHEEL, input_dev->relbit); 283 284 if (model_info->features & PS2PP_HWHEEL) 285 __set_bit(REL_HWHEEL, input_dev->relbit); 286 287 switch (model_info->kind) { | 253 return NULL; 254} 255 256/* 257 * Set up input device's properties based on the detected mouse model. 258 */ 259 260static void ps2pp_set_model_properties(struct psmouse *psmouse, --- 18 unchanged lines hidden (view full) --- 279 280 if (model_info->features & PS2PP_WHEEL) 281 __set_bit(REL_WHEEL, input_dev->relbit); 282 283 if (model_info->features & PS2PP_HWHEEL) 284 __set_bit(REL_HWHEEL, input_dev->relbit); 285 286 switch (model_info->kind) { |
288 case PS2PP_KIND_WHEEL: 289 psmouse->name = "Wheel Mouse"; 290 break; | |
291 | 287 |
292 case PS2PP_KIND_MX: 293 psmouse->name = "MX Mouse"; 294 break; | 288 case PS2PP_KIND_WHEEL: 289 psmouse->name = "Wheel Mouse"; 290 break; |
295 | 291 |
296 case PS2PP_KIND_TP3: 297 psmouse->name = "TouchPad 3"; 298 break; | 292 case PS2PP_KIND_MX: 293 psmouse->name = "MX Mouse"; 294 break; |
299 | 295 |
300 case PS2PP_KIND_TRACKMAN: 301 psmouse->name = "TrackMan"; 302 break; | 296 case PS2PP_KIND_TP3: 297 psmouse->name = "TouchPad 3"; 298 break; |
303 | 299 |
304 default: 305 /* 306 * Set name to "Mouse" only when using PS2++, 307 * otherwise let other protocols define suitable 308 * name 309 */ 310 if (using_ps2pp) 311 psmouse->name = "Mouse"; 312 break; | 300 case PS2PP_KIND_TRACKMAN: 301 psmouse->name = "TrackMan"; 302 break; 303 304 default: 305 /* 306 * Set name to "Mouse" only when using PS2++, 307 * otherwise let other protocols define suitable 308 * name 309 */ 310 if (using_ps2pp) 311 psmouse->name = "Mouse"; 312 break; |
313 } 314} 315 316 317/* 318 * Logitech magic init. Detect whether the mouse is a Logitech one 319 * and its exact model and try turning on extended protocol for ones 320 * that support it. --- 17 unchanged lines hidden (view full) --- 338 ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO); 339 340 model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78); 341 buttons = param[1]; 342 343 if (!model || !buttons) 344 return -1; 345 | 313 } 314} 315 316 317/* 318 * Logitech magic init. Detect whether the mouse is a Logitech one 319 * and its exact model and try turning on extended protocol for ones 320 * that support it. --- 17 unchanged lines hidden (view full) --- 338 ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO); 339 340 model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78); 341 buttons = param[1]; 342 343 if (!model || !buttons) 344 return -1; 345 |
346 if ((model_info = get_model_info(model)) != NULL) { | 346 model_info = get_model_info(model); 347 if (model_info) { |
347 348/* 349 * Do Logitech PS2++ / PS2T++ magic init. 350 */ 351 if (model_info->kind == PS2PP_KIND_TP3) { /* Touch Pad 3 */ 352 353 /* Unprotect RAM */ 354 param[0] = 0x11; param[1] = 0x04; param[2] = 0x68; --- 19 unchanged lines hidden (view full) --- 374 375 if ((param[0] & 0x78) == 0x48 && 376 (param[1] & 0xf3) == 0xc2 && 377 (param[2] & 0x03) == ((param[1] >> 2) & 3)) { 378 ps2pp_set_smartscroll(psmouse, false); 379 use_ps2pp = true; 380 } 381 } | 348 349/* 350 * Do Logitech PS2++ / PS2T++ magic init. 351 */ 352 if (model_info->kind == PS2PP_KIND_TP3) { /* Touch Pad 3 */ 353 354 /* Unprotect RAM */ 355 param[0] = 0x11; param[1] = 0x04; param[2] = 0x68; --- 19 unchanged lines hidden (view full) --- 375 376 if ((param[0] & 0x78) == 0x48 && 377 (param[1] & 0xf3) == 0xc2 && 378 (param[2] & 0x03) == ((param[1] >> 2) & 3)) { 379 ps2pp_set_smartscroll(psmouse, false); 380 use_ps2pp = true; 381 } 382 } |
383 384 } else { 385 printk(KERN_WARNING "logips2pp: Detected unknown logitech mouse model %d\n", model); |
|
382 } 383 384 if (set_properties) { 385 psmouse->vendor = "Logitech"; 386 psmouse->model = model; 387 388 if (use_ps2pp) { 389 psmouse->protocol_handler = ps2pp_process_byte; --- 27 unchanged lines hidden --- | 386 } 387 388 if (set_properties) { 389 psmouse->vendor = "Logitech"; 390 psmouse->model = model; 391 392 if (use_ps2pp) { 393 psmouse->protocol_handler = ps2pp_process_byte; --- 27 unchanged lines hidden --- |