diff options
Diffstat (limited to 'drivers/input/mousedev.c')
| -rw-r--r-- | drivers/input/mousedev.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index 564974ce5793..062848ac7e6b 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c | |||
| @@ -101,6 +101,7 @@ struct mousedev_list { | |||
| 101 | unsigned char ready, buffer, bufsiz; | 101 | unsigned char ready, buffer, bufsiz; |
| 102 | unsigned char imexseq, impsseq; | 102 | unsigned char imexseq, impsseq; |
| 103 | enum mousedev_emul mode; | 103 | enum mousedev_emul mode; |
| 104 | unsigned long last_buttons; | ||
| 104 | }; | 105 | }; |
| 105 | 106 | ||
| 106 | #define MOUSEDEV_SEQ_LEN 6 | 107 | #define MOUSEDEV_SEQ_LEN 6 |
| @@ -224,7 +225,7 @@ static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_h | |||
| 224 | spin_lock_irqsave(&list->packet_lock, flags); | 225 | spin_lock_irqsave(&list->packet_lock, flags); |
| 225 | 226 | ||
| 226 | p = &list->packets[list->head]; | 227 | p = &list->packets[list->head]; |
| 227 | if (list->ready && p->buttons != packet->buttons) { | 228 | if (list->ready && p->buttons != mousedev->packet.buttons) { |
| 228 | unsigned int new_head = (list->head + 1) % PACKET_QUEUE_LEN; | 229 | unsigned int new_head = (list->head + 1) % PACKET_QUEUE_LEN; |
| 229 | if (new_head != list->tail) { | 230 | if (new_head != list->tail) { |
| 230 | p = &list->packets[list->head = new_head]; | 231 | p = &list->packets[list->head = new_head]; |
| @@ -249,10 +250,13 @@ static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_h | |||
| 249 | p->dz += packet->dz; | 250 | p->dz += packet->dz; |
| 250 | p->buttons = mousedev->packet.buttons; | 251 | p->buttons = mousedev->packet.buttons; |
| 251 | 252 | ||
| 252 | list->ready = 1; | 253 | if (p->dx || p->dy || p->dz || p->buttons != list->last_buttons) |
| 254 | list->ready = 1; | ||
| 253 | 255 | ||
| 254 | spin_unlock_irqrestore(&list->packet_lock, flags); | 256 | spin_unlock_irqrestore(&list->packet_lock, flags); |
| 255 | kill_fasync(&list->fasync, SIGIO, POLL_IN); | 257 | |
| 258 | if (list->ready) | ||
| 259 | kill_fasync(&list->fasync, SIGIO, POLL_IN); | ||
| 256 | } | 260 | } |
| 257 | 261 | ||
| 258 | wake_up_interruptible(&mousedev->wait); | 262 | wake_up_interruptible(&mousedev->wait); |
| @@ -477,9 +481,10 @@ static void mousedev_packet(struct mousedev_list *list, signed char *ps2_data) | |||
| 477 | } | 481 | } |
| 478 | 482 | ||
| 479 | if (!p->dx && !p->dy && !p->dz) { | 483 | if (!p->dx && !p->dy && !p->dz) { |
| 480 | if (list->tail == list->head) | 484 | if (list->tail == list->head) { |
| 481 | list->ready = 0; | 485 | list->ready = 0; |
| 482 | else | 486 | list->last_buttons = p->buttons; |
| 487 | } else | ||
| 483 | list->tail = (list->tail + 1) % PACKET_QUEUE_LEN; | 488 | list->tail = (list->tail + 1) % PACKET_QUEUE_LEN; |
| 484 | } | 489 | } |
| 485 | 490 | ||
| @@ -642,9 +647,9 @@ static struct input_handle *mousedev_connect(struct input_handler *handler, stru | |||
| 642 | 647 | ||
| 643 | devfs_mk_cdev(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), | 648 | devfs_mk_cdev(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), |
| 644 | S_IFCHR|S_IRUGO|S_IWUSR, "input/mouse%d", minor); | 649 | S_IFCHR|S_IRUGO|S_IWUSR, "input/mouse%d", minor); |
| 645 | class_simple_device_add(input_class, | 650 | class_device_create(input_class, |
| 646 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), | 651 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), |
| 647 | dev->dev, "mouse%d", minor); | 652 | dev->dev, "mouse%d", minor); |
| 648 | 653 | ||
| 649 | return &mousedev->handle; | 654 | return &mousedev->handle; |
| 650 | } | 655 | } |
| @@ -654,7 +659,8 @@ static void mousedev_disconnect(struct input_handle *handle) | |||
| 654 | struct mousedev *mousedev = handle->private; | 659 | struct mousedev *mousedev = handle->private; |
| 655 | struct mousedev_list *list; | 660 | struct mousedev_list *list; |
| 656 | 661 | ||
| 657 | class_simple_device_remove(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor)); | 662 | class_device_destroy(input_class, |
| 663 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor)); | ||
| 658 | devfs_remove("input/mouse%d", mousedev->minor); | 664 | devfs_remove("input/mouse%d", mousedev->minor); |
| 659 | mousedev->exist = 0; | 665 | mousedev->exist = 0; |
| 660 | 666 | ||
| @@ -730,8 +736,8 @@ static int __init mousedev_init(void) | |||
| 730 | 736 | ||
| 731 | devfs_mk_cdev(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), | 737 | devfs_mk_cdev(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), |
| 732 | S_IFCHR|S_IRUGO|S_IWUSR, "input/mice"); | 738 | S_IFCHR|S_IRUGO|S_IWUSR, "input/mice"); |
| 733 | class_simple_device_add(input_class, MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), | 739 | class_device_create(input_class, |
| 734 | NULL, "mice"); | 740 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), NULL, "mice"); |
| 735 | 741 | ||
| 736 | #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX | 742 | #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX |
| 737 | if (!(psaux_registered = !misc_register(&psaux_mouse))) | 743 | if (!(psaux_registered = !misc_register(&psaux_mouse))) |
| @@ -750,7 +756,8 @@ static void __exit mousedev_exit(void) | |||
| 750 | misc_deregister(&psaux_mouse); | 756 | misc_deregister(&psaux_mouse); |
| 751 | #endif | 757 | #endif |
| 752 | devfs_remove("input/mice"); | 758 | devfs_remove("input/mice"); |
| 753 | class_simple_device_remove(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX)); | 759 | class_device_destroy(input_class, |
| 760 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX)); | ||
| 754 | input_unregister_handler(&mousedev_handler); | 761 | input_unregister_handler(&mousedev_handler); |
| 755 | } | 762 | } |
| 756 | 763 | ||
