[Sugar-devel] [PATCH sugar v3] battery frame device: replace HAL with UPower

Simon Schampijer simon at schampijer.de
Mon Feb 21 09:30:37 EST 2011


On 02/18/2011 06:23 PM, Sascha Silbe wrote:
> Excerpts from Sascha Silbe's message of Fri Feb 18 23:38:13 +0100 2011:
>
>> HAL is deprecated, UPower is the designated replacement w.r.t. power
>> supplies. As a bonus the time displayed is now correct (calculated at
>> run-time by UPower, self-adjusting to changes in power consumption).
>
> Ack'ed by Simon on #sugar with a minor change (battery_path ->
> device_path) and pushed as 3f8a1e1 [1].

Nearly :) Ideally it would be imho:

device = bus.get_object('org.freedesktop.UPower', device_path)
device_prop_iface = dbus.Interface(device, dbus.PROPERTIES_IFACE)
device_type = device_prop_iface.Get(_UP_DEVICE_IFACE, 'Type')
if device_type == _UP_TYPE_BATTERY:
     tray.add_device(DeviceView(device))

Regards,
    Simon


More information about the Sugar-devel mailing list