From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oliver Neukum Subject: Re: [linux-usb-devel] detecting when keys are being pressed on a keyboard Date: Mon, 24 Sep 2007 15:39:19 +0200 Message-ID: <200709241539.19610.oliver@neukum.org> References: <200709211033.09698.oliver@neukum.org> <200709241256.05300.oliver@neukum.org> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline Sender: owner-linux-input@atrey.karlin.mff.cuni.cz List-Help: List-Owner: List-Post: List-Unsubscribe: To: Dmitry Torokhov Cc: linux-usb-devel@lists.sourceforge.net, linux-input@atrey.karlin.mff.cuni.cz List-Id: linux-input@vger.kernel.org Am Montag 24 September 2007 schrieb Dmitry Torokhov: > Hi Oliver, > > On 9/24/07, Oliver Neukum 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