lkml.org 
[lkml]   [2014]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] HID: usbhid: prevent unwanted events to be sent when re-opening the device
On Tue, 30 Sep 2014, Benjamin Tissoires wrote:

> When events occurs while no one is listening to the node (hid->open == 0
> and usb_kill_urb() called) some events are still stacked somewhere in
> the USB (kernel or device?) stack. When the node gets reopened, these
> events are drained, and this results in spurious touch down/up, or mouse
> button clicks.
>
> The problem was spotted with touchscreens in fdo bug #81781 [1], but it
> actually occurs with any mouse using hid-generic or touchscreen.
>
> A way to reproduce it is to call:
>
> $ xinput disable 9 ; sleep 5 ; xinput enable 9
>
> With 9 being the device ID for the touchscreen/mouse. During the "sleep",
> produce some touch events or click events. When "xinput enable" is called,
> at least one click is generated.
>
> This patch tries to fix this by draining the queue for 50 msec and
> during this time frame, not forwarding these old events to the hid layer.
>
> Hans completed the explanation:
> """
> Devices like mice (basically any hid device) will have a fifo
> on the device side, when we stop submitting urbs to get hid reports from
> it, that fifo will fill up, and when we resume we will get whatever
> is there in that fifo.
> """
>
> [1] https://bugs.freedesktop.org/show_bug.cgi?id=81781
>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
>
> OK, I know this is uggly, but I could not find a better way :(

I have been thinking about this quite a lot, but unfortunately wasn't able
to come up with anything better either, so I am queuing this now.

Thanks.

--
Jiri Kosina
SUSE Labs


\
 
 \ /
  Last update: 2014-10-29 11:21    [W:0.079 / U:0.512 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site