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

Michael Meskes meskes at debian.org
Sun Mar 27 12:51:40 UTC 2011

> 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.

I don't think this is the right way to "solve" the problem because now you got
it right on a laptop but wrong on all other systems. For instance with your
patch my virtualbox system tells me that the battery slot is empty although it
does not have one.

> 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 ;-)

Sure, do that. I absolutely agree with your reasoning. This code went through
several hands. My guess would be that this initilization originally made sense,
but a lot of changes weremade since.


Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at googlemail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL

More information about the Pkg-acpi-devel mailing list