Tiny Core Linux
Tiny Core Base => CorePlus => Topic started by: 0day on April 18, 2017, 11:04:37 AM
-
A battery indicator for tiny core?
-
A battery indicator for tiny core?
Check your desktop plugins. In general there are no such thing that Tiny Core icon :(
-
there's the watcher extension
-
Or Conky.
-
i installed watcher but no battery monitor. just %C, %M and %S
-
It looks like there's a patch pending:
http://forum.tinycorelinux.net/index.php/topic,21360.msg133540.html#msg133540
..but the %m, and presumeably %s, part works for me.
-
I use flit. I serves my needs, and takes little desktop space. 32-bit only, though.
-
flit added to CorePure64 repo
Edit: and recompiled for fltk-1.1.0 -> fltk-1.3 in Core repo
-
Hi h2sammo
i installed watcher but no battery monitor. just %C, %M and %S
It looks like there's a patch pending:
http://forum.tinycorelinux.net/index.php/topic,21360.msg133540.html#msg133540
..but the %m, and presumeably %s, part works for me.
I did some checking and it seems my patch was applied to the source code but the repo was never updated. I confirmed
this by examining the executable that's currently in the repo. I did some minor cleanup and recompiled the program. A new
package has been submitted and will be available as soon as the repo is updated.
-
flit added to CorePure64 repo
Edit: and recompiled for fltk-1.1.0 -> fltk-1.3 in Core repo
Thank you Juanito. Looks like I'll be going 64-bit.
-
updated watcher posted - thanks
On my machine (dell e7240) running tc-10.x, I get this: $ ls /sys/class/power_supply/BAT0
alarm current_now present uevent
capacity cycle_count serial_number voltage_min_design
capacity_level device status voltage_now
charge_full manufacturer subsystem
charge_full_design model_name technology
charge_now power/ type
..and: $ ls /sys/class/power_supply/AC
device online power/ subsystem type uevent
It looks like watcher is calculating C% from either charge_now or energy_now divided by either charge_full or energy_full.
I get 1742000/2457000=71%, but the watcher display varies slowly between 6.7% and 7.2% - i.e. a factor of 10 out?
-
Hi Juanito
The calculation code looks correct:
sprintf(batmsg, " %.1f%%B", (float)(batnow / batfull) * 100);
BAT0 looks like the correct value to pass to watcher.
-
Hi Juanito
... It looks like watcher is calculating C% from either charge_now or energy_now divided by either charge_full or energy_full. ...
You mean %B. %C is the CPU. Did you start watcher like this:
watcher -bat BAT0to tell it where to find the battery?
-
doh :-[
It works now (and matches flit) - thanks
..but constantly repeats this to stdout: $ ./watcher -bat BAT0
Error opening batinfo /sys/class/power_supply/BAT0/energy_now
Error opening batinfo /sys/class/power_supply/BAT0/energy_full
-
Hi Juanito
Maybe I should remove that error message? It seemed like a good idea at the time but it really isn't an error unless the
fallback values (charge_now and charge_full) can't be read. It's late here but if you'd like I'll clean up the error handling
and submit an update tomorrow.
-
No rush :)
That's fine by me, @curaga?
In the meantime, updated watcher posted to the CorePure64-10.x repo
-
Yeah I'll take that patch.
-
Hi Juanito & curaga
Premature error messages have been removed and an updated package has been sent to tcesubmit. A patch called
watcher2.patch (the old watcher.patch from Sept 1, 2017 was never deleted) has been uploaded to:
http://patches.tinycorelinux.net/
This is what it looks like:
--- watcher.cxx.old 2019-01-30 08:55:54.945634735 +0000
+++ watcher.cxx 2019-01-30 08:57:32.015633230 +0000
@@ -7,6 +7,16 @@
// wmbluemem :)
// Thank You Mihai Drãghicioiu
+// Jan 30, 2019 v1.10.1 by Rich
+// Removed 2 error messages from batcheckup() because they were not errors yet.
+
+// Jan 29, 2019 v1.10 by Rich
+// Compiled in the energy patch that was added on Sep 1, 2017
+// Added parameter assignment to parser() to shut up compiler unused parameter warning.
+
+// Nov 22, 2014 v1.9
+// Rebuilt with FLTK 1.3
+
// v1.8: update battery support for linux 3.0
// Changes from Softwaregurl:
@@ -21,7 +31,7 @@
#include <string.h>
#include <stdlib.h>
-static const char version[] = "1.9";
+static const char version[] = "1.10.1";
static float timeout = 1.5, mem = 0, swap = 0, cpu = 0, used = 0, oldused = 0,
cputotal = 0, oldcputotal = 0;
@@ -37,7 +47,6 @@
sprintf(longpath, "/sys/class/power_supply/%s/energy_now", batname);
if ((batinfo = fopen(longpath, "r")) == NULL)
{
- fprintf(stderr, "Error opening batinfo %s\n", longpath);
sprintf(longpath, "/sys/class/power_supply/%s/charge_now", batname);
if ((batinfo = fopen(longpath, "r")) == NULL)
{
@@ -51,7 +60,6 @@
sprintf(longpath, "/sys/class/power_supply/%s/energy_full", batname);
if ((batinfo = fopen(longpath, "r")) == NULL)
{
- fprintf(stderr, "Error opening batinfo %s\n", longpath);
sprintf(longpath, "/sys/class/power_supply/%s/charge_full", batname);
if ((batinfo = fopen(longpath, "r")) == NULL)
{
@@ -184,6 +192,7 @@
}
static int parser(int argc, char **argv, int &z) {
+ argc=argc; // Added to shut up compiler unused parameter warning.
if (strcmp(argv[z], "-h") == 0) {
printf("Watcher %s\n"
"(C) Curaga\n"
@Juanito: Maybe add an options hint similar to this to the CorePure64 watcher.tcz.info file:
To start watcher on X start, add to .xsession:
[ $(which watcher) ] && watcher -g +0-0 &
-
For more options, run watcher -h
-
Applied except the argc assignment, I find that ugly. Thanks!
I see the patch cron job hadn't been updated with the server change to nginx and corresponding script update. Updated now.
-
Hi curaga
Applied except the argc assignment, I find that ugly. Thanks! ...
I've been bitten in the past where I became complacent with the same handful of harmless warnings showing up during compilation
and not noticing an extra warning that caused a problem. As a result, I usually try to make the compiler happy and add comments
indicating such. As I'm sure you are aware, the compiler is smart enough to optimize out that assignment.
-
Premature error messages have been removed and an updated package has been sent to tcesubmit.
posted - thanks
-
For hiding unused var warnings, it's better IMO to use __attribute__((unused)).
-
Hi curaga
For hiding unused var warnings, it's better IMO to use __attribute__((unused)).
Now that I'm aware that option exists, I'm inclined to agree.
-
sorry guys but watcher still shows no battery info for me (conky does)
-
Does this give an error message:
$ watcher -bat BAT0
-
odd. than command does not give an error it actually starts watcher AND it displays the battery %. however, starting watcher with "watcher" command alone does not display battery.
-
Hi h2sammo
That's correct. It's up to the user to tell watcher the name of the battery to be monitored. If you're running a desktop
computer there is no battery to monitor. Running:
watcher -hwill show you watchers help screen.
-
REPORT:
TC10 on a Dell Mini10.
Flit runs, reports current time and Battery State, does not update either one.
Trying 'watcher' next. Stay tuned.
-
flit works fine here - both battery percentage and time update.
If you start flit from a terminal window, do you get any error messages?
-
flit works fine here - both battery percentage and time update.
If you start flit from a terminal window, do you get any error messages?
Nope.
I also note that it's not recognizing that it is on Battery rather than on AC. (Tried it both ways.)