Test routine for ACPI and PMU procfs

Richard Hughes ee21rh at surrey.ac.uk
Wed Jan 19 23:34:48 PST 2005


On Wed, 19 Jan 2005 23:57:43 +0100, Sjoerd Simons wrote:
> Okay, nitpicking mode turned on :)

Good, thanks for your help :-)

> * In several places you define new variables after doing some other code, this
>   will break on older gcc's and probably other compilers

Okay, can fix.
 
> * You shouldn't need to define maximum lenght stuff when glib (I just don't
>   like hardcoded maximums, just ignore if you don't agree)

I know, but fgets doesn't have a glib equivalent as far as I can tell:
http://mail.gnome.org/archives/gtk-devel-list/2000-May/msg00024.html
If you find a better way, then please tell.
 
> * 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 for example..

Yes, I ummed and arred about this one. I figured Linux would cache the
file, and thus be really, really quick on subsequent lookups.

I toyed with the idea of passing getprocfsvalues() a linked list of stuff
to find in each file, and another linked list for its results - but then
you've got to iterate through each value and set each one with
hal_set_bool or hal_set_string. Can you think of a better way?

> * info.udi should be an unique value

Oops. I knew that, just never saw it. Thanks.

> * Your scan functions appear to be, if name == value then do
> function(path) a
>   lot.. Can be made more generic :)

Okay, I'll work on it more today.
 
> </nitpick>
> 
> Also i think it would be nice to have some functions to create certain
> standard objects.. Like hal_device_battery_new(..some mandatory property
> values..), so i don't have to recreate that code when making a pmu
> defined battery object.. And ofcourse it keeps things more consistent :)

Ya, I played with the idea of 

hal_add_battery
hal_add_battery_acpi_populate

Again, thanks for checking stuff. I'll work on your suggestions and post a
new version soon.

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