If we the battery 'remaining' propery is empty, try to calculate it

from discharge rate.

make the battery applet work with netbsd (again?)
This commit is contained in:
ahoka 2010-12-16 11:37:38 +00:00
parent f168be3947
commit 65e1de2d0b
3 changed files with 30 additions and 2 deletions

View file

@ -1,7 +1,8 @@
# $NetBSD: Makefile,v 1.87 2010/12/01 09:38:21 cegger Exp $
# $NetBSD: Makefile,v 1.88 2010/12/16 11:37:38 ahoka Exp $
#
DISTNAME= gnome-applets-2.32.1.1
PKGREVISION= 1
CATEGORIES= x11 gnome
MASTER_SITES= ${MASTER_SITE_GNOME:=sources/gnome-applets/2.32/}
EXTRACT_SUFX= .tar.bz2

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.27 2010/11/26 11:34:41 drochner Exp $
$NetBSD: distinfo,v 1.28 2010/12/16 11:37:38 ahoka Exp $
SHA1 (gnome-applets-2.32.1.1.tar.bz2) = 6edc3aea2bd2198b2bdbdb1fa63b481f724c8fe2
RMD160 (gnome-applets-2.32.1.1.tar.bz2) = 50c8e169b02aa002917f4c6ea0f575522e3ae984
@ -6,3 +6,4 @@ Size (gnome-applets-2.32.1.1.tar.bz2) = 10083534 bytes
SHA1 (patch-aa) = 764fc46c7c000e21a1602286443e2633ec743631
SHA1 (patch-ab) = f880abec6df2254b6541d4e5a894559763ef674b
SHA1 (patch-ad) = 42fb64b30a031a1ea8f57f47cabdf63475b7987e
SHA1 (patch-hal) = 8de5986b77a8ae7f99533eaff7f6a5a5c3069f3d

View file

@ -0,0 +1,26 @@
$NetBSD: patch-hal,v 1.1 2010/12/16 11:37:39 ahoka Exp $
--- battstat/battstat-hal.c.orig 2010-11-22 14:38:27.000000000 +0000
+++ battstat/battstat-hal.c
@@ -549,7 +549,7 @@ battstat_hal_get_battery_info( BatterySt
status->percent = ( ((double) current_charge_total) /
((double) full_capacity_total) ) * 100.0 + 0.5;
- if( present == 1 )
+ if( present == 1 && remaining_time != 0 )
{
/* In the case of exactly one battery, report the time remaining figure
* from HAL directly since it might have come from an authorative source
@@ -559,10 +559,11 @@ battstat_hal_get_battery_info( BatterySt
* remaining time is unknown. Battstat uses minutes and -1 for
* unknown time remaining.
*/
-
+#if 0
if( remaining_time == 0 )
status->minutes = -1;
else
+#endif
status->minutes = (remaining_time + 30) / 60;
}
/* Rest of cases to deal with multiple battery systems... */