Commit 382b4673 authored by Vojtech Pavlik's avatar Vojtech Pavlik

In mousedev.c, don't send a zero mouse movement after a command if

requested, also fix a possible race with two processes using the same
file descriptor.
parent a4ccbd5b
......@@ -330,7 +330,6 @@ static ssize_t mousedev_write(struct file * file, const char * buffer, size_t co
list->ps2[0] = 0xfa;
list->bufsiz = 1;
list->ready = 1;
switch (c) {
......@@ -404,17 +403,17 @@ static ssize_t mousedev_read(struct file * file, char * buffer, size_t count, lo
if (retval)
return retval;
if (!list->buffer)
if (!list->buffer && list->ready)
mousedev_packet(list, 0);
if (count > list->buffer)
count = list->buffer;
if (copy_to_user(buffer, list->ps2 + list->bufsiz - list->buffer, count))
return -EFAULT;
list->buffer -= count;
if (copy_to_user(buffer, list->ps2 + list->bufsiz - list->buffer - count, count))
return -EFAULT;
return count;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment