WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Battery monitor or icon?  (Read 18745 times)

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14823
Re: Battery monitor or icon?
« Reply #15 on: January 30, 2019, 02:05:28 AM »
No rush  :)

That's fine by me, @curaga?

In the meantime, updated watcher posted to the CorePure64-10.x repo

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11047
Re: Battery monitor or icon?
« Reply #16 on: January 30, 2019, 04:17:58 AM »
Yeah I'll take that patch.
The only barriers that can stop you are the ones you create yourself.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11641
Re: Battery monitor or icon?
« Reply #17 on: January 30, 2019, 09:46:30 AM »
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:
Code: [Select]
--- 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:
Code: [Select]
To start watcher on X start, add to .xsession:
[ $(which watcher) ] && watcher -g +0-0 &
-
For more options, run  watcher -h

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11047
Re: Battery monitor or icon?
« Reply #18 on: January 30, 2019, 12:46:48 PM »
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.
The only barriers that can stop you are the ones you create yourself.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11641
Re: Battery monitor or icon?
« Reply #19 on: January 30, 2019, 01:07:11 PM »
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.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14823
Re: Battery monitor or icon?
« Reply #20 on: January 31, 2019, 01:22:25 AM »
Premature error messages have been removed and an updated package has been sent to tcesubmit.

posted - thanks

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11047
Re: Battery monitor or icon?
« Reply #21 on: January 31, 2019, 03:25:49 AM »
For hiding unused var warnings, it's better IMO to use __attribute__((unused)).
The only barriers that can stop you are the ones you create yourself.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11641
Re: Battery monitor or icon?
« Reply #22 on: January 31, 2019, 10:30:05 AM »
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.

Offline h2sammo

  • Jr. Member
  • **
  • Posts: 80
    • Best podcast on LI-ion
Re: Battery monitor or icon?
« Reply #23 on: February 01, 2019, 05:04:08 AM »
sorry guys but watcher still shows no battery info for me (conky does)
Thank you for your help!

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14823
Re: Battery monitor or icon?
« Reply #24 on: February 01, 2019, 05:17:15 AM »
Does this give an error message:
Code: [Select]
$ watcher -bat BAT0

Offline h2sammo

  • Jr. Member
  • **
  • Posts: 80
    • Best podcast on LI-ion
Re: Battery monitor or icon?
« Reply #25 on: February 01, 2019, 08:27:50 PM »
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.
Thank you for your help!

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11641
Re: Battery monitor or icon?
« Reply #26 on: February 01, 2019, 08:46:54 PM »
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:
Code: [Select]
watcher -hwill show you  watchers  help screen.

Offline TomyTurbos

  • Jr. Member
  • **
  • Posts: 95
Re: Battery monitor or icon?
« Reply #27 on: February 07, 2019, 08:10:41 PM »
REPORT:

TC10 on a Dell Mini10.

Flit runs, reports current time and Battery State, does not update either one.

Trying 'watcher' next.  Stay tuned.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14823
Re: Battery monitor or icon?
« Reply #28 on: February 08, 2019, 03:00:58 AM »
flit works fine here - both battery percentage and time update.

If you start flit from a terminal window, do you get any error messages?

Offline TomyTurbos

  • Jr. Member
  • **
  • Posts: 95
Re: Battery monitor or icon?
« Reply #29 on: February 08, 2019, 03:52:14 PM »
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.)