chiark / gitweb /
Merge branch 'master' into newacpi
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 3 Jun 2012 14:20:29 +0000 (15:20 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 3 Jun 2012 14:20:29 +0000 (15:20 +0100)
Conflicts:
.gitignore
cprogs/.gitignore
debian/.gitignore
debian/changelog

cprogs/xacpi-simple.c
debian/changelog

index 180df33ff1e31ba847dd52e2a5dfd4f00fb75f51..20655ac94a7bf6714d1df10839dc5bc33cd2ca2c 100644 (file)
@@ -80,19 +80,21 @@ static void badusage(void) { fail("bad usage"); }
 typedef struct batinfo_field {
   const char *file;
   const char *label;
+  const char *acpi_label;
+  double acpi_conversion_factor;
   unsigned long *valuep;
   const char *unit;
   const char *enumarray[10];
 } batinfo_field;
 
-#define QUANTITY_FIELDS                                \
-  QF(info,  design_capacity,    "mWh")         \
-  QF(info,  last_full_capacity, "mWh")         \
-  QF(state, present_rate,       "mW")          \
-  QF(state, remaining_capacity, "mWh")         \
-  QF(alarm, alarm,              "mWh")
+#define QUANTITY_FIELDS                                                        \
+  QF(info,  design_capacity,    "mWh", energy_full_design, 1e-3)       \
+  QF(info,  last_full_capacity, "mWh", energy_full,        1e-3)       \
+  QF(state, present_rate,       "mW",  power_now,          1e-3)       \
+  QF(state, remaining_capacity, "mWh", energy_now,         1e-3)       \
+  QF(alarm, alarm,              "mWh", alarm,              1e-3)
 
-#define QF(f,l,u) static unsigned long thisbat_##f##_##l;
+#define QF(f,l,u,a,ac) static unsigned long thisbat_##f##_##l;
   QUANTITY_FIELDS
 #undef QF
 
@@ -104,9 +106,9 @@ static unsigned long thisbat_state_present, thisbat_state_charging_state;
 static const batinfo_field fields[]= {
 #define E(f,l)       #f, #l, &thisbat_##f##_##l, 0
 #define QF(f,l,u)  { #f, #l, &thisbat_##f##_##l, u },
-  { E(alarm, present),           { "no", "yes" }                          },
-  { E(info, present),            { "no", "yes" }                          },
-  { E(state,present),            { "no", "yes" }                          },
+  { E(alarm, present), 0,0,      { "no", "yes" }                          },
+  { E(info, present),  0,0,      { "no", "yes" }                          },
+  { E(state,present),  0,0,      { "no", "yes" }                          },
   { E(state,charging_state),     { "discharging", "charging", "charged" } },
   QUANTITY_FIELDS           /* take care re charging_state values order -  */
   { 0 }                     /* if you must change it, search for CHGST_... */
@@ -230,8 +232,7 @@ static int readbattery(void) { /* 0=>ok, -1=>couldn't */
   }
 
   if (!(thisbat_alarm_present==0 ||
-       thisbat_info_present==0 ||
-       thisbat_state_present==0)) {
+       thisbat_state_present==0 || thisbat_info_present==0)) {
     if (thisbat_alarm_present == VAL_NOTFOUND)
       thisbat_alarm_present= 1;
     
index 9af967b52a8b37cb0f52e3a78c0bf3153255a636..4ed6596d88cbf682a253c65fcab00a5524ebf129 100644 (file)
@@ -4,7 +4,7 @@ chiark-utils (4.1.31~~iwj) unstable; urgency=low
     chiark-cprogs (for `summer').
   * Fix the build-depends to refer to nettle-dev not libnettle-dev.
   * Add ${misc:Depends} to Depends: lines.  Causes no change to the .debs.
-  * Have .gitignore instead of .cvsignore.
+  * Switch to git.  Move .cvsignores to .gitignore, etc.
   * Update my email address.
 
  -- Ian Jackson <ijackson@chiark.greenend.org.uk>  Sun, 03 Jun 2012 14:56:36 +0100