diff options
Diffstat (limited to 'drivers/input/mouse')
-rw-r--r-- | drivers/input/mouse/appletouch.c | 113 | ||||
-rw-r--r-- | drivers/input/mouse/lifebook.c | 8 | ||||
-rw-r--r-- | drivers/input/mouse/synaptics.c | 2 | ||||
-rw-r--r-- | drivers/input/mouse/touchkit_ps2.h | 3 |
4 files changed, 83 insertions, 43 deletions
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c index e3215267db11..a1804bfdbb8c 100644 --- a/drivers/input/mouse/appletouch.c +++ b/drivers/input/mouse/appletouch.c | |||
@@ -155,6 +155,8 @@ struct atp { | |||
155 | int xy_acc[ATP_XSENSORS + ATP_YSENSORS]; | 155 | int xy_acc[ATP_XSENSORS + ATP_YSENSORS]; |
156 | int overflowwarn; /* overflow warning printed? */ | 156 | int overflowwarn; /* overflow warning printed? */ |
157 | int datalen; /* size of an USB urb transfer */ | 157 | int datalen; /* size of an USB urb transfer */ |
158 | int idlecount; /* number of empty packets */ | ||
159 | struct work_struct work; | ||
158 | }; | 160 | }; |
159 | 161 | ||
160 | #define dbg_dump(msg, tab) \ | 162 | #define dbg_dump(msg, tab) \ |
@@ -208,6 +210,55 @@ static inline int atp_is_geyser_3(struct atp *dev) | |||
208 | (productId == GEYSER4_JIS_PRODUCT_ID); | 210 | (productId == GEYSER4_JIS_PRODUCT_ID); |
209 | } | 211 | } |
210 | 212 | ||
213 | /* | ||
214 | * By default Geyser 3 device sends standard USB HID mouse | ||
215 | * packets (Report ID 2). This code changes device mode, so it | ||
216 | * sends raw sensor reports (Report ID 5). | ||
217 | */ | ||
218 | static int atp_geyser3_init(struct usb_device *udev) | ||
219 | { | ||
220 | char data[8]; | ||
221 | int size; | ||
222 | |||
223 | size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | ||
224 | ATP_GEYSER3_MODE_READ_REQUEST_ID, | ||
225 | USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
226 | ATP_GEYSER3_MODE_REQUEST_VALUE, | ||
227 | ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000); | ||
228 | |||
229 | if (size != 8) { | ||
230 | err("Could not do mode read request from device" | ||
231 | " (Geyser 3 mode)"); | ||
232 | return -EIO; | ||
233 | } | ||
234 | |||
235 | /* Apply the mode switch */ | ||
236 | data[0] = ATP_GEYSER3_MODE_VENDOR_VALUE; | ||
237 | |||
238 | size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | ||
239 | ATP_GEYSER3_MODE_WRITE_REQUEST_ID, | ||
240 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
241 | ATP_GEYSER3_MODE_REQUEST_VALUE, | ||
242 | ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000); | ||
243 | |||
244 | if (size != 8) { | ||
245 | err("Could not do mode write request to device" | ||
246 | " (Geyser 3 mode)"); | ||
247 | return -EIO; | ||
248 | } | ||
249 | return 0; | ||
250 | } | ||
251 | |||
252 | /* Reinitialise the device if it's a geyser 3 */ | ||
253 | static void atp_reinit(struct work_struct *work) | ||
254 | { | ||
255 | struct atp *dev = container_of(work, struct atp, work); | ||
256 | struct usb_device *udev = dev->udev; | ||
257 | |||
258 | dev->idlecount = 0; | ||
259 | atp_geyser3_init(udev); | ||
260 | } | ||
261 | |||
211 | static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact, | 262 | static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact, |
212 | int *z, int *fingers) | 263 | int *z, int *fingers) |
213 | { | 264 | { |
@@ -277,6 +328,7 @@ static void atp_complete(struct urb* urb) | |||
277 | { | 328 | { |
278 | int x, y, x_z, y_z, x_f, y_f; | 329 | int x, y, x_z, y_z, x_f, y_f; |
279 | int retval, i, j; | 330 | int retval, i, j; |
331 | int key; | ||
280 | struct atp *dev = urb->context; | 332 | struct atp *dev = urb->context; |
281 | 333 | ||
282 | switch (urb->status) { | 334 | switch (urb->status) { |
@@ -417,6 +469,7 @@ static void atp_complete(struct urb* urb) | |||
417 | ATP_XFACT, &x_z, &x_f); | 469 | ATP_XFACT, &x_z, &x_f); |
418 | y = atp_calculate_abs(dev->xy_acc + ATP_XSENSORS, ATP_YSENSORS, | 470 | y = atp_calculate_abs(dev->xy_acc + ATP_XSENSORS, ATP_YSENSORS, |
419 | ATP_YFACT, &y_z, &y_f); | 471 | ATP_YFACT, &y_z, &y_f); |
472 | key = dev->data[dev->datalen - 1] & 1; | ||
420 | 473 | ||
421 | if (x && y) { | 474 | if (x && y) { |
422 | if (dev->x_old != -1) { | 475 | if (dev->x_old != -1) { |
@@ -439,8 +492,8 @@ static void atp_complete(struct urb* urb) | |||
439 | } | 492 | } |
440 | dev->x_old = x; | 493 | dev->x_old = x; |
441 | dev->y_old = y; | 494 | dev->y_old = y; |
442 | } | 495 | |
443 | else if (!x && !y) { | 496 | } else if (!x && !y) { |
444 | 497 | ||
445 | dev->x_old = dev->y_old = -1; | 498 | dev->x_old = dev->y_old = -1; |
446 | input_report_key(dev->input, BTN_TOUCH, 0); | 499 | input_report_key(dev->input, BTN_TOUCH, 0); |
@@ -449,11 +502,21 @@ static void atp_complete(struct urb* urb) | |||
449 | 502 | ||
450 | /* reset the accumulator on release */ | 503 | /* reset the accumulator on release */ |
451 | memset(dev->xy_acc, 0, sizeof(dev->xy_acc)); | 504 | memset(dev->xy_acc, 0, sizeof(dev->xy_acc)); |
452 | } | ||
453 | 505 | ||
454 | input_report_key(dev->input, BTN_LEFT, | 506 | /* Geyser 3 will continue to send packets continually after |
455 | !!dev->data[dev->datalen - 1]); | 507 | the first touch unless reinitialised. Do so if it's been |
508 | idle for a while in order to avoid waking the kernel up | ||
509 | several hundred times a second */ | ||
510 | if (!key && atp_is_geyser_3(dev)) { | ||
511 | dev->idlecount++; | ||
512 | if (dev->idlecount == 10) { | ||
513 | dev->valid = 0; | ||
514 | schedule_work(&dev->work); | ||
515 | } | ||
516 | } | ||
517 | } | ||
456 | 518 | ||
519 | input_report_key(dev->input, BTN_LEFT, key); | ||
457 | input_sync(dev->input); | 520 | input_sync(dev->input); |
458 | 521 | ||
459 | exit: | 522 | exit: |
@@ -480,6 +543,7 @@ static void atp_close(struct input_dev *input) | |||
480 | struct atp *dev = input_get_drvdata(input); | 543 | struct atp *dev = input_get_drvdata(input); |
481 | 544 | ||
482 | usb_kill_urb(dev->urb); | 545 | usb_kill_urb(dev->urb); |
546 | cancel_work_sync(&dev->work); | ||
483 | dev->open = 0; | 547 | dev->open = 0; |
484 | } | 548 | } |
485 | 549 | ||
@@ -528,40 +592,10 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id | |||
528 | dev->datalen = 81; | 592 | dev->datalen = 81; |
529 | 593 | ||
530 | if (atp_is_geyser_3(dev)) { | 594 | if (atp_is_geyser_3(dev)) { |
531 | /* | 595 | /* switch to raw sensor mode */ |
532 | * By default Geyser 3 device sends standard USB HID mouse | 596 | if (atp_geyser3_init(udev)) |
533 | * packets (Report ID 2). This code changes device mode, so it | ||
534 | * sends raw sensor reports (Report ID 5). | ||
535 | */ | ||
536 | char data[8]; | ||
537 | int size; | ||
538 | |||
539 | size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | ||
540 | ATP_GEYSER3_MODE_READ_REQUEST_ID, | ||
541 | USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
542 | ATP_GEYSER3_MODE_REQUEST_VALUE, | ||
543 | ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000); | ||
544 | |||
545 | if (size != 8) { | ||
546 | err("Could not do mode read request from device" | ||
547 | " (Geyser 3 mode)"); | ||
548 | goto err_free_devs; | 597 | goto err_free_devs; |
549 | } | ||
550 | |||
551 | /* Apply the mode switch */ | ||
552 | data[0] = ATP_GEYSER3_MODE_VENDOR_VALUE; | ||
553 | |||
554 | size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | ||
555 | ATP_GEYSER3_MODE_WRITE_REQUEST_ID, | ||
556 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
557 | ATP_GEYSER3_MODE_REQUEST_VALUE, | ||
558 | ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000); | ||
559 | 598 | ||
560 | if (size != 8) { | ||
561 | err("Could not do mode write request to device" | ||
562 | " (Geyser 3 mode)"); | ||
563 | goto err_free_devs; | ||
564 | } | ||
565 | printk("appletouch Geyser 3 inited.\n"); | 599 | printk("appletouch Geyser 3 inited.\n"); |
566 | } | 600 | } |
567 | 601 | ||
@@ -636,6 +670,8 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id | |||
636 | /* save our data pointer in this interface device */ | 670 | /* save our data pointer in this interface device */ |
637 | usb_set_intfdata(iface, dev); | 671 | usb_set_intfdata(iface, dev); |
638 | 672 | ||
673 | INIT_WORK(&dev->work, atp_reinit); | ||
674 | |||
639 | return 0; | 675 | return 0; |
640 | 676 | ||
641 | err_free_buffer: | 677 | err_free_buffer: |
@@ -669,14 +705,17 @@ static void atp_disconnect(struct usb_interface *iface) | |||
669 | static int atp_suspend(struct usb_interface *iface, pm_message_t message) | 705 | static int atp_suspend(struct usb_interface *iface, pm_message_t message) |
670 | { | 706 | { |
671 | struct atp *dev = usb_get_intfdata(iface); | 707 | struct atp *dev = usb_get_intfdata(iface); |
708 | |||
672 | usb_kill_urb(dev->urb); | 709 | usb_kill_urb(dev->urb); |
673 | dev->valid = 0; | 710 | dev->valid = 0; |
711 | |||
674 | return 0; | 712 | return 0; |
675 | } | 713 | } |
676 | 714 | ||
677 | static int atp_resume(struct usb_interface *iface) | 715 | static int atp_resume(struct usb_interface *iface) |
678 | { | 716 | { |
679 | struct atp *dev = usb_get_intfdata(iface); | 717 | struct atp *dev = usb_get_intfdata(iface); |
718 | |||
680 | if (dev->open && usb_submit_urb(dev->urb, GFP_ATOMIC)) | 719 | if (dev->open && usb_submit_urb(dev->urb, GFP_ATOMIC)) |
681 | return -EIO; | 720 | return -EIO; |
682 | 721 | ||
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c index 9561dee120c6..d7de4c53b3d8 100644 --- a/drivers/input/mouse/lifebook.c +++ b/drivers/input/mouse/lifebook.c | |||
@@ -27,7 +27,7 @@ struct lifebook_data { | |||
27 | 27 | ||
28 | static const char *desired_serio_phys; | 28 | static const char *desired_serio_phys; |
29 | 29 | ||
30 | static int lifebook_set_serio_phys(struct dmi_system_id *d) | 30 | static int lifebook_set_serio_phys(const struct dmi_system_id *d) |
31 | { | 31 | { |
32 | desired_serio_phys = d->driver_data; | 32 | desired_serio_phys = d->driver_data; |
33 | return 0; | 33 | return 0; |
@@ -35,13 +35,13 @@ static int lifebook_set_serio_phys(struct dmi_system_id *d) | |||
35 | 35 | ||
36 | static unsigned char lifebook_use_6byte_proto; | 36 | static unsigned char lifebook_use_6byte_proto; |
37 | 37 | ||
38 | static int lifebook_set_6byte_proto(struct dmi_system_id *d) | 38 | static int lifebook_set_6byte_proto(const struct dmi_system_id *d) |
39 | { | 39 | { |
40 | lifebook_use_6byte_proto = 1; | 40 | lifebook_use_6byte_proto = 1; |
41 | return 0; | 41 | return 0; |
42 | } | 42 | } |
43 | 43 | ||
44 | static struct dmi_system_id lifebook_dmi_table[] = { | 44 | static const struct dmi_system_id lifebook_dmi_table[] = { |
45 | { | 45 | { |
46 | .ident = "FLORA-ie 55mi", | 46 | .ident = "FLORA-ie 55mi", |
47 | .matches = { | 47 | .matches = { |
@@ -117,7 +117,7 @@ static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse) | |||
117 | { | 117 | { |
118 | struct lifebook_data *priv = psmouse->private; | 118 | struct lifebook_data *priv = psmouse->private; |
119 | struct input_dev *dev1 = psmouse->dev; | 119 | struct input_dev *dev1 = psmouse->dev; |
120 | struct input_dev *dev2 = priv->dev2; | 120 | struct input_dev *dev2 = priv ? priv->dev2 : NULL; |
121 | unsigned char *packet = psmouse->packet; | 121 | unsigned char *packet = psmouse->packet; |
122 | int relative_packet = packet[0] & 0x08; | 122 | int relative_packet = packet[0] & 0x08; |
123 | 123 | ||
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 666ad3a53fdb..d349c4a5e3e8 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -602,7 +602,7 @@ static int synaptics_reconnect(struct psmouse *psmouse) | |||
602 | 602 | ||
603 | #if defined(__i386__) | 603 | #if defined(__i386__) |
604 | #include <linux/dmi.h> | 604 | #include <linux/dmi.h> |
605 | static struct dmi_system_id toshiba_dmi_table[] = { | 605 | static const struct dmi_system_id toshiba_dmi_table[] = { |
606 | { | 606 | { |
607 | .ident = "Toshiba Satellite", | 607 | .ident = "Toshiba Satellite", |
608 | .matches = { | 608 | .matches = { |
diff --git a/drivers/input/mouse/touchkit_ps2.h b/drivers/input/mouse/touchkit_ps2.h index 61e9dfd8419f..8a0dd3574aef 100644 --- a/drivers/input/mouse/touchkit_ps2.h +++ b/drivers/input/mouse/touchkit_ps2.h | |||
@@ -15,7 +15,8 @@ | |||
15 | #ifdef CONFIG_MOUSE_PS2_TOUCHKIT | 15 | #ifdef CONFIG_MOUSE_PS2_TOUCHKIT |
16 | int touchkit_ps2_detect(struct psmouse *psmouse, int set_properties); | 16 | int touchkit_ps2_detect(struct psmouse *psmouse, int set_properties); |
17 | #else | 17 | #else |
18 | inline int touchkit_ps2_detect(struct psmouse *psmouse, int set_properties) | 18 | static inline int touchkit_ps2_detect(struct psmouse *psmouse, |
19 | int set_properties) | ||
19 | { | 20 | { |
20 | return -ENOSYS; | 21 | return -ENOSYS; |
21 | } | 22 | } |