X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=cprogs%2Fxbatmon-simple.c;h=8fe9b0690761ed154c607c6144d00d9340876888;hb=8576c3d1faada875369d43d5c5c183893d2db368;hp=6ca3294248233e652bf30437f9d519c5090a1abe;hpb=a3746ae37f43fdcd70ddc6f66bac37d21f3369a4;p=chiark-utils.git diff --git a/cprogs/xbatmon-simple.c b/cprogs/xbatmon-simple.c index 6ca3294..8fe9b06 100644 --- a/cprogs/xbatmon-simple.c +++ b/cprogs/xbatmon-simple.c @@ -1,16 +1,21 @@ /* + * The display is a lin-log chart of the charge over time. + * Time is on a log scale. + * The top pixel line is 60s from now. + * The bottom of the window is 1h from now. + * * display outputs, per line: * * Remaining: | Empty: | Degraded: * blue | black | dimgrey discharging * green | black | dimgrey charging * cyan | black | dimgrey charged - * grey | black | dimgrey charging&discharching! + * grey | black | dimgrey charging&discharging! * lightgrey | black | dimgrey none of the above * blue | red | dimgrey discharging - low! * green | red | dimgrey charging - low * cyan | red | dimgrey charged - low [1] - * grey | red | dimgrey charging&discharching, low [1] + * grey | red | dimgrey charging&discharging, low [1] * ... darkgreen ... no batteries present * ... yellow ... error * @@ -326,6 +331,16 @@ ALL_VARS(V_NOTFOUND) ALL_DIRECT_VARS(V_PRINT) } + if (this_type == -1) { + /* some kernels don't seem to provide TYPE in the uevent + * guess the type from whether we see "present" or "online" */ + if (this_online >= 0 && this_present == -1) this_type = TYPE_MAINS; + if (this_online == -1 && this_present >= 0) this_type = TYPE_BATTERY; + if (debug) + printf(" type absent from uevent %6s guessed %12s %"PRId64"\n", + "", "", this_type); + } + int needsfields_MAINS = this_type == TYPE_MAINS; int needsfields_BATTERY = this_type == TYPE_BATTERY; int needsfields_BOTH = 1;