Re: [PATCH 23/28] keyboard, input: Add hook to input to allow lowlevel event clear
From: Dmitry Torokhov
Date: Mon Mar 01 2010 - 00:04:52 EST
On Sun, Feb 28, 2010 at 09:56:56PM -0600, Jason Wessel wrote:
> Dmitry Torokhov wrote:
> > The problem with your patch is that you end up using input_pass_event()
> > which only passes events to handler, but it does not reset device state.
> > This will cause loss of the first press of the same button after
> > returning from kdb. input_inject_event() should do what you need. You
> > just need to do it from a tasklet or, better yet (there is no
> > performance issue) schedule a work on keventd so you don't deadlock
> > on the event lock. It will also do all necessary locking, which is
> > something you seem to be ignoring.
> > ...
> For now I am just going to drop this patch from the series, and I think
> we should pick up the continuation of the discussion on the
> linux-input. The lack of this patch simply means keys can stuck down
> sometimes if you go in and out of the kernel debug shell when running
> X. People were able to live with this a long time in the original kdb
> v4.4, so they can live with it a while longer while a solution is hashed
> out to "unstick the keys".
> This will allow me to re-issue a pull request which has no patches which
> are in the discussion state.
> It is not obvious to me how walk through the input device list with the
> right locks and then obtain the handle required to call the inject
> input. It does not appear that it is possible to hold the locks while
> walking through the keycode device bitmap and issue calls to inject
> input. Is there any kind of input API function to obtain the device bitmaps?
There is key_down bitmap right there in keyboard.c that reflects all
keys that are considered "down" as far as keyboard driver is concerned.
You can use input_handler_for_each_handle() for kbd_handler to iterate
through all input handles and send "up" events for all keys that
keyboard.c is considering as being "down". There is no harm in sending
extra "up" events for keys that are not pressed - the event will simply
be ignored by input core.
Hope this helps.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/