From: John Lenz <lenz@cs.wisc.edu>
To: Vojtech Pavlik <vojtech@suse.cz>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] new class for led devices
Date: Wed, 22 Sep 2004 19:53:07 +0000 [thread overview]
Message-ID: <1095882787l.4629l.0l@hydra> (raw)
In-Reply-To: <20040922072727.GA4553@ucw.cz>
On 09/22/04 02:27:27, Vojtech Pavlik wrote:
>
> Well, we already have an interface for setting LEDs through the input
> layer, it'd be trivial to create an input device driver with just
> LEDs
> and no buttons/keys ...
>
It's not really a nice fit with what we are trying to do. In the input
layer, there is a whole list of led types, none of which make sense...
For example, on the Sharp Zaurus, we have two leds, one green, one
amber. Which one is LED_NUML? We don't enforce anything on the policy
userspace has for the leds, sometimes it might use the amber led to let
the user know they have new mail, and sometimes to show the power is
plugged in, sometimes for something else (maybe even that caps lock or
numlock is on).
Secondly, there is no good way through the input layer to query which
leds and what colors are present. I guess you can look at /proc/bus/
input/devices and if we agreed on a common name format or something.
If you look around in arch/arm/mach-sa1100 and arch/arm/mach-pxa you
can see we already have around 15 led devices, each one of them
different. Some support a green and a red led, some only a red led,
some an amber and green, some control a single led that can be multiple
colors, etc. Userspace needs a way to ask which leds are available and
which color will be turned on by which codes.
We could solve these problems in the input layer by adding some more
information into /sys/class/input/. If we could add an attribute
saying, this is a led (or better yet, returning the info found in /
proc/bus/input/devices for this device), and moreover an attribute
specifying the mapping between led code numbers and a description (be
it a color or numlock or whatever), then userspace would not need to
use the LED_NUML symbols from input.h and we wouldn't need to add
entries into that enumeration for every possible led type in the
future.
Userspace would look in /sys/class/input/event2/mapping or whatever and
realize there are two entries, 0 = green, 1 = amber or something. Then
when writing to /dev/input/event2 userspace fills in 0 in
input_event.code to change the green and 1 to change the amber.
It's still not as intuitive as going /sys/class/leds and having two
directories, one for each led, a color attribute to see color and a
light attribute to toggle the led, but in the interest of using already
available interfaces I could scrap it and use the input layer.
John
next prev parent reply other threads:[~2004-09-22 19:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-22 5:07 [PATCH] new class for led devices John Lenz
2004-09-22 7:27 ` Vojtech Pavlik
2004-09-22 19:53 ` John Lenz [this message]
2004-09-22 22:07 ` Pavel Machek
2004-09-23 17:28 ` John Lenz
2004-09-23 18:02 ` Pavel Machek
2004-09-24 7:01 ` Vojtech Pavlik
2004-09-24 8:30 ` Vojtech Pavlik
2004-09-22 7:54 ` Geert Uytterhoeven
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=1095882787l.4629l.0l@hydra \
--to=lenz@cs.wisc.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=vojtech@suse.cz \
/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.