linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
To: Oliver Neukum <oliver@neukum.org>
Cc: linux-usb-devel@lists.sourceforge.net,
	linux-input@atrey.karlin.mff.cuni.cz
Subject: Re: [linux-usb-devel] detecting when keys are being pressed on a keyboard
Date: Mon, 24 Sep 2007 08:50:04 -0400	[thread overview]
Message-ID: <d120d5000709240550u3bb1d455vc9bb54b2e57f4313@mail.gmail.com> (raw)
In-Reply-To: <200709241256.05300.oliver@neukum.org>

Hi Oliver,

On 9/24/07, Oliver Neukum <oliver@neukum.org> wrote:
> Am Freitag 21 September 2007 schrieb Jiri Kosina:
> > On Fri, 21 Sep 2007, Oliver Neukum wrote:
> >
> > > I got the strange case of a keyboard going into autosuspend while a key
> > > was being pressed. The key release never arrived and I had to unplug the
> > > keyboard to get the key unstuck. Is there a clean way to learn from
> > > hid-core.c if a keyboard has keys pressed?
> >
> > 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.

> Secondly, what is to happen in case of a system wide suspend? Will
> the system wake up thinking that the key is still pressed?
>

For now it will but it is about to change. Input device will send
'release' events for all pressed keys from their suspend method.

-- 
Dmitry

  reply	other threads:[~2007-09-24 12:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-21  8:33 detecting when keys are being pressed on a keyboard Oliver Neukum
2007-09-21 12:47 ` Jiri Kosina
2007-09-24 10:56   ` Oliver Neukum
2007-09-24 12:50     ` Dmitry Torokhov [this message]
2007-09-24 13:39       ` [linux-usb-devel] " Oliver Neukum
2007-09-24 13:45         ` Dmitry Torokhov
2007-09-24 13:54           ` Oliver Neukum
2007-09-24 13:45     ` Jiri Kosina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d120d5000709240550u3bb1d455vc9bb54b2e57f4313@mail.gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=linux-input@atrey.karlin.mff.cuni.cz \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=oliver@neukum.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).