[patch] addon-hid-ups.c : battery.present is mandatory for HAL spec

Richard Hughes hughsient at gmail.com
Tue May 10 11:27:43 PDT 2005


On Mon, 2005-05-09 at 21:35 +0100, Richard Hughes wrote:
> On Mon, 2005-05-09 at 15:55 -0400, David Zeuthen wrote:
> <snip>
> > Anyway, it's good practice to solve the problem in a generic way even
> > though only ACPI is using it.
> 
> Point taken.
> You mean create a function of the form:
> 
> void setTimeRemaining (HalDevice *d)
> {
> 	gboolean isCharging, isDischarging;
> 	int chargeRate, chargeLevel, secondsRemaining, chargeLastFull;
> 
> 	{hal_device_property_get_xxx}
> 	{do logic}
> 	{set "battery.remaining_time"}
> }
> 
> and just call setTimeRemaining with the HalDevice?
> 
> OR for a function to return the remaining time in seconds as an int and
> then to set battery.remaining_time with the return value?

Another question, 

hal_device_property_set_int (d, "foo", 6);
hal_device_property_set_int (d, "foo", 6);
hal_device_property_set_int (d, "foo", 6);
hal_device_property_set_int (d, "foo", 6);
hal_device_property_set_int (d, "foo", 6);

Will I get 5 lots of DBUS traffic, and if not there a big overhead
anyway?

My question is, do I need to check for (oldvalue!=newvalue) before using
hal_device_property_set_int?

Thanks.


_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list