mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-27 09:08:25 +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$
|
# $Id$
|
||||||
|
|
||||||
|
2008-09-10
|
||||||
|
* Improved hddtemp support
|
||||||
|
|
||||||
2008-09-07
|
2008-09-07
|
||||||
* Fixed bug with freq_dyn on x86_64 (thanks Miroslav)
|
* Fixed bug with freq_dyn on x86_64 (thanks Miroslav)
|
||||||
* Fixed buffer overflow in update_net_stats() (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
|
#endif
|
||||||
#ifdef HDDTEMP
|
#ifdef HDDTEMP
|
||||||
OBJ(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,
|
char *str = get_hddtemp_info(obj->data.hddtemp.dev,
|
||||||
obj->data.hddtemp.addr, obj->data.hddtemp.port, &obj->data.hddtemp.unit);
|
obj->data.hddtemp.addr, obj->data.hddtemp.port, &obj->data.hddtemp.unit);
|
||||||
if (str) {
|
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.temp[0] = 0;
|
||||||
}
|
}
|
||||||
obj->data.hddtemp.update_time = current_update_time;
|
obj->data.hddtemp.update_time = current_update_time;
|
||||||
}
|
// }
|
||||||
if (!obj->data.hddtemp.temp) {
|
if (!obj->data.hddtemp.temp) {
|
||||||
snprintf(p, p_max_size, "N/A");
|
snprintf(p, p_max_size, "N/A");
|
||||||
} else if (obj->data.hddtemp.unit == '*') {
|
} 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_ZERO(&rfds);
|
||||||
FD_SET(sockfd, &rfds);
|
FD_SET(sockfd, &rfds);
|
||||||
|
|
||||||
/* We're going to wait up to a quarter a second to see whether there's
|
/* We're going to wait up to a half second to see whether there's any
|
||||||
* any data available. Polling with timeout set to 0 doesn't seem to work
|
* data available. Polling with timeout set to 0 doesn't seem to work
|
||||||
* with hddtemp. */
|
* with hddtemp.
|
||||||
|
*/
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
tv.tv_usec = 250000;
|
tv.tv_usec = 500000;
|
||||||
|
|
||||||
i = select(sockfd + 1, &rfds, NULL, NULL, &tv);
|
i = select(sockfd + 1, &rfds, NULL, NULL, &tv);
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
@ -137,6 +138,7 @@ char *get_hddtemp_info(char *dev, char *hostaddr, int port, char *unit)
|
|||||||
|
|
||||||
/* No data available */
|
/* No data available */
|
||||||
if (i <= 0) {
|
if (i <= 0) {
|
||||||
|
ERR("hddtemp had nothing for us");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,10 +155,12 @@ char *get_hddtemp_info(char *dev, char *hostaddr, int port, char *unit)
|
|||||||
} while (i > 0 && p < buf + BUFLEN - 1);
|
} while (i > 0 && p < buf + BUFLEN - 1);
|
||||||
|
|
||||||
if (len < 2) {
|
if (len < 2) {
|
||||||
|
ERR("hddtemp returned nada");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
|
// printf("read: '%s'\n", buf);
|
||||||
|
|
||||||
/* The first character read is the separator. */
|
/* The first character read is the separator. */
|
||||||
sep = buf[0];
|
sep = buf[0];
|
||||||
@ -200,5 +204,6 @@ char *get_hddtemp_info(char *dev, char *hostaddr, int port, char *unit)
|
|||||||
}
|
}
|
||||||
} while (0);
|
} while (0);
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
|
// printf("got: '%s'\n", r);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user