added dbus support
[monky] / src / core.c
index e93ef58..2ca922d 100644 (file)
@@ -80,6 +80,7 @@
 #include <string.h>
 #include <ctype.h>
 
+
 /* strip a leading /dev/ if any, following symlinks first
  *
  * BEWARE: this function returns a pointer to static content
@@ -160,12 +161,12 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                if(arg) {
 #ifdef __linux__
                        if(strpbrk(arg, "/.") != NULL) {
-                               /* 
+                               /*
                                 * a bit of paranoia. screen out funky paths
                                 * i hope no device will have a '.' in its name
                                 */
                                NORM_ERR("acpiacadapter: arg must not contain '/' or '.'");
-                       } else 
+                       } else
                                obj->data.opaque = strdup(arg);
 #else
                        NORM_ERR("acpiacadapter: arg is only used on linux");
@@ -245,7 +246,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                if (arg) {
                        sscanf(arg, "%63s", bat);
                } else {
-                       strcpy(bat, "BAT0");
+                       strcpy(bat, "bq27200-0");
                }
                obj->data.s = strndup(bat, text_buffer_size);
        END OBJ(battery_short, 0)
@@ -254,7 +255,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                if (arg) {
                        sscanf(arg, "%63s", bat);
                } else {
-                       strcpy(bat, "BAT0");
+                       strcpy(bat, "bq27200-0");
                }
                obj->data.s = strndup(bat, text_buffer_size);
        END OBJ(battery_time, 0)
@@ -263,7 +264,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                if (arg) {
                        sscanf(arg, "%63s", bat);
                } else {
-                       strcpy(bat, "BAT0");
+                       strcpy(bat, "bq27200-0");
                }
                obj->data.s = strndup(bat, text_buffer_size);
        END OBJ(battery_percent, 0)
@@ -272,7 +273,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                if (arg) {
                        sscanf(arg, "%63s", bat);
                } else {
-                       strcpy(bat, "BAT0");
+                       strcpy(bat, "bq27200-0");
                }
                obj->data.s = strndup(bat, text_buffer_size);
        END OBJ(battery_bar, 0)
@@ -282,9 +283,27 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                if (arg && strlen(arg)>0) {
                        sscanf(arg, "%63s", bat);
                } else {
-                       strcpy(bat, "BAT0");
+                       strcpy(bat, "bq27200-0");
                }
                obj->data.s = strndup(bat, text_buffer_size);
+       END OBJ(battery_volts, 0)
+               char bat[64];
+               if (arg) {
+                       sscanf(arg, "%63s", bat);
+               } else {
+                       strcpy(bat, "bq27200-0");
+               }
+               obj->data.s = strndup(bat, text_buffer_size);
+       END OBJ(battery_temp, 0)
+               char bat[64];
+               if (arg) {
+                       sscanf(arg, "%63s", bat);
+               } else {
+                       strcpy(bat, "bq27200-0");
+               }
+               obj->data.s = strndup(bat, text_buffer_size);
+       END OBJ(cell_radio_dbm, 0)
+       END OBJ(cell_radio_percent, 0)
 #endif /* !__OpenBSD__ */
 
 #if defined(__linux__)
@@ -1652,6 +1671,12 @@ void free_text_objects(struct text_object *root, int internal)
                        case OBJ_battery_time:
                                free(data.s);
                                break;
+                       case OBJ_battery_volts:
+                               free(data.s);
+                               break;
+                       case OBJ_battery_temp:
+                               free(data.s);
+                               break;
 #endif /* !__OpenBSD__ */
                        case OBJ_execpi:
                        case OBJ_execi: