Re: Patch to make battstat work with 2.4.20 ACPI kernels
- From: Manuel Clos <llanero eresmas net>
- To: Alvaro <acs barrapunto com>, desktop-devel-list gnome org
- Subject: Re: Patch to make battstat work with 2.4.20 ACPI kernels
- Date: Tue, 22 Apr 2003 00:10:20 +0200
Alvaro wrote:
Hi guys!
Here in Spain manufacturers have started to sell laptops using a
complete SiS motherboard. With it, APM battery info doesn't work so the
only way to know the battery status is using ACPI. We have detected that
current battstat applet doesn't work with our ACPI, 2.4.20 kernels, so I
started to investigate why.
/me got one of this :(
After playing a little with the applet, here goes the patch that makes
battstat works with ACPI in 2.4.20 kernels.
I tried the patch and the applet still crashes. After downloading
gnome-applets-2.2.0, applying your patch and debugging the applet I
found the problem:
In acpi-linux.c: in acpi_linux_read ()
about line 189, the code reads:
procdir=opendir("/proc/acpi/battery/");
while ((procdirentry=readdir(procdir)))
The problem is that opendir will return NULL if the directory does not
exists (this happens when you don't have the battery.o module loaded).
So the code does no check for NULL and passes it to readdir which segfaults.
about the line 228, the same problem happens with the "ac_adapter" dir,
which is not present until you load the ac.o module.
other than that, after loading the needed modules, it works great.
It will be easy to just check for "procdir == NULL", but IMHO, the
applet should also tell the user that he lacks "battery/ac" information
support.
Alvaro, can you also take care of this issue?
Have you oppened a bug to track this?
Thanks!
--
Manuel Clos
llanero eresmas net
TCPA y Palladium: http://bulmalug.net/body.phtml?nIdNoticia=1398
TCPA and Palladium: http://www.cl.cam.ac.uk/~rja14/tcpa-faq.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]