diff options
Diffstat (limited to 'drivers/input/mousedev.c')
| -rw-r--r-- | drivers/input/mousedev.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index 564974ce5793..96fb9870834a 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 | ||
