If we the battery 'remaining' propery is empty, try to calculate it from discharge rate. make the battery applet work with netbsd (again?)diff -r1.87 -r1.88 pkgsrc/x11/gnome-applets/Makefile
(ahoka)
@@ -1,17 +1,18 @@ | @@ -1,17 +1,18 @@ | |||
1 | # $NetBSD: Makefile,v 1.87 2010/12/01 09:38:21 cegger Exp $ | 1 | # $NetBSD: Makefile,v 1.88 2010/12/16 11:37:38 ahoka Exp $ | |
2 | # | 2 | # | |
3 | 3 | |||
4 | DISTNAME= gnome-applets-2.32.1.1 | 4 | DISTNAME= gnome-applets-2.32.1.1 | |
5 | PKGREVISION= 1 | |||
5 | CATEGORIES= x11 gnome | 6 | CATEGORIES= x11 gnome | |
6 | MASTER_SITES= ${MASTER_SITE_GNOME:=sources/gnome-applets/2.32/} | 7 | MASTER_SITES= ${MASTER_SITE_GNOME:=sources/gnome-applets/2.32/} | |
7 | EXTRACT_SUFX= .tar.bz2 | 8 | EXTRACT_SUFX= .tar.bz2 | |
8 | 9 | |||
9 | MAINTAINER= pkgsrc-users@NetBSD.org | 10 | MAINTAINER= pkgsrc-users@NetBSD.org | |
10 | HOMEPAGE= http://www.gnome.org/ | 11 | HOMEPAGE= http://www.gnome.org/ | |
11 | COMMENT= GNOME2 panel applets | 12 | COMMENT= GNOME2 panel applets | |
12 | 13 | |||
13 | PKG_DESTDIR_SUPPORT= user-destdir | 14 | PKG_DESTDIR_SUPPORT= user-destdir | |
14 | 15 | |||
15 | GNU_CONFIGURE= yes | 16 | GNU_CONFIGURE= yes | |
16 | USE_TOOLS+= gmake intltool msgfmt pkg-config | 17 | USE_TOOLS+= gmake intltool msgfmt pkg-config | |
17 | USE_PKGLOCALEDIR= yes | 18 | USE_PKGLOCALEDIR= yes |
@@ -1,8 +1,9 @@ | @@ -1,8 +1,9 @@ | |||
1 | $NetBSD: distinfo,v 1.27 2010/11/26 11:34:41 drochner Exp $ | 1 | $NetBSD: distinfo,v 1.28 2010/12/16 11:37:38 ahoka Exp $ | |
2 | 2 | |||
3 | SHA1 (gnome-applets-2.32.1.1.tar.bz2) = 6edc3aea2bd2198b2bdbdb1fa63b481f724c8fe2 | 3 | SHA1 (gnome-applets-2.32.1.1.tar.bz2) = 6edc3aea2bd2198b2bdbdb1fa63b481f724c8fe2 | |
4 | RMD160 (gnome-applets-2.32.1.1.tar.bz2) = 50c8e169b02aa002917f4c6ea0f575522e3ae984 | 4 | RMD160 (gnome-applets-2.32.1.1.tar.bz2) = 50c8e169b02aa002917f4c6ea0f575522e3ae984 | |
5 | Size (gnome-applets-2.32.1.1.tar.bz2) = 10083534 bytes | 5 | Size (gnome-applets-2.32.1.1.tar.bz2) = 10083534 bytes | |
6 | SHA1 (patch-aa) = 764fc46c7c000e21a1602286443e2633ec743631 | 6 | SHA1 (patch-aa) = 764fc46c7c000e21a1602286443e2633ec743631 | |
7 | SHA1 (patch-ab) = f880abec6df2254b6541d4e5a894559763ef674b | 7 | SHA1 (patch-ab) = f880abec6df2254b6541d4e5a894559763ef674b | |
8 | SHA1 (patch-ad) = 42fb64b30a031a1ea8f57f47cabdf63475b7987e | 8 | SHA1 (patch-ad) = 42fb64b30a031a1ea8f57f47cabdf63475b7987e | |
9 | SHA1 (patch-hal) = 8de5986b77a8ae7f99533eaff7f6a5a5c3069f3d |
$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... */