[xiph-cvs] cvs commit: mgm/modules/linux battery
Monty
xiphmont at xiph.org
Thu Feb 21 17:50:16 PST 2002
xiphmont 02/02/21 17:50:16
Modified: modules/linux battery
Log:
Found/fixed a bug in battery module involving PowerMac and most recent
2.4 kernels; reinstancing closed the /proc/pmu/info filehandle, but
did not mark it as closed. reinstance would then crash.
Revision Changes Path
1.10 +8 -1 mgm/modules/linux/battery
Index: battery
===================================================================
RCS file: /usr/local/cvsroot/mgm/modules/linux/battery,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- battery 2002/02/20 23:07:02 1.9
+++ battery 2002/02/22 01:50:15 1.10
@@ -11,7 +11,7 @@
use IO::Seekable;
use Socket;
use vars qw(@percent @battstatus @gstate $ac $lstate $graph $widget
- $xpath $openp $openf $batteries $ac $active $lastbat);
+ $xpath $openp $openf $opena $batteries $ac $active $lastbat);
sub module_init{
my$this=shift;
@@ -19,6 +19,9 @@
my$toplevel=$this->{"toplevel"};
$active=0;
+ $openp=0;
+ $openf=0;
+ $opena=0;
$this->read_proc;
if($active==0){
$toplevel->optionAdd("$xclass.active", 'false',21);
@@ -109,7 +112,9 @@
my$test;
my$this=shift;
+ if($opena){return $this->read_proc_apm;}
if($openp || $openf){return $this->read_proc_mac;}
+
$test=$this->read_proc_apm;
if(defined($test)){return $test;}
$this->read_proc_mac;
@@ -290,6 +295,7 @@
$batteries=0;
if(open(PROC,"/proc/apm")){
$active=1;
+ $opena=1;
sysread PROC,$_,1024;
if(m/^\S+\s+\S+\s+\S+\s+(\S+)\s+(\S+)\s+\S+\s+([^ \%]+)\%/){
if($1 eq '0xff'){
@@ -420,6 +426,7 @@
close B_FD if($openp);
close PROC if($openf);
$openp=0;
+ $openf=0;
undef $xpath;
}
<p><p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list