ACPI/PMU procfs HAL test program. Version 002.
Richard Hughes
ee21rh at surrey.ac.uk
Sun Jan 23 12:23:15 PST 2005
Okay, version 002 of the hal acpi/pmu test program is now here:
http://hughsie.no-ip.com/write/hal/procfs-hal-002/
It bears little resemblance to my initial version:
* it's lots simpler! No really, lots.
* used -pedantic to please older GCC's
* seporated acpi and generic stuff so PMU is happy.
* renamed most of the functions to be more descriptive
* added typical usage to each function to help people debug
* changed to "procfs_generic_device" style to minimise duplication
* added "procfs_refresh_acpi_ac_adapter" and friends -
this lets us refresh the acpi entries really easy from /proc/*
pmu isn't so simple, for some things it's okay, but others will
need an addon to read /dev/pmu.
Currently to search all the entries:
time ./procfs-hal > /dev/null
real 0m0.004s
user 0m0.000s
sys 0m0.004s
If you run it, it will use /proc/acpi/* (or /proc/pmu) to display
(on console) something like the following:
[7]set_string linux.powersystem, acpi
[7]set_string linux.acpi.version, 20041210
* new_device *
[11]capability system.ac_adapter
[11]set_int system.ac_adapter.number, 0
[11]set_string info.bus, unknown
[11]set_string info.udi, /org/freedesktop/Hal/devices/ac_adapter_0
[11]capability linux.acpi
[11]set_string linux.acpi.procfs_path, /proc/acpi/ac_adapter/ADP1
[11]set_string info.product, AC Adaptor
[11]set_bool system.acadaptor.present, TRUE
* callout_device *
* new_device *
[12]capability system.fan
[12]set_int system.fan.number, 0
[12]set_string info.bus, unknown
[12]set_string info.udi, /org/freedesktop/Hal/devices/fan_0
[12]capability linux.acpi
[12]set_string linux.acpi.procfs_path, /proc/acpi/fan/FAN
[12]set_string info.product, Fan
[12]set_bool system.fan.enabled, FALSE
* callout_device *
* new_device *
[13]capability system.processor
[13]set_int system.processor.number, 0
[13]set_string info.bus, unknown
[13]set_string info.udi, /org/freedesktop/Hal/devices/processor_0
[13]capability linux.acpi
[13]set_string linux.acpi.procfs_path, /proc/acpi/processor/CPU0
[13]set_string info.product, Processor
[13]set_bool system.processor.can_throttle, FALSE
* callout_device *
[7]set_string linux.acpi.toshiba.version, 0.18
Could you please comment on the code, compile it, run it, before I send any
patches for HEAD. It's a lot simpler to change and debug a 10k .c file than
the whole of haldaemon.
Comments about 001 from Sjoerd:
> * You shouldn't need to define maximum lenght stuff when glib
Couldn't find a way round this. Still, string checking is at least safe
from overflow.
> * getprocfsvalue opens and searches the given file each time to get one
> value, better to parse it into a hash once and pull value's from that..
Didn't do this as for the sheer amount of complexity it adds. procfs
stays in memory, so all accesses are really quick.
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