aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-05-19 13:39:17 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-05-19 14:31:51 -0400
commita62f0d27b4196bad5e900d766b285feb7069cd16 (patch)
tree88719f9718968d32aa3df3a9289c04c32a549578 /drivers/input
parent83ba9ea8a04b72dfee2515428c15e7414ba4fc61 (diff)
Input: psmouse - small formatting changes to better follow coding style
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/mouse/hgpk.c4
-rw-r--r--drivers/input/mouse/logips2pp.c98
-rw-r--r--drivers/input/mouse/psmouse-base.c72
-rw-r--r--drivers/input/mouse/synaptics.c21
4 files changed, 100 insertions, 95 deletions
diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c
index 08d66d820d2b..1d2205b24800 100644
--- a/drivers/input/mouse/hgpk.c
+++ b/drivers/input/mouse/hgpk.c
@@ -40,8 +40,8 @@
40#include "psmouse.h" 40#include "psmouse.h"
41#include "hgpk.h" 41#include "hgpk.h"
42 42
43static int tpdebug; 43static bool tpdebug;
44module_param(tpdebug, int, 0644); 44module_param(tpdebug, bool, 0644);
45MODULE_PARM_DESC(tpdebug, "enable debugging, dumping packets to KERN_DEBUG."); 45MODULE_PARM_DESC(tpdebug, "enable debugging, dumping packets to KERN_DEBUG.");
46 46
47static int recalib_delta = 100; 47static int recalib_delta = 100;
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c
index 543c240a85f2..c9983aee9082 100644
--- a/drivers/input/mouse/logips2pp.c
+++ b/drivers/input/mouse/logips2pp.c
@@ -56,36 +56,36 @@ static psmouse_ret_t ps2pp_process_byte(struct psmouse *psmouse)
56 /* Logitech extended packet */ 56 /* Logitech extended packet */
57 switch ((packet[1] >> 4) | (packet[0] & 0x30)) { 57 switch ((packet[1] >> 4) | (packet[0] & 0x30)) {
58 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, 61 input_report_rel(dev, packet[2] & 0x80 ? REL_HWHEEL : REL_WHEEL,
62 (int) (packet[2] & 8) - (int) (packet[2] & 7)); 62 (int) (packet[2] & 8) - (int) (packet[2] & 7));
63 input_report_key(dev, BTN_SIDE, (packet[2] >> 4) & 1); 63 input_report_key(dev, BTN_SIDE, (packet[2] >> 4) & 1);
64 input_report_key(dev, BTN_EXTRA, (packet[2] >> 5) & 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); 70 input_report_key(dev, BTN_SIDE, (packet[2]) & 1);
71 input_report_key(dev, BTN_EXTRA, (packet[2] >> 1) & 1); 71 input_report_key(dev, BTN_EXTRA, (packet[2] >> 1) & 1);
72 input_report_key(dev, BTN_BACK, (packet[2] >> 3) & 1); 72 input_report_key(dev, BTN_BACK, (packet[2] >> 3) & 1);
73 input_report_key(dev, BTN_FORWARD, (packet[2] >> 4) & 1); 73 input_report_key(dev, BTN_FORWARD, (packet[2] >> 4) & 1);
74 input_report_key(dev, BTN_TASK, (packet[2] >> 2) & 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, 80 input_report_rel(dev, packet[2] & 0x08 ? REL_HWHEEL : REL_WHEEL,
81 (int) ((packet[2] >> 4) & 8) - (int) ((packet[2] >> 4) & 7)); 81 (int) ((packet[2] >> 4) & 8) - (int) ((packet[2] >> 4) & 7));
82 packet[0] = packet[2] | 0x08; 82 packet[0] = packet[2] | 0x08;
83 break; 83 break;
84 84
85#ifdef DEBUG 85#ifdef DEBUG
86 default: 86 default:
87 printk(KERN_WARNING "psmouse.c: Received PS2++ packet #%x, but don't know how to handle.\n", 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)); 88 (packet[1] >> 4) | (packet[0] & 0x30));
89#endif 89#endif
90 } 90 }
91 } else { 91 } else {
@@ -250,7 +250,6 @@ static const struct ps2pp_info *get_model_info(unsigned char model)
250 if (model == ps2pp_list[i].model) 250 if (model == ps2pp_list[i].model)
251 return &ps2pp_list[i]; 251 return &ps2pp_list[i];
252 252
253 printk(KERN_WARNING "logips2pp: Detected unknown logitech mouse model %d\n", model);
254 return NULL; 253 return NULL;
255} 254}
256 255
@@ -285,31 +284,32 @@ static void ps2pp_set_model_properties(struct psmouse *psmouse,
285 __set_bit(REL_HWHEEL, input_dev->relbit); 284 __set_bit(REL_HWHEEL, input_dev->relbit);
286 285
287 switch (model_info->kind) { 286 switch (model_info->kind) {
288 case PS2PP_KIND_WHEEL:
289 psmouse->name = "Wheel Mouse";
290 break;
291
292 case PS2PP_KIND_MX:
293 psmouse->name = "MX Mouse";
294 break;
295 287
296 case PS2PP_KIND_TP3: 288 case PS2PP_KIND_WHEEL:
297 psmouse->name = "TouchPad 3"; 289 psmouse->name = "Wheel Mouse";
298 break; 290 break;
299 291
300 case PS2PP_KIND_TRACKMAN: 292 case PS2PP_KIND_MX:
301 psmouse->name = "TrackMan"; 293 psmouse->name = "MX Mouse";
302 break; 294 break;
303 295
304 default: 296 case PS2PP_KIND_TP3:
305 /* 297 psmouse->name = "TouchPad 3";
306 * Set name to "Mouse" only when using PS2++, 298 break;
307 * otherwise let other protocols define suitable 299
308 * name 300 case PS2PP_KIND_TRACKMAN:
309 */ 301 psmouse->name = "TrackMan";
310 if (using_ps2pp) 302 break;
311 psmouse->name = "Mouse"; 303
312 break; 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 } 313 }
314} 314}
315 315
@@ -343,7 +343,8 @@ int ps2pp_init(struct psmouse *psmouse, bool set_properties)
343 if (!model || !buttons) 343 if (!model || !buttons)
344 return -1; 344 return -1;
345 345
346 if ((model_info = get_model_info(model)) != NULL) { 346 model_info = get_model_info(model);
347 if (model_info) {
347 348
348/* 349/*
349 * Do Logitech PS2++ / PS2T++ magic init. 350 * Do Logitech PS2++ / PS2T++ magic init.
@@ -379,6 +380,9 @@ int ps2pp_init(struct psmouse *psmouse, bool set_properties)
379 use_ps2pp = true; 380 use_ps2pp = true;
380 } 381 }
381 } 382 }
383
384 } else {
385 printk(KERN_WARNING "logips2pp: Detected unknown logitech mouse model %d\n", model);
382 } 386 }
383 387
384 if (set_properties) { 388 if (set_properties) {
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index a3c97315a473..979c50215282 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -147,18 +147,18 @@ static psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse)
147 147
148 if (psmouse->type == PSMOUSE_IMEX) { 148 if (psmouse->type == PSMOUSE_IMEX) {
149 switch (packet[3] & 0xC0) { 149 switch (packet[3] & 0xC0) {
150 case 0x80: /* vertical scroll on IntelliMouse Explorer 4.0 */ 150 case 0x80: /* vertical scroll on IntelliMouse Explorer 4.0 */
151 input_report_rel(dev, REL_WHEEL, (int) (packet[3] & 32) - (int) (packet[3] & 31)); 151 input_report_rel(dev, REL_WHEEL, (int) (packet[3] & 32) - (int) (packet[3] & 31));
152 break; 152 break;
153 case 0x40: /* horizontal scroll on IntelliMouse Explorer 4.0 */ 153 case 0x40: /* horizontal scroll on IntelliMouse Explorer 4.0 */
154 input_report_rel(dev, REL_HWHEEL, (int) (packet[3] & 32) - (int) (packet[3] & 31)); 154 input_report_rel(dev, REL_HWHEEL, (int) (packet[3] & 32) - (int) (packet[3] & 31));
155 break; 155 break;
156 case 0x00: 156 case 0x00:
157 case 0xC0: 157 case 0xC0:
158 input_report_rel(dev, REL_WHEEL, (int) (packet[3] & 8) - (int) (packet[3] & 7)); 158 input_report_rel(dev, REL_WHEEL, (int) (packet[3] & 8) - (int) (packet[3] & 7));
159 input_report_key(dev, BTN_SIDE, (packet[3] >> 4) & 1); 159 input_report_key(dev, BTN_SIDE, (packet[3] >> 4) & 1);
160 input_report_key(dev, BTN_EXTRA, (packet[3] >> 5) & 1); 160 input_report_key(dev, BTN_EXTRA, (packet[3] >> 5) & 1);
161 break; 161 break;
162 } 162 }
163 } 163 }
164 164
@@ -247,31 +247,31 @@ static int psmouse_handle_byte(struct psmouse *psmouse)
247 psmouse_ret_t rc = psmouse->protocol_handler(psmouse); 247 psmouse_ret_t rc = psmouse->protocol_handler(psmouse);
248 248
249 switch (rc) { 249 switch (rc) {
250 case PSMOUSE_BAD_DATA: 250 case PSMOUSE_BAD_DATA:
251 if (psmouse->state == PSMOUSE_ACTIVATED) { 251 if (psmouse->state == PSMOUSE_ACTIVATED) {
252 printk(KERN_WARNING "psmouse.c: %s at %s lost sync at byte %d\n", 252 printk(KERN_WARNING "psmouse.c: %s at %s lost sync at byte %d\n",
253 psmouse->name, psmouse->phys, psmouse->pktcnt); 253 psmouse->name, psmouse->phys, psmouse->pktcnt);
254 if (++psmouse->out_of_sync_cnt == psmouse->resetafter) { 254 if (++psmouse->out_of_sync_cnt == psmouse->resetafter) {
255 __psmouse_set_state(psmouse, PSMOUSE_IGNORE); 255 __psmouse_set_state(psmouse, PSMOUSE_IGNORE);
256 printk(KERN_NOTICE "psmouse.c: issuing reconnect request\n"); 256 printk(KERN_NOTICE "psmouse.c: issuing reconnect request\n");
257 serio_reconnect(psmouse->ps2dev.serio); 257 serio_reconnect(psmouse->ps2dev.serio);
258 return -1; 258 return -1;
259 }
260 }
261 psmouse->pktcnt = 0;
262 break;
263
264 case PSMOUSE_FULL_PACKET:
265 psmouse->pktcnt = 0;
266 if (psmouse->out_of_sync_cnt) {
267 psmouse->out_of_sync_cnt = 0;
268 printk(KERN_NOTICE "psmouse.c: %s at %s - driver resynched.\n",
269 psmouse->name, psmouse->phys);
270 } 259 }
271 break; 260 }
261 psmouse->pktcnt = 0;
262 break;
263
264 case PSMOUSE_FULL_PACKET:
265 psmouse->pktcnt = 0;
266 if (psmouse->out_of_sync_cnt) {
267 psmouse->out_of_sync_cnt = 0;
268 printk(KERN_NOTICE "psmouse.c: %s at %s - driver resynched.\n",
269 psmouse->name, psmouse->phys);
270 }
271 break;
272 272
273 case PSMOUSE_GOOD_DATA: 273 case PSMOUSE_GOOD_DATA:
274 break; 274 break;
275 } 275 }
276 return 0; 276 return 0;
277} 277}
@@ -1245,7 +1245,7 @@ static int psmouse_switch_protocol(struct psmouse *psmouse,
1245 psmouse->pktsize = 3; 1245 psmouse->pktsize = 3;
1246 1246
1247 if (proto && (proto->detect || proto->init)) { 1247 if (proto && (proto->detect || proto->init)) {
1248 if (proto->detect && proto->detect(psmouse, 1) < 0) 1248 if (proto->detect && proto->detect(psmouse, true) < 0)
1249 return -1; 1249 return -1;
1250 1250
1251 if (proto->init && proto->init(psmouse) < 0) 1251 if (proto->init && proto->init(psmouse) < 0)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 52bb1de32e4e..40cea334ad13 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -532,19 +532,20 @@ static int synaptics_validate_byte(unsigned char packet[], int idx, unsigned cha
532 return 0; 532 return 0;
533 533
534 switch (pkt_type) { 534 switch (pkt_type) {
535 case SYN_NEWABS:
536 case SYN_NEWABS_RELAXED:
537 return (packet[idx] & newabs_rel_mask[idx]) == newabs_rslt[idx];
538 535
539 case SYN_NEWABS_STRICT: 536 case SYN_NEWABS:
540 return (packet[idx] & newabs_mask[idx]) == newabs_rslt[idx]; 537 case SYN_NEWABS_RELAXED:
538 return (packet[idx] & newabs_rel_mask[idx]) == newabs_rslt[idx];
541 539
542 case SYN_OLDABS: 540 case SYN_NEWABS_STRICT:
543 return (packet[idx] & oldabs_mask[idx]) == oldabs_rslt[idx]; 541 return (packet[idx] & newabs_mask[idx]) == newabs_rslt[idx];
544 542
545 default: 543 case SYN_OLDABS:
546 printk(KERN_ERR "synaptics: unknown packet type %d\n", pkt_type); 544 return (packet[idx] & oldabs_mask[idx]) == oldabs_rslt[idx];
547 return 0; 545
546 default:
547 printk(KERN_ERR "synaptics: unknown packet type %d\n", pkt_type);
548 return 0;
548 } 549 }
549} 550}
550 551