[Pkg-wmaker-commits] [wmgtemp] 11/45: Imported Upstream version 1.1
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Tue Aug 25 02:58:04 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmgtemp.
commit ea769154c83cfe72ccf5dc5c8f486d00f583c3b2
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date: Fri Jan 30 20:33:40 2015 -0600
Imported Upstream version 1.1
---
BUGS | 5 -
CREDITS | 15 ++-
ChangeLog | 323 ++++++++++++++++++++++++++++++++++++++++++++++
src/wmgeneral/wmgeneral.c | 26 ++--
src/wmgtemp-interface.xpm | 4 +-
src/wmgtemp.c | 237 ++++++++++++++++++++++------------
wmgtemp.1 | 11 ++
7 files changed, 514 insertions(+), 107 deletions(-)
diff --git a/BUGS b/BUGS
index 751c922..e69de29 100644
--- a/BUGS
+++ b/BUGS
@@ -1,5 +0,0 @@
-o Including a blank line in the rc file causes a Segmentation Fault.
- I believe this is a problem in wmgeneral, this is not much of a
- concern to me at this time as I hope to move the rc file
- over to using libPropList which should resolve this issue.
-
diff --git a/CREDITS b/CREDITS
index cad4410..dcd643a 100644
--- a/CREDITS
+++ b/CREDITS
@@ -2,9 +2,12 @@ Here are a list of people that have contributed to the project
and whose help and advice is greatly appreciated.
Damian Kramer <psiren at hibernaculum.demon.co.uk>
-The following people supplied patches before chipset detection was
-implemented:
- Jon Kinred <compart at one.net.au> - W83781D, W83627HF support.
- William Martin <bill at dunfoamin.org> - AS99127F support.
- Dennis Schneider <sdans at web.de> - ADM1021 support.
- Per Larsson <albatorsk at comatosehitmen.com> IT87 support.
+Jon Kinred <compart at one.net.au> - W83781D, W83627HF support.
+William Martin <bill at dunfoamin.org> - AS99127F support.
+Dennis Schneider <sdans at web.de> - ADM1021 support.
+Per Larsson <albatorsk at comatosehitmen.com> IT87 support.
+Antti Pyykko <pyksy at pyksy.fi> - lm_sensors3 support, -c option.
+Ben Spencer <dangerous.ben at gmail.com> - drawing fix.
+Robert Cernansky <hslists at zoznam.sk> - testing.
+Ludwig Nussel <lugwig.nussell at web.de> - removed usleep, bugfixes.
+
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..d1d20b3
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,323 @@
+Project Version : rel-1_1
+2010-06-21 11:54 kronos
+
+ * src/: wmgtemp-interface.xpm, wmgtemp.c: applied patch from Ludwig
+ Nussell re: t flag and degree drawing
+
+2010-06-21 11:54 kronos
+
+ * CREDITS: applied path from Ludwig Nussell re: t flag and degree
+ drawing
+
+2010-03-26 21:27 kronos
+
+ * CREDITS: dev
+
+2010-03-26 21:22 kronos
+
+ * BUGS: rc segfault bug fixed
+
+2010-03-26 21:21 kronos
+
+ * CREDITS: minor update
+
+2010-03-26 21:15 kronos
+
+ * wmgtemp.1: update man page
+
+2010-03-26 21:09 kronos
+
+ * CREDITS, src/wmgtemp.c, src/wmgeneral/wmgeneral.c: fixed segfault
+ in wmgeneral. compiles with lm_sensors3, can now specify the
+ sensors config. added chip selection option
+
+2007-06-14 11:01 kronos
+
+ * Makefile, wmgtemp.1, src/Makefile, src/wmgtemp.c: merged patch
+ from Josip Rodin and Lugwig Nussel
+
+2003-06-10 19:33 kronos
+
+ * src/wmgtemp.c: added version to help screen
+
+2003-06-10 19:29 kronos
+
+ * README, wmgtemp.1, examples/wmgtemprc, src/wmgtemp.c: added
+ feature1/2 options, added quiet option
+
+2003-03-12 00:57 kronos
+
+ * CREDITS, src/wmgtemp.c: removed multiline string literal,
+ deprecated in gcc-3.2
+
+2002-06-14 02:21 kronos
+
+ * README, src/Makefile: now usiing dynamic chipset detection
+
+2002-02-24 21:27 kronos
+
+ * wmgtemp.1: removed suported sensors stuff
+
+2002-02-24 21:24 kronos
+
+ * CREDITS: fixed typo in email
+
+2002-02-24 21:19 kronos
+
+ * src/wmgtemp.c: switched t autodetection of chips
+
+2001-06-09 03:49 kronos
+
+ * CREDITS, README, wmgtemp.1, src/wmgtemp.c: merged in ADM1021
+ support re Dennis Schneider <sdans at wed.de>. Added temperature
+ swapping
+
+2001-04-17 01:53 kronos
+
+ * README: added AS99127F to sensor lis
+
+2001-04-17 01:48 kronos
+
+ * src/wmgtemp.1x: removed coz i wrote a better one and added it
+ somewhere else and forgot about this one
+
+2001-04-17 01:45 kronos
+
+ * Makefile: Modified manpage install - actually works this time,
+ that'll teach me for doing it at work and not testing it ;)
+
+2001-04-17 01:45 kronos
+
+ * wmgtemp.1: HELP for ckable tempscale indicator - cycling.
+
+2001-04-17 01:44 kronos
+
+ * src/wmgtemp.c: Added clickable tempscale indicator - cycling.
+
+2001-04-13 15:29 kronos
+
+ * INSTALL, Makefile: Added manpage install
+
+2001-04-13 02:04 kronos
+
+ * wmgtemp.1: Initial add of manpage
+
+2001-04-13 02:02 kronos
+
+ * CREDITS, src/wmgtemp.c: Added support for AS99127F and fixed the
+ bug that stopped the temps being displayed in other scales
+
+2001-02-28 20:55 kronos
+
+ * src/wmgtemp.c: Corrected help screen defailt temps for min and
+ max
+
+2001-02-28 20:53 kronos
+
+ * TODO: updated with doneness
+
+2001-02-28 20:41 kronos
+
+ * src/wmgtemp-interface.xpm: Changed high temp viewing indicator
+ light to amber
+
+2001-02-28 20:34 kronos
+
+ * src/wmgtemp.c: Fixed typo in help, removed extra -h flag on help
+ screen, correct processing of -u flag.
+
+2001-02-28 16:50 kronos
+
+ * src/wmgtemp.c: Changed summink to test email notification
+
+2001-02-28 16:47 kronos
+
+ * src/wmgtemp.c: testing email notifications
+
+2001-02-28 14:48 kronos
+
+ * src/wmgtemp.c: Fixed lagging screen drawing
+
+2001-02-28 14:47 kronos
+
+ * examples/wmgtemprc: Initial add
+
+2001-02-28 14:46 kronos
+
+ * BUGS: added blurb
+
+2001-02-27 20:57 kronos
+
+ * README: Added guff
+
+2001-02-27 20:34 kronos
+
+ * BUGS: Added
+
+2001-02-27 20:28 kronos
+
+ * src/: wmgtemp-interface.xpm, wmgtemp.c: Changed commandline
+ processing to getopt, Added rcfile processing, Added MAX temp
+ viewing indicator light
+
+2001-02-26 20:45 kronos
+
+ * src/: wmgtemp-interface.xpm, wmgtemp.c: Last commit added support
+ for W83781D and W83627HF. This: Added support for optional
+ displaying of CPU/SYS temp on graph.
+
+2001-02-26 17:15 kronos
+
+ * src/: wmgtemp-interface.xpm, wmgtemp.c: Added HIGH temp
+ displaying, execing of command at given temp
+
+2001-02-26 14:15 kronos
+
+ * CREDITS: Added note for Jon Kinred <compart at one.net.au>
+
+2001-02-26 14:14 kronos
+
+ * src/wmgtemp.c: W83781D, W83627HF support.
+
+2001-02-23 21:01 kronos
+
+ * src/wmgtemp.1x: Added manpage
+
+2001-02-22 21:13 kronos
+
+ * INSTALL: updated instructions
+
+2001-02-22 21:12 kronos
+
+ * Makefile: Added missing install option
+
+2001-02-22 21:08 kronos
+
+ * TODO: checked off completed ideas
+
+2001-02-22 20:57 kronos
+
+ * src/wmgtemp.c: Converted to use signals - xevents weren't being
+ handled in a timely manner
+
+2001-02-22 20:22 kronos
+
+ * src/wmgtemp.c: Code cleanup
+
+2001-02-21 20:38 kronos
+
+ * src/wmgtemp.c: moved drawing of range lines
+
+2001-02-21 20:05 kronos
+
+ * src/: wmgtemp-interface.xpm, wmgtemp.c: Revamped graph rescaling,
+ not so zoomy
+
+2001-02-16 19:42 kronos
+
+ * src/wmgtemp.c: Updated usage
+
+2001-02-16 19:40 kronos
+
+ * src/Makefile: Added 'depend' back in, oops!
+
+2001-02-16 19:40 kronos
+
+ * src/.deps: New
+
+2001-02-16 19:33 kronos
+
+ * src/wmgtemp.c: tidied a few things
+
+2001-02-16 19:29 kronos
+
+ * src/Makefile: removed 'depend', not needed
+
+2001-02-16 19:23 kronos
+
+ * src/: .xvpics/wmgtemp-interface.xpm, .xvpics/wmlm_master.xpm,
+ .deps: Removed, shouldn't be maintained by cvs
+
+2001-02-16 19:06 kronos
+
+ * CREDITS: Initial
+
+2001-02-16 18:56 kronos
+
+ * TODO: Checked off completed items
+
+2001-02-16 18:53 kronos
+
+ * src/wmgtemp.h: Removed coz it ain't needed
+
+2001-02-16 18:48 kronos
+
+ * src/: wmgtemp.c: Added CPU temp warning lights
+
+2001-02-16 14:55 kronos
+
+ * src/wmgtemp.c: Got rid of a few of the if's in temperature
+ scaling
+
+2001-02-16 14:46 kronos
+
+ * src/: wmgtemp.c, wmgtemp.h: Modified graph to scale on the fly
+ depending on temperature ranges of displayed values.
+
+2001-02-09 21:52 kronos
+
+ * src/wmgtemp.c: added checking for invalid delay
+
+2001-02-09 21:50 kronos
+
+ * src/wmgtemp.c: corrected update delay message
+
+2001-02-09 21:46 kronos
+
+ * src/wmgtemp.c: changed error message for unsupported chip
+
+2001-02-09 21:40 kronos
+
+ * src/: wmgtemp-interface.xpm, wmgtemp.c, wmgtemp.h: Adding
+ structure to make supporting other chipssets easier
+
+2001-02-07 18:58 kronos
+
+ * TODO: added ideas while i still remember them
+
+2001-02-07 18:52 kronos
+
+ * src/wmgtemp.c: added usage for block and line
+
+2001-02-07 18:51 kronos
+
+ * TODO: added ideas while i still remember them
+
+2001-02-07 18:47 kronos
+
+ * Artistic, INSTALL, README, TODO: Initial
+
+2001-02-07 18:34 kronos
+
+ * src/: wmgtemp.c, wmgtemp.h: added rudimentary graph drawing
+
+2001-02-07 17:28 kronos
+
+ * Makefile, src/.deps, src/Makefile,
+ src/wmgtemp-interface-mask.xbm, src/wmgtemp-interface.xpm,
+ src/wmgtemp.c, src/wmgtemp.h, src/wmgeneral/misc.c,
+ src/wmgeneral/misc.h, src/wmgeneral/wmgeneral.c,
+ src/wmgeneral/wmgeneral.h, src/wmgeneral/list.c,
+ src/wmgeneral/list.h, src/.xvpics/wmgtemp-interface.xpm,
+ src/.xvpics/wmlm_master.xpm: Initial revision
+
+2001-02-07 17:28 kronos
+
+ * Makefile, src/.deps, src/Makefile,
+ src/wmgtemp-interface-mask.xbm, src/wmgtemp-interface.xpm,
+ src/wmgtemp.c, src/wmgtemp.h, src/wmgeneral/misc.c,
+ src/wmgeneral/misc.h, src/wmgeneral/wmgeneral.c,
+ src/wmgeneral/wmgeneral.h, src/wmgeneral/list.c,
+ src/wmgeneral/list.h, src/.xvpics/wmgtemp-interface.xpm,
+ src/.xvpics/wmlm_master.xpm: initial import of tidied up version
+
diff --git a/src/wmgeneral/wmgeneral.c b/src/wmgeneral/wmgeneral.c
index 56b7bd6..30c39bf 100644
--- a/src/wmgeneral/wmgeneral.c
+++ b/src/wmgeneral/wmgeneral.c
@@ -98,7 +98,7 @@ int CheckMouseRegion(int, int);
void parse_rcfile(const char *filename, rckeys *keys) {
- char *p,*q;
+ char *p,*q, *t;
char temp[128];
char *tokens = " :\t\n";
FILE *fp;
@@ -109,17 +109,19 @@ void parse_rcfile(const char *filename, rckeys *keys) {
while (fgets(temp, 128, fp)) {
key = 0;
q = strdup(temp);
- q = strtok(q, tokens);
- while (key >= 0 && keys[key].label) {
- if ((!strcmp(q, keys[key].label))) {
- p = strstr(temp, keys[key].label);
- p += strlen(keys[key].label);
- p += strspn(p, tokens);
- if ((i = strcspn(p, "#\n"))) p[i] = 0;
- free(*keys[key].var);
- *keys[key].var = strdup(p);
- key = -1;
- } else key++;
+ t = strtok(q, tokens);
+ if(t) {
+ while (key >= 0 && keys[key].label) {
+ if ((!strcmp(t, keys[key].label))) {
+ p = strstr(temp, keys[key].label);
+ p += strlen(keys[key].label);
+ p += strspn(p, tokens);
+ if ((i = strcspn(p, "#\n"))) p[i] = 0;
+ free(*keys[key].var);
+ *keys[key].var = strdup(p);
+ key = -1;
+ } else key++;
+ }
}
free(q);
}
diff --git a/src/wmgtemp-interface.xpm b/src/wmgtemp-interface.xpm
index 311046c..af270e7 100644
--- a/src/wmgtemp-interface.xpm
+++ b/src/wmgtemp-interface.xpm
@@ -30,8 +30,8 @@ static char * wmgtemp_interface_xpm[] = {
"[ c #AA0000",
".............................................................. +@#$ $$ ",
".%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&* +@#$ $$ ",
-".%++++++++++++++++++++++++++++++++++++++=+++=+=++++++++=+++++- +@#$ ",
-".%+++++++++;>>>,+,>>>,+,$$$,+++$++;$$$;+;$$$;+'$$$;+>>+'$$$;+) +@#$ ",
+".%++++++++++++++++++++++++++++++++++++++=+++=+=++++++++=+++++- +@#$ >> ",
+".%+++++++++;>>>,+,>>>,+,$$$,+++$++;$$$;+;$$$;+'$$$;+>>+'$$$;+) +@#$ >> ",
".%+++;$;+++>+++$+>+++>+>+++>++;$;+$+++$+$+++$+$+++$+>>+$+++$+) +@#$ ",
".%++;$$$;++>+++$+>+++>+>+++>++$$$+$+++$+$+++$!~+++$++++$+++~!) +@#$ ",
".%++$$$$$++,$$$;+,>>>,+,$$$,++++++;$$$;=;$$$;!;$$$;=++='$$$;{) +@#$ ",
diff --git a/src/wmgtemp.c b/src/wmgtemp.c
index aa31aa4..b8951c7 100644
--- a/src/wmgtemp.c
+++ b/src/wmgtemp.c
@@ -11,7 +11,6 @@
#include <X11/xpm.h>
#include <X11/extensions/shape.h>
#include <sensors/sensors.h>
-#include <sensors/chips.h>
#include <sensors/error.h>
#include "wmgeneral/wmgeneral.h"
#include "wmgeneral/misc.h"
@@ -52,7 +51,7 @@
#define DEBUG 0 /* 0 disable 1 enable */
-#define OPT_STRING "g:s:hH:w:m:M:a:e:u:1:2:t:q"
+#define OPT_STRING "g:sS:hH:w:m:M:a:e:u:1:2:c:tq"
#define TEMPTOFAHRENHEIT(t) ((int)((t * (1.8) + 32)))
#define TEMPTOKELVIN(t) ((int)(t + 273))
@@ -85,10 +84,11 @@ inline void cycle_temptype();
int delay = 1;
const sensors_chip_name *name;
char *exec_app = NULL;
+char *rc_config = NULL;
-short SENSOR_DISP = 0;
-short SENSOR_DEF_CPU = 0;
-short SENSOR_DEF_SYS = 0;
+short SENSOR_DISP = 0;
+int SUBFEAT_NUM_CPU = 0;
+int SUBFEAT_NUM_SYS = 0;
double cpu_history[59];
double sys_history[59];
@@ -112,6 +112,7 @@ short swap_types = 0;
char *sensor_feature1 = "temp1";
char *sensor_feature2 = "temp2";
+char *sensor_chip = NULL;
short quiet = 0;
@@ -119,18 +120,18 @@ int main(int argc, char **argv) {
char *chipname = NULL;
int chip_nr = 0;
int i = 0;
- short tmp_swap;
+ int tmp_swap;
- int feature1 = 0;
- int feature2 = 0;
- const sensors_feature_data* feature = NULL;
+ const sensors_feature* feature = NULL;
+ const sensors_subfeature* subfeature_cpu = NULL;
+ const sensors_subfeature* subfeature_sys = NULL;
short chip_found = -1;
BitOn(SENSOR_DISP, WARN_NONE);
BitOn(SENSOR_DISP, TSCALE_CELCIUS);
BitOn(SENSOR_DISP, GRAPH_LINE);
- // *conffname = "/etc/sensors.conf";
+ /* *conffname = "/etc/sensors3.conf"; */
if(!process_config(argc, argv)) {
exit(-1);
@@ -141,22 +142,23 @@ int main(int argc, char **argv) {
}
/* Get the chip name */
- name = sensors_get_detected_chips(&chip_nr);
+ name = sensors_get_detected_chips(NULL, &chip_nr);
while(name != NULL && chip_found == -1) {
- feature1 = feature2 = 0;
-
- while((feature = sensors_get_all_features(*name, &feature1, &feature2)) != NULL) {
- if(strcmp(feature->name, (const char *)sensor_feature1) == 0
- && sensors_get_ignored(*name, feature->number)) {
- SENSOR_DEF_CPU = feature->number;
- BitOn(SENSOR_DISP, CPU);
- chip_found = 1;
- }
- if(strcmp(feature->name, (const char *)sensor_feature2) == 0
- && sensors_get_ignored(*name, feature->number)) {
- SENSOR_DEF_SYS = feature->number;
- BitOn(SENSOR_DISP, SYS);
- chip_found = 1;
+ if (!sensor_chip || strcmp(name->prefix, (const char *)sensor_chip) == 0) {
+ i = 0;
+ while ((feature = sensors_get_features(name, &i))) {
+ if(strcmp(feature->name, (const char *)sensor_feature1) == 0) {
+ subfeature_cpu = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_INPUT);
+ SUBFEAT_NUM_CPU = subfeature_cpu->number;
+ BitOn(SENSOR_DISP, CPU);
+ chip_found = 1;
+ }
+ if(strcmp(feature->name, (const char *)sensor_feature2) == 0) {
+ subfeature_sys = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_INPUT);
+ SUBFEAT_NUM_SYS = subfeature_sys->number;
+ BitOn(SENSOR_DISP, SYS);
+ chip_found = 1;
+ }
}
}
@@ -164,7 +166,7 @@ int main(int argc, char **argv) {
chipname = name->prefix;
}
else {
- name = sensors_get_detected_chips(&chip_nr);
+ name = sensors_get_detected_chips(NULL, &chip_nr);
}
}
if(chip_found == -1) {
@@ -174,14 +176,25 @@ int main(int argc, char **argv) {
/* output the name of the sensor if found. */
if(quiet == 0)
- printf("wmgtemp: Primary Sensor - %s on %s\n", name->prefix, sensors_get_adapter_name(name->bus));
+ printf("wmgtemp: Primary Sensor - %s on %s\n", name->prefix, sensors_get_adapter_name(&name->bus));
if(swap_types) {
if(quiet == 0)
printf("wmgtemp: swapping temps\n");
- tmp_swap = SENSOR_DEF_SYS;
- SENSOR_DEF_SYS = SENSOR_DEF_CPU;
- SENSOR_DEF_CPU = tmp_swap;
+ tmp_swap = SUBFEAT_NUM_SYS;
+ SUBFEAT_NUM_SYS = SUBFEAT_NUM_CPU;
+ SUBFEAT_NUM_CPU = tmp_swap;
+ tmp_swap = SENSOR_DISP;
+ if(IsOn(tmp_swap, CPU)) {
+ BitOn(SENSOR_DISP, SYS);
+ } else {
+ BitOff(SENSOR_DISP, SYS);
+ }
+ if(IsOn(tmp_swap, SYS)) {
+ BitOn(SENSOR_DISP, CPU);
+ } else {
+ BitOff(SENSOR_DISP, CPU);
+ }
}
chip_nr = 0;
@@ -217,10 +230,6 @@ int main(int argc, char **argv) {
do_sensors(0);
RedrawWindow();
- // Set up signal handler
-// signal(SIGALRM, do_sensors);
-// alarm(delay);
-
process_xevents();
return 0;
@@ -228,22 +237,34 @@ int main(int argc, char **argv) {
void draw_scale_indicator() {
if(IsOn(SENSOR_DISP, TSCALE_CELCIUS)) {
- if(IsOn(SENSOR_DISP, CPU))
+ if(IsOn(SENSOR_DISP, CPU)) {
copyXPMArea(61, 65, 5, 7, 55, CPU_YPOS);
- if(IsOn(SENSOR_DISP, SYS))
+ copyXPMArea(70, 2, 2, 2, 52, CPU_YPOS);
+ }
+ if(IsOn(SENSOR_DISP, SYS)) {
copyXPMArea(61, 65, 5, 7, 55, SYS_YPOS);
+ copyXPMArea(70, 2, 2, 2, 52, SYS_YPOS);
+ }
}
else if(IsOn(SENSOR_DISP, TSCALE_FAHRENHEIT)) {
- if(IsOn(SENSOR_DISP, CPU))
+ if(IsOn(SENSOR_DISP, CPU)) {
copyXPMArea(67, 65, 5, 7, 55, CPU_YPOS);
- if(IsOn(SENSOR_DISP, SYS))
+ copyXPMArea(70, 2, 2, 2, 52, CPU_YPOS);
+ }
+ if(IsOn(SENSOR_DISP, SYS)) {
copyXPMArea(67, 65, 5, 7, 55, SYS_YPOS);
+ copyXPMArea(70, 2, 2, 2, 52, SYS_YPOS);
+ }
}
else if(IsOn(SENSOR_DISP, TSCALE_KELVIN)) {
- if(IsOn(SENSOR_DISP, CPU))
+ if(IsOn(SENSOR_DISP, CPU)) {
copyXPMArea(73, 65, 5, 7, 55, CPU_YPOS);
- if(IsOn(SENSOR_DISP, SYS))
+ copyXPMArea(70, 0, 2, 2, 52, CPU_YPOS);
+ }
+ if(IsOn(SENSOR_DISP, SYS)) {
copyXPMArea(73, 65, 5, 7, 55, SYS_YPOS);
+ copyXPMArea(70, 0, 2, 2, 52, SYS_YPOS);
+ }
}
}
@@ -342,7 +363,7 @@ void process_xevents() {
RedrawWindow();
break;
case 3:
- if(SENSOR_DEF_CPU) {
+ if(SUBFEAT_NUM_CPU) {
if(IsOn(SENSOR_DISP, CPU)) {
BitOff(SENSOR_DISP, CPU);
blank_type(CPU);
@@ -350,13 +371,14 @@ void process_xevents() {
else {
BitOn(SENSOR_DISP, CPU);
draw_type(CPU);
+ draw_scale_indicator();
}
}
update_display();
RedrawWindow();
break;
case 4:
- if(SENSOR_DEF_SYS) {
+ if(SUBFEAT_NUM_SYS) {
if(IsOn(SENSOR_DISP, SYS)) {
BitOff(SENSOR_DISP, SYS);
blank_type(SYS);
@@ -364,6 +386,7 @@ void process_xevents() {
else {
BitOn(SENSOR_DISP, SYS);
draw_type(SYS);
+ draw_scale_indicator();
}
}
update_display();
@@ -384,7 +407,6 @@ void process_xevents() {
}
void do_sensors(int val) {
-// alarm(delay);
update_sensor_data();
update_display();
@@ -412,8 +434,8 @@ void update_sensor_data() {
}
// Read the new values from the sensors into the temperature arrays.
- sensors_get_feature(*name, SENSOR_DEF_SYS, &sys_history[58]);
- sensors_get_feature(*name, SENSOR_DEF_CPU, &cpu_history[58]);
+ if(IsOn(SENSOR_DISP, SYS)) sensors_get_value(name, SUBFEAT_NUM_SYS, &sys_history[58]);
+ if(IsOn(SENSOR_DISP, CPU)) sensors_get_value(name, SUBFEAT_NUM_CPU, &cpu_history[58]);
// Update the run high/low values.
if(cpu_high > run_cpu_high)
@@ -435,13 +457,13 @@ void update_display() {
draw_warning_lights(cpu_history[58]);
// ReDraw temperature numbers
- if(SENSOR_DEF_CPU) {
+ if(IsOn(SENSOR_DISP, CPU)) {
copyXPMArea(78, 65, 5, 7, 34, CPU_YPOS);
copyXPMArea(78, 65, 5, 7, 40, CPU_YPOS);
copyXPMArea(78, 65, 5, 7, 46, CPU_YPOS);
draw_temp(TEMPTODISPLAYSCALE(IsOn(SENSOR_DISP, HIGH_CPU) == 0 ? cpu_history[58] : run_cpu_high, SENSOR_DISP), CPU);
}
- if(SENSOR_DEF_SYS) {
+ if(IsOn(SENSOR_DISP, SYS)) {
copyXPMArea(78, 65, 5, 7, 34, SYS_YPOS);
copyXPMArea(78, 65, 5, 7, 40, SYS_YPOS);
copyXPMArea(78, 65, 5, 7, 46, SYS_YPOS);
@@ -575,11 +597,25 @@ void add_to_graph(double temp, int type, short blank, double range, int pos) {
short length = each * (temp - range_lower);
// Draw the graphs
- if(IsOn(SENSOR_DISP, GRAPH_BLOCK)) {
- copyXPMArea(type == CPU ? 67 : 68, 0, 1, length, pos, 51 - length);
- }
- else if(IsOn(SENSOR_DISP, GRAPH_LINE)) {
- copyXPMArea(type == CPU ? 67 : 68, 0, 1, 1, pos, 51 - length);
+ // if(IsOn(SENSOR_DISP, GRAPH_BLOCK)) {
+ // copyXPMArea(type == CPU ? 67 : 68, 0, 1, length, pos, 51 - length);
+ // }
+ // else if(IsOn(SENSOR_DISP, GRAPH_LINE)) {
+ // copyXPMArea(type == CPU ? 67 : 68, 0, 1, 1, pos, 51 - length);
+ // }
+
+ // Do not draw the graphs if the temperature data does not make sense
+ // Orginially used the code above but change supplied to fix issues seen by Ben Spencer.
+ // Couldn't be arsed to find the real cause as I don't use the app myself anymore.
+ // Doesn't seem to break anything though
+ if ((temp >= range_lower) && (temp <= range_upper)) {
+ // Draw the graphs
+ if(IsOn(SENSOR_DISP, GRAPH_BLOCK)) {
+ copyXPMArea(type == CPU ? 67 : 68, 0, 1, length, pos, 51 - length);
+ }
+ else if(IsOn(SENSOR_DISP, GRAPH_LINE)) {
+ copyXPMArea(type == CPU ? 67 : 68, 0, 1, 1, pos, 51 - length);
+ }
}
}
@@ -627,10 +663,10 @@ int init_sensors() {
FILE *config_file;
int res;
- config_file = fopen"/etc/sensors.conf", "r");
+ config_file = fopen(rc_config, "r");
if(config_file == NULL) {
- fprintf(stderr, "Error opening /etc/sensors.conf\n");
+ fprintf(stderr, "Error opening %s\n", rc_config);
return 0;
}
@@ -642,40 +678,44 @@ int init_sensors() {
}
if(fclose(config_file))
- perror("Error closing sensors.conf");
+ perror("Error closing sensors config");
return 1;
}
void display_usage() {
- printf("wmgtemp v0.7\n" \
+ printf("wmgtemp v0.9\n" \
"Usage: wmgtemp [options]\n" \
"Options:\n" \
- " -s, --scale=SCALE display temperatures in SCALE\n" \
- " SCALE=kelvin, fahrenheit\n" \
- " [Default: celcius]\n" \
- " -g, --graph=STYLE display graph as STYLE\n" \
- " STYLE=line, block\n" \
- " [Default: line]\n" \
- " -H, --high=TEMP Display red warning light at TEMP degrees celcius\n" \
- " [Default: 50]\n" \
- " -w, --warn=TEMP Display amber warning light at TEMP degrees celcius\n" \
- " [Default: 45]\n" \
- " -u, --update=SEC update the display every SEC seconds\n" \
- " [Default: 1]\n" \
- " -m, --min=TEMP set the lower bound of the graph to TEMP degrees celcius\n" \
- " [Default: 20]\n" \
- " -M, --max=TEMP set the upper bound of the graph to TEMP degrees celcius\n" \
- " [Default: 35]\n" \
- " -1, --feature1=F1 set the feature for CPU\n" \
- " [Default: temp1]\n" \
- " -2, --feature2=F2 set the feature for SYS\n" \
- " [Default: temp2]\n" \
- " -a, --execat=TEMP Execute a command at TEMP degrees celcius\n" \
- " -e, --exec=COMMAND Execute COMMAND when the 'execat' temperature is reached\n" \
- " -t, --swap Swap CPU and SYS temps\n" \
- " -q, --quiet Don't display any messages\n" \
- " -h, --help Displays this help screen\n");
+ " -S, --sensorconf=PATH Specify sensors config file PATH\n" \
+ " [Default: /etc/sensors.conf]\n" \
+ " -s, --scale=SCALE Display temperatures in SCALE\n" \
+ " SCALE=kelvin, fahrenheit\n" \
+ " [Default: celcius]\n" \
+ " -g, --graph=STYLE Display graph as STYLE\n" \
+ " STYLE=line, block\n" \
+ " [Default: line]\n" \
+ " -H, --high=TEMP Display red warning light at TEMP degrees celcius\n" \
+ " [Default: 50]\n" \
+ " -w, --warn=TEMP Display amber warning light at TEMP degrees celcius\n" \
+ " [Default: 45]\n" \
+ " -u, --update=SEC Update the display every SEC seconds\n" \
+ " [Default: 1]\n" \
+ " -m, --min=TEMP Set lower bound of the graph to TEMP degrees celcius\n" \
+ " [Default: 20]\n" \
+ " -M, --max=TEMP Set upper bound of the graph to TEMP degrees celcius\n" \
+ " [Default: 35]\n" \
+ " -1, --feature1=F1 Set the feature for CPU\n" \
+ " [Default: temp1]\n" \
+ " -2, --feature2=F2 Set the feature for SYS\n" \
+ " [Default: temp2]\n" \
+ " -c, --chip=NAME Use sensor chip matching NAME\n" \
+ " [Default: use any]\n" \
+ " -a, --execat=TEMP Execute a command at TEMP degrees celcius\n" \
+ " -e, --exec=COMMAND Execute COMMAND when 'execat' temperature is reached\n" \
+ " -t, --swap Swap CPU and SYS temps\n" \
+ " -q, --quiet Don't display any messages\n" \
+ " -h, --help Displays this help screen\n");
}
void draw_warning_lights(double current_temp) {
@@ -711,11 +751,27 @@ inline void blank_type(int type) {
copyXPMArea(78, 65, 5, 7, 11, CPU_YPOS);
copyXPMArea(78, 65, 5, 7, 17, CPU_YPOS);
copyXPMArea(78, 65, 5, 7, 23, CPU_YPOS);
+
+ copyXPMArea(70, 0, 2, 2, 52, CPU_YPOS);
+
+ copyXPMArea(78, 65, 5, 7, 34, CPU_YPOS);
+ copyXPMArea(78, 65, 5, 7, 40, CPU_YPOS);
+ copyXPMArea(78, 65, 5, 7, 46, CPU_YPOS);
+
+ copyXPMArea(78, 65, 5, 7, 55, CPU_YPOS);
break;
case SYS:
copyXPMArea(78, 65, 5, 7, 11, SYS_YPOS);
copyXPMArea(78, 65, 5, 7, 17, SYS_YPOS);
copyXPMArea(78, 65, 5, 7, 23, SYS_YPOS);
+
+ copyXPMArea(70, 0, 2, 2, 52, SYS_YPOS);
+
+ copyXPMArea(78, 65, 5, 7, 34, SYS_YPOS);
+ copyXPMArea(78, 65, 5, 7, 40, SYS_YPOS);
+ copyXPMArea(78, 65, 5, 7, 46, SYS_YPOS);
+
+ copyXPMArea(78, 65, 5, 7, 55, SYS_YPOS);
break;
}
}
@@ -770,7 +826,8 @@ int process_config(int argc, char **argv) {
char *rc_swap = NULL;
char *rc_feature1 = NULL;
char *rc_feature2 = NULL;
- char *rc_quiet = NULL;
+ char *rc_quiet = NULL;
+ char *rc_chip = NULL;
short parse_ok = 1;
int opt_index;
int opt;
@@ -791,6 +848,8 @@ int process_config(int argc, char **argv) {
{ "quiet", &rc_quiet },
{ "feature1", &rc_feature1 },
{ "feature2", &rc_feature2 },
+ { "chip", &rc_chip },
+ { "sensorconf", &rc_config },
{ NULL, NULL }
};
@@ -806,6 +865,8 @@ int process_config(int argc, char **argv) {
{"update", required_argument, 0, 'u'},
{"feature1", required_argument, 0, '1'},
{"feature2", required_argument, 0, '2'},
+ {"chip", required_argument, 0, 'c'},
+ {"sensorconf", required_argument, 0, 'S'},
{"swap", no_argument, 0, 't'},
{"quiet", no_argument, 0, 'q'},
{"help", no_argument, 0, 'h'},
@@ -853,6 +914,12 @@ int process_config(int argc, char **argv) {
case '2':
rc_feature2 = strdup(optarg);
break;
+ case 'c':
+ rc_chip = strdup(optarg);
+ break;
+ case 'S':
+ rc_config = strdup(optarg);
+ break;
case 'q':
rc_quiet = "y";
break;
@@ -880,6 +947,12 @@ int process_config(int argc, char **argv) {
if(rc_feature2 != NULL) {
sensor_feature2 = strdup(rc_feature2);
}
+ if(rc_chip != NULL) {
+ sensor_chip = strdup(rc_chip);
+ }
+ if(rc_config == NULL) {
+ rc_config = "/etc/sensors.conf";
+ }
if(rc_graph != NULL) {
if(!strncmp(rc_graph, "l", 1)) {
diff --git a/wmgtemp.1 b/wmgtemp.1
index 0f1a945..bf34ab7 100644
--- a/wmgtemp.1
+++ b/wmgtemp.1
@@ -25,6 +25,11 @@ show temperatures using SCALE temperature scale. SCALE=celcius, fahrenheit or ke
.br
\fBDefault\fP: celcius
.TP
+.B \-S, \-\-sensorconf=PATH
+specify the PATH to the lm_sensors config
+.br
+\fBDefault\fP: /etc/sensors.conf
+.TP
.B \-g, \-\-graph=STYLE
display graph as STYLE. STYLE=line or block.
.br
@@ -73,6 +78,12 @@ set the feature for SYS
\fBDefault\fP: temp2
.TP
+.B \-c, \-\-chip=CHIP
+specify the chip sensor to use
+.br
+\fBDefault\fP: auto
+
+.TP
.B \-a, \-\-execat=TEMP
execute a command at TEMP degrees celcius.
.br
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmgtemp.git
More information about the Pkg-wmaker-commits
mailing list