[Pkg-acpi-devel] Bug#617611: acpi: empty slot battery not shown with -s

Luca Capello luca at pca.it
Wed Mar 9 22:11:45 UTC 2011


Package: acpi
Version: 1.5-2
Severity: normal
Tags: upstream patch

Hi there!

I was surprised that when there is no battery present:

1) $(acpi -b) exits with 0, while IMHO it should report an error

2) $(acpi -b -s) does not show anything at all, which is plainly wrong

The problem is that differently from /sys/class/power_supply/AC,
/sys/class/power_supply/BAT0 exists only if a battery is present, which
means that the acpi.c:321 'if (type_battery) {' is not evaluated when
the battery is not present, thus the next acpi.c:322 'if (!state) {' is
never reached.

AFAIK on anything not a laptop the power_supply device type is not
supported (which is wrong, a 'power supply' is needed in *any* machine),
which means that on a laptop there will be /at least/ one device of type
power_supply.  We can thus workaround the problem above:
=====
[battery removed]
luca at gismo:~/src/acpiclient(git)[master]$ acpi -b -i -s

[battery inserted]
luca at gismo:~/src/acpiclient(git)[master]$ acpi -b -i -s
Battery 0: Full, 100%
Battery 0: design capacity 4500 mAh, last full capacity 3313 mAh = 73%

luca at gismo:~/src/acpiclient(git)[master]$ ./acpi -b -i -s
Battery 0: Full, 100%
Battery 0: design capacity 4500 mAh, last full capacity 3313 mAh = 73%

[battery removed]
luca at gismo:~/src/acpiclient(git)[master]$ ./acpi -b -i -s
Battery 0: slot empty

luca at gismo:~/src/acpiclient(git)[master]$ 
=====

I will send the patch as soon as this bug gets a number ;-)

Thx, bye,
Gismo / Luca

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.37-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages acpi depends on:
ii  libc6                         2.11.2-13  Embedded GNU C Library: Shared lib

acpi recommends no packages.

acpi suggests no packages.

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-acpi-devel/attachments/20110309/c5dafae6/attachment.pgp>


More information about the Pkg-acpi-devel mailing list