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

Richard Hughes hughsient at gmail.com
Tue May 10 12:56:01 PDT 2005


On Tue, 2005-05-10 at 15:14 -0400, David Zeuthen wrote:
> 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...

Okay, I'll run with you with this.

Why return a double? int is good enough for seconds... Also, whats the
*id for?

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

Working on a patch now.

R.

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



More information about the Hal mailing list