# $Id$
+2008-09-10
+ * Improved hddtemp support
+
2008-09-07
* Fixed bug with freq_dyn on x86_64 (thanks Miroslav)
* Fixed buffer overflow in update_net_stats() (thanks Miroslav)
#endif
#ifdef HDDTEMP
OBJ(hddtemp) {
- if (obj->data.hddtemp.update_time < current_update_time - 30) {
+// if (obj->data.hddtemp.update_time < current_update_time - 30) {
char *str = get_hddtemp_info(obj->data.hddtemp.dev,
obj->data.hddtemp.addr, obj->data.hddtemp.port, &obj->data.hddtemp.unit);
if (str) {
obj->data.hddtemp.temp[0] = 0;
}
obj->data.hddtemp.update_time = current_update_time;
- }
+// }
if (!obj->data.hddtemp.temp) {
snprintf(p, p_max_size, "N/A");
} else if (obj->data.hddtemp.unit == '*') {
FD_ZERO(&rfds);
FD_SET(sockfd, &rfds);
- /* We're going to wait up to a quarter a second to see whether there's
- * any data available. Polling with timeout set to 0 doesn't seem to work
- * with hddtemp. */
+ /* We're going to wait up to a half second to see whether there's any
+ * data available. Polling with timeout set to 0 doesn't seem to work
+ * with hddtemp.
+ */
tv.tv_sec = 0;
- tv.tv_usec = 250000;
+ tv.tv_usec = 500000;
i = select(sockfd + 1, &rfds, NULL, NULL, &tv);
if (i == -1) {
/* No data available */
if (i <= 0) {
+ ERR("hddtemp had nothing for us");
break;
}
} while (i > 0 && p < buf + BUFLEN - 1);
if (len < 2) {
+ ERR("hddtemp returned nada");
break;
}
buf[len] = 0;
+// printf("read: '%s'\n", buf);
/* The first character read is the separator. */
sep = buf[0];
}
} while (0);
close(sockfd);
+// printf("got: '%s'\n", r);
return r;
}