Please merge procfs... :-)

Richard Hughes ee21rh at surrey.ac.uk
Sat Jan 29 11:29:24 PST 2005


On Sat, 29 Jan 2005 14:01:09 -0500, David Zeuthen wrote:
> Oh, great, it's exclusive. I didn't know that, sorry.

I know. Bugger.

> So, it sounds like we want to do try reading /proc/acpi/event first and
> then fall back to /var/run/acpid.socket if that's not possible. This
> should probably happen outside hald (as an addon) as opening the former
> requires root privileges. Is the format the same?

Unknown : I can't even do a read on this file: 

[root at hughsie ~]# cat /var/run/acpid.socket
cat: /var/run/acpid.socket: No such device or address

I figured we could have an addon that reads /proc/acpi/events and another
that reads /proc/pmu, and updates the object whenever it gets such an
event. My "cat /proc/acpi/event" looks like this:

battery BAT1 00000080 00000001 (once a minute sort of rate...)
battery BAT1 00000080 00000001
battery BAT1 00000080 00000001
battery BAT1 00000080 00000001
ac_adapter ADP1 00000080 00000000 (disconnected ac adaptor)
processor CPU0 00000080 00000000
battery BAT1 00000080 00000001
ac_adapter ADP1 00000080 00000001 (reconnected ac adaptor)
processor CPU0 00000080 00000000
battery BAT1 00000080 00000001 (again, once a minute sort of rate...)
battery BAT1 00000080 00000001
battery BAT1 00000080 00000001
battery BAT1 00000080 00000001
battery BAT1 00000080 00000001
battery BAT1 00000080 00000001

So, in theory, how would I go about getting a HalDevice pointer from, say:

"ac_adapter ADP1"

- presumably you could match the UDI against ac_adaptor,
and then check for the ADP1 in the procfs_path, (or maybe store ADP1 in
linux.acpi.node_name) and then call:

procfs_refresh_acpi("/proc/acpi/ac_adapter/ADP1", "ac_adapter", d);

Which would refresh the ac_adaptor object.

Also, how would I launch an addon? Has the code in CVS got such a facility
yet?

Thanks, Richard.

-- 

http://www.hughsie.com/PUBLIC-KEY


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



More information about the Hal mailing list