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 ...@@ -330,7 +330,6 @@ static ssize_t mousedev_write(struct file * file, const char * buffer, size_t co
list->ps2[0] = 0xfa; list->ps2[0] = 0xfa;
list->bufsiz = 1; list->bufsiz = 1;
list->ready = 1;
switch (c) { switch (c) {
...@@ -404,17 +403,17 @@ static ssize_t mousedev_read(struct file * file, char * buffer, size_t count, lo ...@@ -404,17 +403,17 @@ static ssize_t mousedev_read(struct file * file, char * buffer, size_t count, lo
if (retval) if (retval)
return retval; return retval;
if (!list->buffer) if (!list->buffer && list->ready)
mousedev_packet(list, 0); mousedev_packet(list, 0);
if (count > list->buffer) if (count > list->buffer)
count = list->buffer; count = list->buffer;
if (copy_to_user(buffer, list->ps2 + list->bufsiz - list->buffer, count))
return -EFAULT;
list->buffer -= count; list->buffer -= count;
if (copy_to_user(buffer, list->ps2 + list->bufsiz - list->buffer - count, count))
return -EFAULT;
return count; 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