Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 1625
b: refs/heads/master
c: c1e4c8d
h: refs/heads/master
i:
  1623: bf08656
v: v3
  • Loading branch information
Pavel Machek authored and Linus Torvalds committed May 28, 2005
1 parent 81cb81d commit 8f81b71
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8bd7f125e2f217c8aa3dff005ae291c81246c340
refs/heads/master: c1e4c8d3ee3300f363a52fd4cf3d90fdf5098f5a
15 changes: 10 additions & 5 deletions trunk/drivers/input/mousedev.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ struct mousedev_list {
unsigned char ready, buffer, bufsiz;
unsigned char imexseq, impsseq;
enum mousedev_emul mode;
unsigned long last_buttons;
};

#define MOUSEDEV_SEQ_LEN 6
Expand Down Expand Up @@ -224,7 +225,7 @@ static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_h
spin_lock_irqsave(&list->packet_lock, flags);

p = &list->packets[list->head];
if (list->ready && p->buttons != packet->buttons) {
if (list->ready && p->buttons != mousedev->packet.buttons) {
unsigned int new_head = (list->head + 1) % PACKET_QUEUE_LEN;
if (new_head != list->tail) {
p = &list->packets[list->head = new_head];
Expand All @@ -249,10 +250,13 @@ static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_h
p->dz += packet->dz;
p->buttons = mousedev->packet.buttons;

list->ready = 1;
if (p->dx || p->dy || p->dz || p->buttons != list->last_buttons)
list->ready = 1;

spin_unlock_irqrestore(&list->packet_lock, flags);
kill_fasync(&list->fasync, SIGIO, POLL_IN);

if (list->ready)
kill_fasync(&list->fasync, SIGIO, POLL_IN);
}

wake_up_interruptible(&mousedev->wait);
Expand Down Expand Up @@ -477,9 +481,10 @@ static void mousedev_packet(struct mousedev_list *list, signed char *ps2_data)
}

if (!p->dx && !p->dy && !p->dz) {
if (list->tail == list->head)
if (list->tail == list->head) {
list->ready = 0;
else
list->last_buttons = p->buttons;
} else
list->tail = (list->tail + 1) % PACKET_QUEUE_LEN;
}

Expand Down

0 comments on commit 8f81b71

Please sign in to comment.