Exposing the mouse battery status through HAL

David Zeuthen david at fubar.dk
Tue Nov 30 18:47:59 PST 2004


On Tue, 2004-11-30 at 23:01 +0000, Sergey Udaltsov wrote:
> > looking for to show up on the list was that the fdi file merge
> > info saying that "run com.logitech.mouse..." daemon, and hald
> > finds the callout and run it, or otherwise asks somebody to tell
> > the user that she needs to install this and that package (or
> > automatically dl/install?) when she plugs in stuff.
> Well, since I am not sure what would be the best way to do it - could
> you please give me a hint how to call something depending on
> properties? All I see now from hald documentation is /etc/hal/device.d
> subdirectory - where I could put the script analizing HAL_* variables
> and starting/stopping my daemon.
> 

The way I would approach this is to not worry about activation/
deactivation to begin with.

So, initially the daemon (would use libhal) should just search for the
appropriate devices (using hal_manager_find_device_string_match for
info.software.addons equals "org.freedesktop.Hal...addons.Logitech") -
see my earlier mail.

You also want to implement the LibHalDeviceAdded and LibHalDeviceRemoved
callback for checking whether you got one more or one less device to
monitor.

The monitoring, I assume is just polling (using the device file from
input.device) and using the hal_device_set_property_<type> functions to
set properties.

When it's working in standalone you may want to look into activation/
deactivation - one way to do this is to create an option --exit-on-no-
devices and make a shell script in /etc/hal/device.d that, given
info.software.addson=="org.freedesktop.Hal...addons.Logitech", that
attempts to start the daemon if it's not already running.

> > About the battery stuff, perhaps Hal spec can recommend what keys
> > should/may daemons set under *.battery.  For example, milliWatt
> > remaining, time remaining, time to charge, charge percent, ...
> > This way for example the battstat applet can simply query Hal
> > tree for *.battery and show a list to the user...
> Actually, current HAL has nothing about batteries. So I just hacked my
> own lwm.fdi with some properties which make sense to me... The "unit"
> properties is void for logitech (well, I am not sure, but for a
> moment...) - but in can be "mWatt" etc.
> 
> > > I think this approach is nice because if other vendors than Logitech
> > > want to ship such a daemon they now what properties to export.
> Yeah, putting these properties into specs could be useful...
> 

We'll need to put the properties into spec so anyone can implement this
functionality for other brands of wireless mice. We also want to design
the properties so they are generic.

Cheers,
David


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



More information about the Hal mailing list