From: Pavel Machek <pavel@suse.cz>
To: "Brown, Len" <len.brown@intel.com>
Cc: Shem Multinymous <multinymous@gmail.com>,
Matthew Garrett <mjg59@srcf.ucam.org>,
vojtech@suse.cz, kernel list <linux-kernel@vger.kernel.org>,
linux-thinkpad@linux-thinkpad.org, linux-acpi@vger.kernel.org
Subject: Re: Generic battery interface
Date: Fri, 28 Jul 2006 00:16:32 +0200 [thread overview]
Message-ID: <20060727221632.GE3797@elf.ucw.cz> (raw)
In-Reply-To: <CFF307C98FEABE47A452B27C06B85BB6011688D8@hdsmsx411.amr.corp.intel.com>
Hi!
> >So I've proposed /sys/class/battery/{acpi,apm,thinkpad}/BAT?/*
> >as a comrpromise:
> >A userspace app that only needs a generic voltage readout will try
> >(all of) /sys/class/battery/*/BAT0/voltage. This is your generic
> >interface.
>
> If we have to export all these totally different implementations
> via totally different paths, then we failed.
Agreed.
> sysfs is great for demos from a shell prompt,
> but isn't such a great programming interface, either
> from inside the kernel or from user-space.
Well, we have prior examples for /dev/XXX style interface (input), and
we have examples for /sys/XXX interface (LED subsystem). Each has its
advantages and disadvantages, and both are okay for programming
AFAICT.
> Please do not add more polling to user-space, else DaveJ
> will be putting it up as a further example of "Why userspace sucks"
> at the next OLS:-)
Let me clarify this: zaurus-style systems can read battery status as
often as someone asks, and do not really have events. If someone asks,
they read the status. If noone asks, they do not have to read status
_at all_. Event interface suits PC world where BIOS already does the
polling...
Anyway, let's compare /dev/XXX vs. /sys/XXX
/sys/XXX:
+ existing code uses similar scheme
+ easy to add very obscure features, such as
do_not_charge_battery_for_X_minutes
+ perhaps it would not need explicit maintainer, just assign names
carefully
- lack of maintainer mean people will probably not assign names
carefully
- does not suit PC-style batteries which trigger events when data
change (can be fixed by /sys/XXX/anything-new, which gives one
byte when something changes)
- you are not getting atomic snapshot of battery state. For example
you could read battery status okay, voltage 9.5V; while real
states were (okay, 10.5V), (critical, 9.5V) and update
happened between you reading status and voltage. (Is it
problem?)
+ userspace UPS daemons can just create files somewhere else, battery
applets can scan two directories easily
/dev/XXX
+ battery layer will need to be invented
- that layer will need maintainer
+ maintainer ensures this is not a mess, allocates numbers
- does not quite suit zaurus-style batteries, that can _only_ be
polled. Can be worked-around by polling from kernel (and we
are often doing that, anyway)
+ userspace backdoor interface will need to be invented, /dev/uinput style
- hard to handle obscure features
(do_not_charge_battery_for_X_minutes), and we'll probably want
to unify batteries a bit, probably loosing precision.
So... I'm not sure which one I prefer. If I had to do one _myself_,
I'd do /sys/XXX version, because it requires less maintainance, and
I'm lazy.
If I could clone vojtech, I'd prefer just doing that, then letting him
do /dev/XXX interface. It will be more work and painful transition.
Anyone volunteers write battery layer? If so, I'd go with /dev/XXX,
otherwise I'd go with /sys/XXX, because it is simpler to code, and I
believe it is also good enough...
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next prev parent reply other threads:[~2006-07-27 22:16 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-27 20:06 Generic battery interface Brown, Len
2006-07-27 20:32 ` Shem Multinymous
2006-07-27 23:24 ` Vojtech Pavlik
2006-07-28 0:27 ` Shem Multinymous
2006-07-28 0:36 ` Matthew Garrett
2006-07-28 7:42 ` Vojtech Pavlik
2006-07-28 12:25 ` Pavel Machek
2006-07-28 13:43 ` Vojtech Pavlik
2006-07-28 15:38 ` Shem Multinymous
2006-07-28 15:57 ` Valdis.Kletnieks
2006-07-28 22:10 ` Shem Multinymous
2006-07-28 23:14 ` Valdis.Kletnieks
2006-07-29 9:48 ` Shem Multinymous
2006-07-29 10:17 ` Vojtech Pavlik
2006-07-29 10:30 ` Shem Multinymous
2006-07-29 10:37 ` Mark Underwood
2006-07-29 11:35 ` Shem Multinymous
2006-07-30 8:35 ` Valdis.Kletnieks
2006-07-30 11:44 ` Vojtech Pavlik
2006-07-30 11:48 ` Shem Multinymous
2006-07-31 0:58 ` Valdis.Kletnieks
2006-07-31 1:34 ` Shem Multinymous
2006-07-30 9:18 ` Pavel Machek
2006-07-30 10:14 ` Shem Multinymous
2006-07-30 11:33 ` Shem Multinymous
2006-07-28 12:25 ` Dmitry Torokhov
2006-07-28 13:44 ` Vojtech Pavlik
2006-07-28 15:19 ` Shem Multinymous
2006-07-28 16:10 ` Dmitry Torokhov
2006-07-30 8:55 ` Greg KH
2006-07-30 9:52 ` Shem Multinymous
2006-07-30 11:47 ` Vojtech Pavlik
2006-07-30 12:50 ` Shem Multinymous
2006-07-30 11:46 ` Vojtech Pavlik
2006-07-28 15:14 ` Shem Multinymous
2006-07-28 20:23 ` Vojtech Pavlik
2006-07-28 22:48 ` Shem Multinymous
2006-07-28 23:17 ` Pavel Machek
2006-07-29 10:36 ` Vojtech Pavlik
2006-07-29 11:32 ` Shem Multinymous
2006-07-29 12:04 ` Vojtech Pavlik
2006-07-29 12:51 ` Shem Multinymous
2006-07-29 13:42 ` Vojtech Pavlik
2006-07-30 9:00 ` Greg KH
2006-07-29 21:06 ` Shem Multinymous
2006-07-30 10:05 ` Pavel Machek
2006-07-30 10:34 ` Shem Multinymous
2006-07-30 10:37 ` Pavel Machek
2006-07-30 18:37 ` Shem Multinymous
2006-07-31 21:35 ` Jean Delvare
2006-07-31 22:34 ` Shem Multinymous
2006-07-31 23:01 ` Pavel Machek
2006-08-02 7:18 ` Jean Delvare
2006-08-02 7:46 ` Marek Wawrzyczny
2006-08-03 11:29 ` Thomas Renninger
2006-08-03 16:33 ` Pavel Machek
[not found] ` <20060731113735.GA22081@creature.apm.etc.tu-bs.de>
[not found] ` <41840b750607310818j7ab2dcddpcb7a14b9a8f10871@mail.gmail.com>
[not found] ` <20060731183719.GB22081@creature.apm.etc.tu-bs.de>
2006-07-31 22:45 ` [ltp] " Shem Multinymous
[not found] ` <20060801114303.GA13000@creature.apm.etc.tu-bs.de>
2006-08-02 21:59 ` Shem Multinymous
2006-07-27 22:16 ` Pavel Machek [this message]
2006-07-27 22:56 ` Shem Multinymous
2006-07-27 23:08 ` Greg KH
2006-07-27 23:24 ` Pavel Machek
2006-07-30 12:29 ` Jean Delvare
2006-08-02 19:51 ` Pavel Machek
2006-08-03 9:20 ` Jean Delvare
2006-07-27 22:56 ` Greg KH
2006-07-27 23:31 ` Vojtech Pavlik
2006-07-28 0:35 ` Shem Multinymous
2006-07-28 10:11 ` Vojtech Pavlik
-- strict thread matches above, loose matches on Subject: below --
2006-07-28 4:05 Brown, Len
2006-07-28 8:22 ` Johan Vromans
2006-07-28 9:58 ` Matthew Garrett
2006-07-28 10:10 ` Vojtech Pavlik
2006-07-28 12:21 ` Pavel Machek
2006-07-28 14:13 ` Shem Multinymous
2006-07-27 23:20 Brown, Len
2006-07-28 0:10 ` Shem Multinymous
2006-07-27 15:40 Brown, Len
2006-07-27 16:23 ` Shem Multinymous
2006-07-27 16:50 ` Daniel Barkalow
2006-07-27 20:07 ` Shem Multinymous
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=20060727221632.GE3797@elf.ucw.cz \
--to=pavel@suse.cz \
--cc=len.brown@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-thinkpad@linux-thinkpad.org \
--cc=mjg59@srcf.ucam.org \
--cc=multinymous@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox