[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] Fix input-linux reading from device
From: |
Javier Celaya |
Subject: |
Re: [Qemu-devel] [PATCH v2] Fix input-linux reading from device |
Date: |
Mon, 27 Mar 2017 13:30:33 +0200 |
Hi
Javi
2017-03-27 12:11 GMT+02:00 Gerd Hoffmann <address@hidden>:
> On So, 2017-03-26 at 11:53 +0200, Javier Celaya wrote:
> > The evdev devices in input-linux.c are read in blocks of one whole
> > event. If there are not enough bytes available, they are discarded,
> > instead of being kept for the next read operation. This results in
> > lost events, of even non-working devices.
>
> Have you seen this happening in practice?
>
Yes, quite frequently, like once per hour. Totally destroys a good gaming
session :)
The curious thing is, the mouse stops working, but in the keyboard I see
some missing keyup events (the keys get stuck), but then it recovers.
>
> > + struct input_event event;
> > + int to_be_read;
>
> I'd suggest to store offset (i.e. bytes already read) instead, should
> make the whole logic a bit simpler and easier to read.
>
OK
>
> > + } else if (rc > 0){
>
> checkpatch.pl complains here:
> ERROR: space required before the open brace '{'
>
Oops, missed that
>
> cheers,
> Gerd
>
>