[patch] apm support

David Zeuthen david at fubar.dk
Wed Feb 2 20:36:50 PST 2005


On Tue, 2005-02-01 at 23:29 +0000, Richard Hughes wrote:
> Just quickly wrote some code before bed:
> 
> http://hughsie.com/write/hal/hal-add-apm.patch
> 
> I know many people won't be using APM, but it's dead simple, and some
> legacy machines might be using it. I took some of the code from:
> 

As Dan points out many laptops are forced to use APM at least on some
distros. Also, I know several people who use APM because suspend doesn't
work using ACPI but it works nicely with APM. So it's pretty important
to support I think.

> http://battstat.sourceforge.net/
> 
> and just used the existing acpi code as a template. I've tested it
> lightly (it worked with acpi=off on my laptop...), and it compiles cleanly.
> 

I just changed pretty heavily how non-sysfs things like ACPI, PMU and
APM are handled, so I added something roughly based on this. I removed
the polling code for now; we should probably listen to /dev/apm_bios
for changes in an addon; dunno yet.

> N.B. no polling support, as it's all in flux. Values are correct only
on
> execution of hald and will not update. 

Btw, I just added the generic Rescan() and Reprobe() discussed earlier
(which, btw forced me to do the heavy change mentioned above) so the addon
should just invoke Rescan() on the appropriate hal device object to
force a re-read of values. For playing around, you may use something
like this python script

 #!/usr/bin/python
 import dbus
 bus = dbus.Bus (dbus.Bus.TYPE_SYSTEM)
 hal_service = bus.get_service ('org.freedesktop.Hal')
 d = hal_service.get_object ('/org/freedesktop/Hal/devices/apm_0', 'org.freedesktop.Hal.Device')
 d.Rescan()
 d = hal_service.get_object ('/org/freedesktop/Hal/devices/apm_1',
'org.freedesktop.Hal.Device')
 d.Rescan()

to force a rescan. You need to be root (or haldaemon user) for this to
work.

Cheers,
David


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



More information about the Hal mailing list