mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrey Borzenkov <arvidjaar@mail.ru>
To: Michael Tokarev <mjt@tls.msk.ru>, linux-kernel@vger.kernel.org
Subject: Re: acpi/apm events as inputs: how to handle?
Date: Mon, 07 Jan 2008 16:03:39 +0300	[thread overview]
Message-ID: <20080107130332.5973A2D6BF@smtp02.mtu.ru> (raw)
In-Reply-To: <47820224.2020902@msgid.tls.msk.ru>

Michael Tokarev wrote:

> Dmitry Torokhov wrote:
>> Hi Michael,
> 
> Hello!
> 
> []
>> There are keyboards (USB, PS2) with Sleep and Suspend buttons
>> that are not related to ACPI nor APM. We had 2 options - add
>> an input handler that would translate input events into ACPI
>> events and feed /proc/acpi/event[*] or go other way around and
>> use input layer for delivering suspend and sleep requests for
>> all types of keyboards/buttons, including ACPI buttons. The
>> secons option is better because userspace solution using input
>> layer will not be tied to a particular technology (ACPI) and
>> can be used on other platforms as well.
> 
> Aha, this makes sense.
> And it brings a few questions, too.
> 
> As far as I can see, there's little information about how to
> actually use the input interface.  Let's suppose I'm about to
> write an application (a daemon) that should replace acpid --
> it's handling of the said buttons (power and sleep).  How to
> find the right devices?  Should it use /dev/input/event* or
> something else?  How about handling hot-plugged devices like
> new (and removed) keyboards? (And yes, my keyboard has a sleep
> button.)
> 

Well, you use event device in any case; as for finding right one - I guess
you look at device capabilities and filter what you need ...

{pts/0}%
cat /sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input1/capabilities/key
100000 0 0 0

you could also check name but I guess it is unreliable

{pts/0}% cat /sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input1/name
Power Button (FF)

Then you have your event device:

{pts/0}% ll -d /sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input1/event1
drwxr-xr-x 3 root root 0 2008-01-07
15:32 /sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input1/event1/

the problem that you *really* have - nobody prevents user from using udev to
renaming /dev/input/event1 away into anything (s)he likes. Of course you
could do

{pts/0}%
udevinfo --query=name --path /devices/LNXSYSTM:00/LNXPWRBN:00/input/input1/event1
input/event1

.. but at some point we have to commit to support this interface forever.

> And by the way, what INPUT can one expect from a PC speaker?
> input: PC Speaker as /devices/platform/pcspkr/input/input0
> 

I ask myself about LNXVIDEO as well.

/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:13/LNXVIDEO:00/input/input3/event3/



  reply	other threads:[~2008-01-07 13:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-02  9:56 Michael Tokarev
2008-01-05 23:30 ` Pavel Machek
2008-01-06  2:05 ` Dmitry Torokhov
2008-01-07 10:42   ` Michael Tokarev
2008-01-07 13:03     ` Andrey Borzenkov [this message]
2008-01-07 14:20       ` Dmitry Torokhov
2008-01-07 14:50         ` Michael Tokarev
2008-01-07 15:47           ` Michael Tokarev
2008-01-07 15:51             ` Dmitry Torokhov

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=20080107130332.5973A2D6BF@smtp02.mtu.ru \
    --to=arvidjaar@mail.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjt@tls.msk.ru \
    /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

all inboxes | Powered by JetHome®