Adding PMU and ACPI into HAL
David Zeuthen
david at fubar.dk
Mon Jan 10 08:41:41 PST 2005
On Sat, 2005-01-08 at 16:28 +0000, Richard Hughes wrote:
> Right, now there is some sort of agreement on the schema, now we have to
> think about how we integrate parts of pmu and acpi into HAL.
>
Right.
> HAL looks pretty sysfs-centric and I don't want to "bodge" a totally
> different subsystem. I am asking all you experts for the proper way to do
> this.
>
> Assuming the addons feature works the way I imagine, I guessed the best
> way to do ACPI/PMU would be:
>
> 1. HAL detects ACPI/PMU and registers a new bus (like it would for PCI)
Not necessarily using the info.bus property - yes, hal-device-manager
right
now complains if it's not set but we might fix that later. The reason I
don't
want the info.bus = acpi is that ACPI isn't really a bus.
Anyway, I think we agree. Could it simply look like this:
info.bus = 'unknown' # for good measure until h-d-m is fixed
info.udi = '/org/freedesktop/Hal/devices/acpi_proc_acpi_button_lid'
info.capabilities = 'acpi_button system system.button'
acpi_button.linux.path = '/proc/acpi/button/lid'
system.button.type = lid
system.button.has_state = TRUE
system.button.state.value = FALSE
> 2. A device file (e.g. battery_device.c) is used to populate the HAL tree
> with a battery object.
You want to have the Linux ACPI bits in hald/linux/acpi.c and make
osspec.c
call some functions to read off the data.
> 3. An addon is launched for the duration of the battery to update the
> battery charge level. (when the addon code hits CVS...)
>
Right - we'll have a device information match the acpi_battery and merge
the properties with the paths for the addon..
In general the do's and dont's for hald is this: You should only read
files
in /sys and /proc from the hald process and never open a device file.
Things
that require the device file for hardware detection needs to be
contained
in a single binary that hald launches (not necessarily an addon). I've
got
this for input devices in my local tree that I will commit soon (sorry,
I
keep saying this..)
> OR
>
> 1. HAL detects ACPI (presence of /proc/acpi) or PMU (presence of /dev/pmu)
> 2. Launches an addon, lets say acpi_helper
> 3. The addon uses /proc/acpi/ac_adaptor+button+battery information to
> populate the HAL tree with extra nodes such as ac_adaptor. (is this
> possible?)
> 4. The addon continues to monitor /proc/acpi/ for any changes in battery
> level, button status etc.
>
> If you have better ideas, or ideas that fit more into the HAL model then
> please post them here.
>
I think the former idea is the way to go.
Thanks,
David
_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal
More information about the Hal
mailing list