* Improved hddtemp support
authorBrenden Matthews <brenden1@rty.ca>
Thu, 11 Sep 2008 03:21:39 +0000 (03:21 +0000)
committerBrenden Matthews <brenden1@rty.ca>
Thu, 11 Sep 2008 03:21:39 +0000 (03:21 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1245 7f574dfc-610e-0410-a909-a81674777703

ChangeLog
src/conky.c
src/hddtemp.c

index 67916a2..1f8bf07 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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)
index f30f6ee..d416260 100644 (file)
@@ -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 == '*') {
index f586349..22566ba 100644 (file)
@@ -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;
 }