[Pm-utils] pm-on-ac

Stefan Seyfried seife at suse.de
Fri Apr 28 09:55:22 PDT 2006


On Fri, Apr 28, 2006 at 06:49:02PM +0200, Stefan Seyfried wrote:

> > #If there are no ac_adapters, check for batteries.
> > devices=`hal-find-by-capability --capability battery`
> > if [ -n "$devices" ]; then
> > 	exit 1
> > fi
> 
> This does not find batteries, but battery slots (at least on my machine,
> hp nx5000):
> seife at strolchi:~> hal-find-by-capability --capability battery
> /org/freedesktop/Hal/devices/acpi_C13C
> /org/freedesktop/Hal/devices/acpi_C13B
> 
> but there is only one battery present now.
> So i don't think this check for "--capability battery" is too useful here.
> I might be overlooking something of course.

I see it now.
If there is only an "ac_adapter", which is "not present", but no battery slot,
my code would still assume "on battery". This is probably a case that can
easily happen on broken desktop BIOSes.

So Peters version (with the s/devices/device/ fix) is best.
-- 
Stefan Seyfried                  \ "I didn't want to write for pay. I
QA / R&D Team Mobile Devices      \ wanted to be paid for what I write."
SUSE LINUX Products GmbH, Nürnberg \                    -- Leonard Cohen


More information about the Pm-utils mailing list