All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input <linux-input@vger.kernel.org>
Subject: Re: input devices handling
Date: Wed, 14 Jan 2009 16:32:43 +0300	[thread overview]
Message-ID: <496DE97B.9010901@msgid.tls.msk.ru> (raw)
In-Reply-To: <20090112214424.ZZRA012@mailhub.coreip.homeip.net>

Dmitry Torokhov wrote:
[power/sleep buttons]
>> Before, there was /proc/acpi/event and /etc/acpid/* stuff,
>> and it was easy (but somewhat clumsy) to act to system power
>> down button.  But the "proper way" now is to handle
>> /dev/input/event* interface, because such "Power" button can
>> be on a keyboard, on a remote control, and so on.  I understand
>> the idea, and I like it.
>>
>> But now the question.  How one supposed to find all the devices
>> which generate such events?  I mean not about scanning the /dev
>> directory, which can be done once at startup, but about REscanning
>> it to find which NEW keyboards and the like appeared since last
>> (re)scan and which were removed.
> 
> You can either listen to hotplug events or poll (select)
> /proc/bus/input/devices - waiters are woken up every time we
> add or remove a new input device or a new input handler.

Hmm.  Seems to be too much for a simple "power down when i press
`power' button' stuff.  Where the only thing needed is to run a
script when this button is pressed, but the code to watch for the
input device changes becomes larger and more complex than the
actual thing it should do.  (Maybe I stop somewhere at the middle:
scan all devices at startup and rescan when receiving a HUP signal,
or require a restart.  But the whole select-loop looks ugly too,
for such a simple task ;)

So this basically turns into another question being discussed in a
parallel thread: /dev/input/mice, /dev/input/keyboard, and maybe
/dev/input/event meta-devices...

Thanks!

/mjt

  reply	other threads:[~2009-01-14 13:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-12 20:19 input devices handling Michael Tokarev
2009-01-13  5:47 ` Dmitry Torokhov
2009-01-14 13:32   ` Michael Tokarev [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-10-22 21:12 Michael Tokarev

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=496DE97B.9010901@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.