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

Luca Capello luca at pca.it
Wed Mar 9 22:44:27 UTC 2011


tags 617611 + patch
thanks

Hi there!

On Wed, 09 Mar 2011 23:11:45 +0100, Luca Capello wrote:
> 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.
[...]
> I will send the patch as soon as this bug gets a number ;-)

The first attached patch solved it keeping in mind that the above is a
kernel problem (i.e., if a battery is "possible", the sysfs entry must
be there, parameter 'present=0'), while the second attached patch
completely "hide" the problem above.

BTW, I found counter-intuitive the fact that at acpi.c:255 battery_num
is initialized to 1 even if it is not sure there is any battery at all
(the same happens for all *_num variables).  Because of that, type_total
is set accordingly, but still after entering the acpi.c:257 'while
(battery) {' loop.  An IMHO better situation would be to initialize all
*_num variables to 0 and thus remove the '*_num - 1' each time their
values are shown.  I will be happy to provide a tested patch ;-)

Thx, bye,
Gismo / Luca

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-acpi.c-add-workaround-for-battery-status-when-using-_KERNEL.patch
Type: text/x-diff
Size: 2247 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-acpi-devel/attachments/20110309/fb74daf3/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-acpi.c-add-workaround-for-battery-status-when-using-_HIDE.patch
Type: text/x-diff
Size: 7737 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-acpi-devel/attachments/20110309/fb74daf3/attachment-0001.patch>
-------------- 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/fb74daf3/attachment.pgp>


More information about the Pkg-acpi-devel mailing list