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

David Zeuthen david at fubar.dk
Tue May 10 12:14:25 PDT 2005


On Tue, 2005-05-10 at 20:01 +0100, Richard Hughes wrote:
> On Tue, 2005-05-10 at 14:35 -0400, David Zeuthen wrote:
> > Oh, sorry, I missed this one. I would just create a function
> > 
> >  double util_compute_time_remaining (const char *id,
> >                                      double curRate,
> >                                      double curLevel,
> >                                      bool is_charging);
> > 
> > then we can always swap in another function that may do more interesting
> > stuff in the future.
> 
> Can I disagree? We need more variables than that:
> 
> double util_compute_time_remaining (const char *id,
>                                      double curRate,
>                                      double curLevel,
>                                      double curLevelLastFull,
>                                      bool is_discharging,
>                                      bool is_charging);
> 
> Which makes a bit of a wieldy prototype (and means we have to 
> look up all the values even if we don't use them in the calculation.)

Which is not really a big deal. This only gets called on the order of
once every 30th second per battery so...

> I was thinking of something minimal like this:
> 
> static void
> battery_calculate_minutes (HalDevice *d)

I don't really like this; it makes it more difficult to drop in another
implementation without having to know what a HalDevice* is... 

Cheers,
David

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



More information about the Hal mailing list