return 0;
}
-static int digitemp_parser(char *data, const char **p)
-{
- const char digitemp_cmd[] = "/usr/bin/digitemp";
- char *const digitemp_args[] = { "", "-o2", "-a", "-q", 0 };
- FILE *readf;
- int pid, ret;
- float t1 = 0, t2 = 0, t3 = 0;
- char buf[1024];
-
- pid = run_piped_stream(digitemp_cmd, digitemp_args, 0, &readf, 0);
- if (pid < 0) {
- pr_err("Failed to parse digitemp\n");
- sprintf(data, "U:U");
- return -1;
- }
-
- ret = fscanf(readf, "%f %f %f", &t1, &t2, &t3);
-
- if (ret != 3) {
- pr_err("Failed to parse digitemp output: %m\n");
- sprintf(data, "U:U");
- return 1;
- }
-
- t2 += 2.16;
- t3 += -0.44;
-
- /* Read whatever the process might be still printing out */
- while (fgets(buf, 1024, readf));
-
- clear_zombie(pid);
- snprintf(data, RRD_DATA_MAX_LEN, "%.2f:%.2f", t3, t2);
- return 0;
-}
-
-static int digitemp_parser_mod(char *data, const char **p)
-{
- char buf[1024];
- int ret;
-
- ret = digitemp_parser(buf, p);
- snprintf(data, RRD_DATA_MAX_LEN, "U:%s", buf);
-
- return ret;
-}
-
/* Run a command and feed the output from stdout directly to rrdtool */
static int script_parser(char *rrd_data, const char **parser_data)
{
.name = "cpu_mem",
.parse = cpu_mem_parser,
},
- {
- .name = "digitemp",
- .parse = digitemp_parser,
- },
- {
- .name = "digitemp_mod",
- .parse = digitemp_parser_mod,
- },
{
.name = "script",
.parse = script_parser,