[Pkg-wmaker-commits] [wmgtemp] 03/45: Imported Upstream version 0.6
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Tue Aug 25 02:58:03 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 84b6109ba3c8b394f149be91bdbc4143db198649
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date: Fri Jan 30 20:33:35 2015 -0600
Imported Upstream version 0.6
---
Artistic | 0
BUGS | 0
CREDITS | 3 +-
INSTALL | 0
Makefile | 0
README | 13 +---
TODO | 0
examples/wmgtemprc | 0
src/.deps | 0
src/Makefile | 2 +-
src/wmgeneral/list.c | 0
src/wmgeneral/list.h | 0
src/wmgeneral/misc.c | 0
src/wmgeneral/misc.h | 0
src/wmgeneral/wmgeneral.c | 0
src/wmgeneral/wmgeneral.h | 0
src/wmgtemp-interface-mask.xbm | 0
src/wmgtemp-interface.xpm | 0
src/wmgtemp.c | 141 ++++++++++++++++-------------------------
wmgtemp.1 | 3 -
20 files changed, 62 insertions(+), 100 deletions(-)
diff --git a/Artistic b/Artistic
old mode 100644
new mode 100755
diff --git a/BUGS b/BUGS
old mode 100644
new mode 100755
diff --git a/CREDITS b/CREDITS
old mode 100644
new mode 100755
index b389611..f882e77
--- a/CREDITS
+++ b/CREDITS
@@ -4,4 +4,5 @@ and whose help and advice is greatly appreciated.
Damian Kramer <psiren at hibernaculum.demon.co.uk>
Jon Kinred <compart at one.net.au> - W83781D, W83627HF support.
William Martin <bill at dunfoamin.org> - AS99127F support.
-Dennis Schneider <rdans at web.de> - ADM1021 support.
\ No newline at end of file
+Dennis Schneider <sdans at web.de> - ADM1021 support.
+Per Larsson <albatorsk at comatosehitmen.com> IT87 support.
diff --git a/INSTALL b/INSTALL
old mode 100644
new mode 100755
diff --git a/Makefile b/Makefile
old mode 100644
new mode 100755
diff --git a/README b/README
old mode 100644
new mode 100755
index 9240e2d..37edc2f
--- a/README
+++ b/README
@@ -32,16 +32,9 @@ Interface Features:
be rescaled back to normal size.
Supported Sensors:
- VIA686A
- W83781D
- W83627HF
- AS99127F
- ADM1021
-
- The only sensors that I have personally tested this app with is
- the VIA686A. Any other sensors are either guesses or submitted
- by other users. If you have any problems with any sensors
- let me know and i'll see what I can do.
+ Unlike other versions, this version tries to auto detects sensors.
+ This means it should work with any sensors that lm_sensors supports.
+
Send any bug reports and ideas to:
diff --git a/TODO b/TODO
old mode 100644
new mode 100755
diff --git a/examples/wmgtemprc b/examples/wmgtemprc
old mode 100644
new mode 100755
diff --git a/src/.deps b/src/.deps
old mode 100644
new mode 100755
diff --git a/src/Makefile b/src/Makefile
old mode 100644
new mode 100755
index 554f5e9..5e2647d
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,7 +2,7 @@ CC = gcc
INSTALL = /usr/bin/install
LDFLAGS = -L/usr/X11R6/lib -lXpm -lXext -lX11 -lsensors
BINARY = wmgtemp
-CCFLAGS = -Wall
+CCFLAGS = -Wall -g
INSTDIR = /usr/local/bin
OFILES = wmgtemp.o \
diff --git a/src/wmgeneral/list.c b/src/wmgeneral/list.c
old mode 100644
new mode 100755
diff --git a/src/wmgeneral/list.h b/src/wmgeneral/list.h
old mode 100644
new mode 100755
diff --git a/src/wmgeneral/misc.c b/src/wmgeneral/misc.c
old mode 100644
new mode 100755
diff --git a/src/wmgeneral/misc.h b/src/wmgeneral/misc.h
old mode 100644
new mode 100755
diff --git a/src/wmgeneral/wmgeneral.c b/src/wmgeneral/wmgeneral.c
old mode 100644
new mode 100755
diff --git a/src/wmgeneral/wmgeneral.h b/src/wmgeneral/wmgeneral.h
old mode 100644
new mode 100755
diff --git a/src/wmgtemp-interface-mask.xbm b/src/wmgtemp-interface-mask.xbm
old mode 100644
new mode 100755
diff --git a/src/wmgtemp-interface.xpm b/src/wmgtemp-interface.xpm
old mode 100644
new mode 100755
diff --git a/src/wmgtemp.c b/src/wmgtemp.c
old mode 100644
new mode 100755
index 71566b0..792e7b4
--- a/src/wmgtemp.c
+++ b/src/wmgtemp.c
@@ -50,14 +50,7 @@
#define DEBUG 0 /* 0 disable 1 enable */
-// Local sensors type defines.
-#define VIA686A 0
-#define W83781D 1
-#define W83627HF 2
-#define AS99127F 3
-#define ADM1021 4
-
-#define OPT_STRING "g:s:hH:w:m:M:a:e:u:t"
+#define OPT_STRING "g:s:hH:w:m:M:a:e:u:t"
#define TEMPTOFAHRENHEIT(t) ((int)((t * (1.8) + 32)))
#define TEMPTOKELVIN(t) ((int)(t + 273))
@@ -88,7 +81,6 @@ inline void cycle_temptype();
/* Globals */
int delay = 1;
-short chiptype = -1;
const sensors_chip_name *name;
char *exec_app = NULL;
@@ -122,80 +114,52 @@ int main(int argc, char **argv) {
int i = 0;
short tmp_swap;
+ int feature1 = 0;
+ int feature2 = 0;
+ const sensors_feature_data* feature = NULL;
+ short chip_found = -1;
+
BitOn(SENSOR_DISP, WARN_NONE);
BitOn(SENSOR_DISP, TSCALE_CELCIUS);
BitOn(SENSOR_DISP, GRAPH_LINE);
+ // *conffname = "/etc/sensors.conf";
+
if(!process_config(argc, argv)) {
exit(-1);
}
if(!init_sensors()) {
- printf("wmgtemp: Error initilising lm_sensors.");
exit(-1);
}
/* Get the chip name */
name = sensors_get_detected_chips(&chip_nr);
- while(chiptype == -1 && name != NULL) {
- if(!strcmp(name->prefix, SENSORS_VIA686A_PREFIX)) {
- /* set the chip name */
- chipname = SENSORS_VIA686A_PREFIX;
- BitOn(SENSOR_DISP, CPU);
- BitOn(SENSOR_DISP, SYS);
- SENSOR_DEF_CPU = SENSORS_VIA686A_TEMP2;
- SENSOR_DEF_SYS = SENSORS_VIA686A_TEMP;
- chiptype = VIA686A;
-
- /*
- sensors_get_feature(*name, SENSORS_VIA686A_TEMP2_OVER, &cpu_limit);
- sensors_get_feature(*name, SENSORS_VIA686A_TEMP_OVER, &sys_limit);
- printf("cpu limit: %f", cpu_limit);
- printf("sys limit: %f", sys_limit);
- */
- }
- else if(!strcmp(name->prefix, SENSORS_ADM1021_PREFIX)) {
- chipname = SENSORS_ADM1021_PREFIX;
- BitOn(SENSOR_DISP, CPU);
- BitOn(SENSOR_DISP, SYS);
- SENSOR_DEF_CPU = SENSORS_ADM1021_REMOTE_TEMP;
- SENSOR_DEF_SYS = SENSORS_ADM1021_TEMP;
- chiptype = ADM1021;
- }
- else if(!strcmp(name->prefix, SENSORS_W83781D_PREFIX)) {
- chipname = SENSORS_W83781D_PREFIX;
- BitOn(SENSOR_DISP, CPU);
- BitOn(SENSOR_DISP, SYS);
- SENSOR_DEF_CPU = SENSORS_W83781D_TEMP2;
- SENSOR_DEF_SYS = SENSORS_W83781D_TEMP1;
- chiptype = W83781D;
- }
- else if(!strcmp(name->prefix, SENSORS_AS99127F_PREFIX)) {
- chipname = SENSORS_AS99127F_PREFIX;
- BitOn(SENSOR_DISP, CPU);
- BitOn(SENSOR_DISP, SYS);
- SENSOR_DEF_CPU = SENSORS_W83781D_TEMP2;
- SENSOR_DEF_SYS = SENSORS_W83781D_TEMP1;
- chiptype = AS99127F;
- }
- else if(!strcmp(name->prefix, SENSORS_W83627HF_PREFIX)) {
- /* The lm_sensors W83781D driver is compatible with the Winbond W83627HF chip
- so we'll use the same options, at least until the chips.h header file includes
- the W83627HF's defines -- we could provide these ourselves but they may
- conflict with a later version of the sensors library */
- chipname = SENSORS_W83627HF_PREFIX;
- BitOn(SENSOR_DISP, CPU);
- BitOn(SENSOR_DISP, SYS);
- SENSOR_DEF_CPU = SENSORS_W83781D_TEMP2;
- SENSOR_DEF_SYS = SENSORS_W83781D_TEMP1;
- chiptype = W83627HF;
- }
+ while(name != NULL && chip_found == -1) {
+ feature1 = feature2 = 0;
- if(chiptype == -1)
+ while((feature = sensors_get_all_features(*name, &feature1, &feature2)) != NULL) {
+ if(strcmp(feature->name, "temp1") == 0 && sensors_get_ignored(*name, feature->number)) {
+ SENSOR_DEF_CPU = feature->number;
+ BitOn(SENSOR_DISP, CPU);
+ chip_found = 1;
+ }
+ if(strcmp(feature->name, "temp2") == 0 && sensors_get_ignored(*name, feature->number)) {
+ SENSOR_DEF_SYS = feature->number;
+ BitOn(SENSOR_DISP, SYS);
+ chip_found = 1;
+ }
+ }
+
+ if(chip_found == 1) {
+ chipname = name->prefix;
+ }
+ else {
name = sensors_get_detected_chips(&chip_nr);
+ }
}
- if(chiptype == -1) {
- fprintf(stderr,"wmgtemp: Chip not supported.\n");
+ if(chip_found == -1) {
+ fprintf(stderr,"wmgtemp: Unable to find temperature sensing feature.\n");
exit(0);
}
@@ -485,31 +449,39 @@ int recompute_range(double cpu_high, double cpu_low, double sys_high, double sys
// --------
if(IsOn(SENSOR_DISP, CPU) && IsOn(SENSOR_DISP, SYS)) {
- if((cpu_high < (range_upper - range_step) && sys_high < (range_upper - range_step)) && (range_upper - range_step) >= display_max) {
+ if((cpu_high < (range_upper - range_step) &&
+ sys_high < (range_upper - range_step)) &&
+ (range_upper - range_step) >= display_max) {
range_upper -= range_step;
modified = 1;
}
- if((cpu_low > (range_lower + range_step) && sys_low > (range_lower + range_step)) && (range_lower + range_step) <= display_min ) {
+ if((cpu_low > (range_lower + range_step) &&
+ sys_low > (range_lower + range_step)) &&
+ (range_lower + range_step) <= display_min ) {
range_lower += range_step;
modified = 1;
}
}
else if(IsOn(SENSOR_DISP, CPU) && !IsOn(SENSOR_DISP, SYS)) {
- if(cpu_high < (range_upper - range_step) && (range_upper - range_step) >= display_max) {
+ if(cpu_high < (range_upper - range_step) &&
+ (range_upper - range_step) >= display_max) {
range_upper -= range_step;
modified = 1;
}
- if(cpu_low > (range_lower + range_step) && (range_lower + range_step) <= display_min) {
+ if(cpu_low > (range_lower + range_step) &&
+ (range_lower + range_step) <= display_min) {
range_lower += range_step;
modified = 1;
}
}
else if(!IsOn(SENSOR_DISP, CPU) && IsOn(SENSOR_DISP, SYS)) {
- if(sys_high < (range_upper - range_step) && (range_upper - range_step) >= display_max) {
+ if(sys_high < (range_upper - range_step) &&
+ (range_upper - range_step) >= display_max) {
range_upper -= range_step;
modified = 1;
}
- if(sys_low > (range_lower + range_step) && (range_lower + range_step) <= display_min) {
+ if(sys_low > (range_lower + range_step) &&
+ (range_lower + range_step) <= display_min) {
range_lower += range_step;
modified = 1;
}
@@ -595,25 +567,23 @@ int init_sensors() {
FILE *config_file;
int res;
- /* Initialise sensors using sensors config file */
config_file = fopen("/etc/sensors.conf", "r");
+
+ if(config_file == NULL) {
+ fprintf(stderr, "Error opening /etc/sensors.conf\n");
+ return 0;
+ }
+
res = sensors_init(config_file);
if(res != 0) {
- config_file = fopen("/usr/etc/sensors.conf", "r");
- res = sensors_init(config_file);
+ fprintf(stderr,"Error initializing sensors: %s\n", sensors_strerror(res));
+ return 0;
+ }
- if(res != 0) {
- config_file = fopen("/usr/local/etc/sensors.conf", "r");
- res = sensors_init(config_file);
+ if(fclose(config_file))
+ perror("Error closing sensors.conf");
- if(res != 0) {
- fprintf(stderr,"%s\n", sensors_strerror(res));
- return 0;
- }
- }
- }
- fclose(config_file);
return 1;
}
@@ -937,3 +907,4 @@ int process_config(int argc, char **argv) {
return parse_ok;
}
+
diff --git a/wmgtemp.1 b/wmgtemp.1
old mode 100644
new mode 100755
index 64e8154..d584284
--- a/wmgtemp.1
+++ b/wmgtemp.1
@@ -106,9 +106,6 @@ You may toggle the displaying of a temperature on the graph by clicking on the c
.SS Temperature Scale Cycling
You may change the scale the temperatures are displayed in by clicking on either of the CPU or SYS scale indicators. The cycle order is \fBC\fP -> \fBK\fP -> \fBF\fP
.PP
-.SH SUPPORTED SENSORS
-VIA686A, W83781D, W83627HF, AS99127F, ADM1021
-.PP
.SH BUGS
Blank lines in the config file cause a Segmentation Fault.
.PP
--
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