mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-12 19:06:36 +00:00
* Improved hddtemp support
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1245 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
068f6b5b09
commit
4ca31d2ce4
@ -1,5 +1,8 @@
|
||||
# $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)
|
||||
|
@ -5344,7 +5344,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
#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) {
|
||||
@ -5353,7 +5353,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
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 == '*') {
|
||||
|
@ -120,11 +120,12 @@ char *get_hddtemp_info(char *dev, char *hostaddr, int port, char *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) {
|
||||
@ -137,6 +138,7 @@ char *get_hddtemp_info(char *dev, char *hostaddr, int port, char *unit)
|
||||
|
||||
/* No data available */
|
||||
if (i <= 0) {
|
||||
ERR("hddtemp had nothing for us");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -153,10 +155,12 @@ char *get_hddtemp_info(char *dev, char *hostaddr, int port, char *unit)
|
||||
} 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];
|
||||
@ -200,5 +204,6 @@ char *get_hddtemp_info(char *dev, char *hostaddr, int port, char *unit)
|
||||
}
|
||||
} while (0);
|
||||
close(sockfd);
|
||||
// printf("got: '%s'\n", r);
|
||||
return r;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user