|
|
@ -103,8 +103,9 @@ int main (int argc, char *argv[]) |
|
|
|
fprintf(stderr, "currently not discharging, cannot read power draw\n"); |
|
|
|
fprintf(stderr, "currently not discharging, cannot read power draw\n"); |
|
|
|
dead = 1; |
|
|
|
dead = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
fclose(tmf); |
|
|
|
free(tmp); |
|
|
|
free(tmp); |
|
|
|
strcat(path, "/energy_now"); |
|
|
|
strcat(path, "/power_now"); |
|
|
|
} else strcat(path, "/capacity"); |
|
|
|
} else strcat(path, "/capacity"); |
|
|
|
|
|
|
|
|
|
|
|
if ((fp = fopen(path, "r"))) { |
|
|
|
if ((fp = fopen(path, "r"))) { |
|
|
@ -135,6 +136,7 @@ int main (int argc, char *argv[]) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
long int elapsed_time = 0; |
|
|
|
long int elapsed_time = 0; |
|
|
|
|
|
|
|
long val; |
|
|
|
char buf[64]; |
|
|
|
char buf[64]; |
|
|
|
for (; !dead ; sleep(wait_time)) { |
|
|
|
for (; !dead ; sleep(wait_time)) { |
|
|
|
for (int i = 0; i < fp_num; i++) { |
|
|
|
for (int i = 0; i < fp_num; i++) { |
|
|
@ -144,8 +146,8 @@ int main (int argc, char *argv[]) |
|
|
|
} |
|
|
|
} |
|
|
|
if (!fgets(buf, 64, fp_list[i])) |
|
|
|
if (!fgets(buf, 64, fp_list[i])) |
|
|
|
dead = 1; |
|
|
|
dead = 1; |
|
|
|
buf[strcspn(buf, "\r\n")] = 0; |
|
|
|
val = atol(buf); |
|
|
|
fprintf(ofile_ptr, "%s\t", buf); |
|
|
|
fprintf(ofile_ptr, "%ld\t", wflag ? (long)(val / 1E3) : val); |
|
|
|
} |
|
|
|
} |
|
|
|
fprintf(ofile_ptr, "%ld\n", uflag ? time(NULL) : elapsed_time); |
|
|
|
fprintf(ofile_ptr, "%ld\n", uflag ? time(NULL) : elapsed_time); |
|
|
|
if (fflush(ofile_ptr)) { |
|
|
|
if (fflush(ofile_ptr)) { |
|
|
|