ref: 1f3600c83fd0bd02a5db23f9be508baed743862d
parent: 234137bce39a03eab02044234c8f970498ccc5b0
author: ftrvxmtrx <ftrvxmtrx@gmail.com>
date: Mon Oct 24 19:50:04 EDT 2016
aux/acpi: make it stats(8)-friendly
--- a/sys/src/cmd/aux/acpi.c
+++ b/sys/src/cmd/aux/acpi.c
@@ -21,7 +21,6 @@
struct Battery {
char *unit;
void *bst;
- int id;
int fullcharge;
int capacity;
int capacitywarn;
@@ -117,7 +116,6 @@
b->voltage = amlint(rr[4]);
b->capacitywarn = amlint(rr[5]);
b->capacitylow = amlint(rr[6]);
- b->id = amlint(amlwalk(dot, "^_UID"));
b->bst = amlwalk(dot, "^_BST");
if(b->bst != nil){
amltake(b->bst);
@@ -213,8 +211,8 @@
s -= 60*(s/60);
}
x = bats[n].fullcharge > 0 ? st.capacity * 100 / bats[n].fullcharge : -1;
- p += snprint(p, ep-p, "%d %d %s %d %d %d %d %d %s %d %d %02d:%02d:%02d %s\n",
- n, x,
+ p += snprint(p, ep-p, "%d %s %d %d %d %d %d %s %d %d %02d:%02d:%02d %s\n",
+ x,
bats[n].unit, st.capacity, b->fullcharge, b->capacity, b->capacitywarn, b->capacitylow,
"mV", st.voltage, b->voltage,
h, m, s,
@@ -231,7 +229,7 @@
{
char buf[32], *ep, *p;
void *er;
- int n, t, cpu;
+ int n, t;
p = buf;
ep = buf + sizeof(buf);
@@ -240,10 +238,7 @@
t = 0;
if(amleval(therms[n].tmp, "", &er) >= 0)
t = amlint(er);
- for(cpu = 0; cpu < 32; cpu++){
- if(therms[n].cpus & (1<<cpu))
- p += snprint(p, ep-p, "%d %d\n", cpu, (t - 2732)/10);
- }
+ p += snprint(p, ep-p, "%d\n", (t - 2732)/10);
}
readstr(r, buf);