[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdeutils/klaptopdaemon
From:       George Staikos <staikos () kde ! org>
Date:       2002-12-12 15:54:44
[Download RAW message or body]

CVS commit by staikos: 

round percentage to nearest int, not floor()  (now I get 100% battery! yay!)

commit old and partially incomplete patch that I had.  makes have_apm return
true on machines where pmu is present but apm is not, so that any new apm
functionality in klaptopdaemon will get enabled automatically still.  will
only affect systems with pmu present.  the incomplete part is that having
/proc/pmu is not enough.  it should also check to see that a battery is
present perhaps.


  M +8 -3      portable.cpp   1.39


--- kdeutils/klaptopdaemon/portable.cpp  #1.38:1.39
@@ -71,4 +71,5 @@
 #include <sys/stat.h>
 #include <stdlib.h>
+#include <math.h>
 #include <dirent.h>
 #include <qpushbutton.h>
@@ -201,5 +202,5 @@ pmu_read(apm_info *ap)
                 bf.close();
         }
-        ap->battery_percentage = int(100.0*float(float(charge)/float(maxcharge)));
+        ap->battery_percentage = int(rint(100.0*float(float(charge)/float(maxcharge))));
         ap->battery_time = timerem;
 
@@ -477,6 +478,10 @@ has_apm()
         }
 
-        if (val == 0)
+        if (val == 0) {
                 val = have_pmu();
+                if (val && pmu_read(&apmx)) {
+                        val = 0;
+                }
+        }
         return(val);
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic