Re: [linux-usb-devel] detecting when keys are being pressed on a keyboard
Oliver Neukum <[email protected]>
| Newsgroups | gmane.linux.kernel.input,gmane.linux.usb.devel |
|---|---|
| Message-ID | <[email protected]> |
Am Montag 24 September 2007 schrieb Dmitry Torokhov: > Hi Oliver, > > On 9/24/07, Oliver Neukum <[email protected]> wrote: > > Am Freitag 21 September 2007 schrieb Jiri Kosina: > > > Hi Oliver, > > > > > > HID doesn't keep any permanent state by itself. If you want to know > > > whether a given key is currently pressed or not, you'd have to inspect the > > > bitfields inside input_dev*, I am afraid. > > > > I see no way to do this without a race condition. The field isn't locked > > as far as I can tell. > > You can take input_dev->event_lock to stop event from propagating > through input core while you are evaluating the bits. Input lcoking > changes are im -mm and will be merged into 2.6.24. Hi Dmitry, I was thinking about a second approach. As all keypresses run through the interrupt handlers of the hid driver, how about checking the bit field in the interrupt handler after calling hid_input_report() ? Regards Oliver