Thu Dec 16 11:34:51 2010 UTC ()
dont divide by 3600, beacuse gnome power applet doesnt expect it like this
ok by jared


(ahoka)
diff -r1.5 -r1.6 pkgsrc/sysutils/hal/files/hald-netbsd/envsys.c

cvs diff -r1.5 -r1.6 pkgsrc/sysutils/hal/files/hald-netbsd/envsys.c (expand / switch to unified diff)

--- pkgsrc/sysutils/hal/files/hald-netbsd/envsys.c 2009/03/01 18:22:31 1.5
+++ pkgsrc/sysutils/hal/files/hald-netbsd/envsys.c 2010/12/16 11:34:51 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: envsys.c,v 1.5 2009/03/01 18:22:31 jmcneill Exp $ */ 1/* $NetBSD: envsys.c,v 1.6 2010/12/16 11:34:51 ahoka Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2008 Jared D. McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -210,30 +210,30 @@ envsys_battery_handler(HalDevice *d, pro @@ -210,30 +210,30 @@ envsys_battery_handler(HalDevice *d, pro
210 /* HAL 0.5.12 spec discourages this, but what can we do about it? */ 210 /* HAL 0.5.12 spec discourages this, but what can we do about it? */
211 hal_device_property_set_string (d, "battery.charge_level.unit", "mAh"); 211 hal_device_property_set_string (d, "battery.charge_level.unit", "mAh");
212 } 212 }
213 213
214 hal_device_property_set_int (d, "battery.charge_level.current", intval); 214 hal_device_property_set_int (d, "battery.charge_level.current", intval);
215 215
216 if (prop_dictionary_get_int64 (prop, "max-value", &maxval) && maxval > 0) 216 if (prop_dictionary_get_int64 (prop, "max-value", &maxval) && maxval > 0)
217 hal_device_property_set_int (d, "battery.charge_level.percentage", intval * 100 / maxval); 217 hal_device_property_set_int (d, "battery.charge_level.percentage", intval * 100 / maxval);
218 else 218 else
219 hal_device_property_set_int (d, "battery.charge_level.percentage", 0); 219 hal_device_property_set_int (d, "battery.charge_level.percentage", 0);
220 } 220 }
221 else if (strcmp (descr, "charge rate") == 0) { 221 else if (strcmp (descr, "charge rate") == 0) {
222 battstate = CHARGING; 222 battstate = CHARGING;
223 hal_device_property_set_int (d, "battery.charge_level.rate", intval / 3600); 223 hal_device_property_set_int (d, "battery.charge_level.rate", intval);
224 } else if (strcmp (descr, "discharge rate") == 0) { 224 } else if (strcmp (descr, "discharge rate") == 0) {
225 battstate = DISCHARGING; 225 battstate = DISCHARGING;
226 hal_device_property_set_int (d, "battery.charge_level.rate", intval / 3600); 226 hal_device_property_set_int (d, "battery.charge_level.rate", intval);
227 } 227 }
228 } 228 }
229 229
230 switch (battstate) { 230 switch (battstate) {
231 case NORMAL: 231 case NORMAL:
232 hal_device_property_set_bool (d, "battery.rechargeable.is_charging", FALSE); 232 hal_device_property_set_bool (d, "battery.rechargeable.is_charging", FALSE);
233 hal_device_property_set_bool (d, "battery.rechargeable.is_discharging", FALSE); 233 hal_device_property_set_bool (d, "battery.rechargeable.is_discharging", FALSE);
234 hal_device_property_set_int (d, "battery.charge_level.rate", 0); 234 hal_device_property_set_int (d, "battery.charge_level.rate", 0);
235 break; 235 break;
236 case CHARGING: 236 case CHARGING:
237 hal_device_property_set_bool (d, "battery.rechargeable.is_charging", TRUE); 237 hal_device_property_set_bool (d, "battery.rechargeable.is_charging", TRUE);
238 hal_device_property_set_bool (d, "battery.rechargeable.is_discharging", FALSE); 238 hal_device_property_set_bool (d, "battery.rechargeable.is_discharging", FALSE);
239 break; 239 break;