From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Zhang Rui <rui.zhang@intel.com>
Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>,
Len Brown <lenb@kernel.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>
Subject: Re: a question about lid input device
Date: Tue, 6 Jul 2010 22:36:20 -0700 [thread overview]
Message-ID: <20100707053619.GA9071@core.coreip.homeip.net> (raw)
In-Reply-To: <1278472085.4537.7672.camel@rzhang1-desktop>
On Wed, Jul 07, 2010 at 11:08:05AM +0800, Zhang Rui wrote:
> On Tue, 2010-07-06 at 04:27 +0800, Dmitry Torokhov wrote:
> > On Mon, Jul 05, 2010 at 04:49:45PM -0300, Henrique de Moraes Holschuh wrote:
> > > On Mon, 05 Jul 2010, Zhang Rui wrote:
> > > > > I think if you can listen to uevents you can just as easily open /dev/
> > > > > input/eventX and listen to proper input events.
> > > > >
> > > > the question is users may want to get the lid switch STATUS,
> > > > asynchronously.
> > >
> > > More often than not, you need to know the current state when dealing
> > > with EV_SW, to be able to do anything sensbile with it in GUIs, etc.
> > >
> >
> > I understand the need of getting the current state of a lid
> > switch/key/etc (and for that someone just need to write a utility
> > useable from shell scripts). But I do not understand how adding switch
> > state to uevents (that are emitted normally only when a new device is
> > created) will help here.
> >
> driver core creates a sysfs attribute for uevent. and users may query
> this file to get the lid state, say:
> $ cat /sys/class/input/input1/uevent
> PRODUCT=19/0/5/0
> NAME="Lid Switch"
> PHYS="PNP0C0D/button/input0"
> EV==21
> SW==1
> MODALIAS=input:b0019v0000p0005e0000-e0,5,kramlsfw0,
>
> I'm not quite familiar with the uevent stuff, so please correct me if
> I'm wrong. :)
> IMO, for input switch device, it's reasonable to report the switch state
> in uevent, in which HAL may also be interested. And users may get the
> switch status by running "cat /sys/class/input/inputX/uevent" as well.
>
No, I am sorry, you are inventing a new interface. Uevents normally
signal device creation and removal and carry capabilities, not the
state; there can be more than one switch/button per device, and so on.
Just write an utility that queries state via ioctl.
Thanks,
--
Dmitry
next prev parent reply other threads:[~2010-07-07 5:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-13 6:53 a question about lid input device Zhang Rui
2010-06-14 2:01 ` Henrique de Moraes Holschuh
2010-06-22 1:56 ` Len Brown
2010-07-04 8:35 ` Dmitry Torokhov
2010-07-05 1:09 ` Zhang Rui
2010-07-05 1:28 ` Dmitry Torokhov
2010-07-05 1:47 ` Zhang Rui
2010-07-05 19:49 ` Henrique de Moraes Holschuh
2010-07-05 20:04 ` Paul Fox
2010-07-05 20:27 ` Dmitry Torokhov
2010-07-07 3:08 ` Zhang Rui
2010-07-07 5:36 ` Dmitry Torokhov [this message]
2010-07-07 15:14 ` Paul Fox
2010-07-07 16:25 ` Dmitry Torokhov
2010-07-07 16:51 ` Paul Fox
2010-07-07 17:01 ` Dmitry Torokhov
2010-07-07 17:08 ` Paul Fox
2010-07-07 17:19 ` Dmitry Torokhov
2010-09-29 1:12 ` Len Brown
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=20100707053619.GA9071@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=hmh@hmh.eng.br \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=rui.zhang@intel.com \
/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