ACPI/PMU procfs HAL test program. Version 002.

Paul Ionescu i_p_a_u_l at yahoo.com
Tue Jan 25 04:57:57 PST 2005


Hi, 

New patch:


--- procfs.c.1  2005-01-24 09:36:16.000000000 +0200
+++ procfs.c    2005-01-25 14:55:23.061016996 +0200
@@ -310,18 +310,41 @@
        if ( procfs_getbool(path, "present:", "yes", &value) )
                hal_device_property_set_bool(d, "system.battery.present", value);
 
-       /* add string [system.battery.is_rechargable] */
-       if ( procfs_getbool(path, "battery technology:", "rechargeable", &value) )
-               hal_device_property_set_bool(d, "system.battery.is_rechargable", value);
-
-       /* add string [system.battery.serial] */
-       if ( procfs_getvalue(path, "serial number:", buffer) )
-               hal_device_property_set_string(d, "system.battery.serial", buffer);
-
-       /* add string [system.battery.model] */
-       if ( procfs_getvalue(path, "model number:", buffer) )
-               hal_device_property_set_string(d, "system.battery.model", buffer);
+       /* add string [system.battery.type] */
+       hal_device_property_set_string(d, "system.battery.type", "laptop");
 
+       /* only check if there is actually a battery present */
+       if (value == TRUE ) {
+
+               /* add string [system.battery.is_rechargable] */
+               if ( procfs_getbool(path, "battery technology:", "rechargeable", &value) )
+                       hal_device_property_set_bool(d, "system.battery.is_rechargable", value);
+
+               /* add string [system.battery.serial] */
+               if ( procfs_getvalue(path, "serial number:", buffer) )
+                       hal_device_property_set_string(d, "system.battery.serial", buffer);
+
+               /* add string [system.battery.model] */
+               if ( procfs_getvalue(path, "model number:", buffer) )
+                       hal_device_property_set_string(d, "system.battery.model", buffer);
+
+
+               /* add string [system.battery.technology] */
+               if ( procfs_getvalue(path, "battery type:", buffer) )
+                       hal_device_property_set_string(d, "system.battery.technology", buffer);
+
+               /* add string [system.battery.vendor] */
+               if ( procfs_getvalue(path, "OEM info:", buffer) )
+                       hal_device_property_set_string(d, "system.battery.vendor", buffer);
+
+               /* change to /proc/acpi/battery/BAT0/state */
+               path = g_strjoin("/", procfspath, "state", NULL);
+
+               /* add string [system.battery.rechargeable.is_charging] */
+               if ( procfs_getvalue(path, "charging state:", buffer) )
+                       hal_device_property_set_string(d, "system.battery.rechargeable.is_charging", buffer);
+
+       }
        /* Free allocated buffers */
        g_free(buffer);
        g_free(path);


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



More information about the Hal mailing list