projects
/
breezed.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
00ff121
)
Fixed a bug for level 0 which must now be defined in the configuration file.
author
Francois Fleuret
<francois@fleuret.org>
Sun, 18 Apr 2010 09:58:55 +0000
(11:58 +0200)
committer
Francois Fleuret
<francois@fleuret.org>
Sun, 18 Apr 2010 09:58:55 +0000
(11:58 +0200)
breezed.c
patch
|
blob
|
history
diff --git
a/breezed.c
b/breezed.c
index
498df00
..
6c4895b
100644
(file)
--- a/
breezed.c
+++ b/
breezed.c
@@
-155,7
+155,7
@@
void define_temperature_thresholds(char *definition) {
exit(EXIT_FAILURE);
}
exit(EXIT_FAILURE);
}
- nb_temperature_thresholds =
1
;
+ nb_temperature_thresholds =
0
;
char *s, *u;
char *s, *u;
@@
-171,10
+171,8
@@
void define_temperature_thresholds(char *definition) {
speed_names =
safe_malloc(nb_temperature_thresholds * sizeof(char *));
speed_names =
safe_malloc(nb_temperature_thresholds * sizeof(char *));
- temperature_thresholds[0] = -1;
-
s = definition;
s = definition;
- int k =
1
;
+ int k =
0
;
while(s) {
s = next_word(token, s, buffer_size);
u = token;
while(s) {
s = next_word(token, s, buffer_size);
u = token;
@@
-197,6
+195,17
@@
void define_temperature_thresholds(char *definition) {
}
k++;
}
}
k++;
}
+
+ if(nb_temperature_thresholds <= 0) {
+ fprintf(stderr, "There has to be at least one temperature.\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if(temperature_thresholds[0] > 0) {
+ fprintf(stderr, "The lowest temperature has to be 0.\n");
+ exit(EXIT_FAILURE);
+ }
+
}
void evaluate_one_configuration_line(char *line, int line_number) {
}
void evaluate_one_configuration_line(char *line, int line_number) {
@@
-615,8
+624,10
@@
Written by Francois Fleuret (francois@fleuret.org).\n",
nb_rounds_since_last_change = 0;
last_level = new_level;
if(debug) {
nb_rounds_since_last_change = 0;
last_level = new_level;
if(debug) {
- printf("Temperature is %dC setting the fan level to %d.\n",
- temperature, new_level);
+ printf("Temperature is %dC setting the fan level to %d (%s).\n",
+ temperature,
+ new_level,
+ speed_names[new_level]);
}
}
}
}