Exposing the mouse battery status through HAL

Sergey Udaltsov sergey.udaltsov at gmail.com
Thu Dec 2 13:02:20 PST 2004

> Are you sure that this is needed? I think that in most cases only
> knowing battery level in percents is enough, so it could be just
> "rechargeable.level" (double: 0.0 ... 1.0). Most devices will only tell
> you their level this way anyway - how would you know what units to use
> if the device can only tell you its charge level in percents?
Well, I think it is useful. Yeah, in most cases it will be empty - but
if device provides ability to know exact values - why not use it? Then
it is up to the indicator (or even user) to decide how to display the

> Sounds nice. However, there is one issue here: in my experience a Pocket
> PC device would only tell you two things: 1) its battery level and 2)
> whether it is being charging or no. If it is running on battery, it
> would tell you the battery level in percents. If it is being charged, it
> will tell you that it is, but would not always tell you its current
> battery level, however it is guaranteed that the device is fully charged
> if the level is 1.0 (100%) and that it is still being charged otherwise.
> I am almost sure that most of other devices (mice, cellphones, mp3
> players, etc.) would behave the same way. Moreover, I think that you
> would rarely need any information except that. So, how about having only
> the following properties, since you would rarely have a chance to know
> anything more than this:
>   - rechargeable.type (string)
>   - rechargeable.is_charging (bool)
>   - rechargeable.level (double, 0.0 ... 1.0)
Well, I'm just afraid this is oversimplification. Regarding level -
see above. Also, I can easily imagine devices (like UPSes) which can
make predictions on the hardware level - why not use this info? Also,
we really need the information regarging whether the device is really
rechargeable - or disposable. That is why 'battery.is_rechargeable' is
going to be introduced.

> It is near to impossible to estimate this, but some devices would let
> you know this information. This shouldn't be estimated, but can be read
> from device if that is possible.
Absolutely. The daemon will only indicate the value from the hardware.
All the rest can be done in the indication software.

> Again, some devices would let you know this information, but unlike time
> to fully charge the battery, you can easily estimate time to discharge
> if you have some statistics for the battery that you are estimating this
> for.
Again, I would leave it all to the user-level apps. Though, some smart
daemon can save the statistics and really support this property on
software level. Since this property is optional - both cases are

hal mailing list
hal at lists.freedesktop.org

More information about the Hal mailing list