powerguru-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Powerguru-commit] [SCM] powerguru branch, master, updated. 9ea361a5c966


From: Rob Savoye
Subject: [Powerguru-commit] [SCM] powerguru branch, master, updated. 9ea361a5c96634f8e730c33d0faa15ebf73a6ae6
Date: Wed, 19 Dec 2018 18:28:41 -0500 (EST)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "powerguru".

The branch, master has been updated
       via  9ea361a5c96634f8e730c33d0faa15ebf73a6ae6 (commit)
       via  73c2eaeacc427785fc3abbfa9ccdabe299481240 (commit)
       via  51d3a563ba37b8f5bb2ffc393ca3495ae7f0837b (commit)
       via  08754deac07e0a7a97b24f9ae9e5b6f93e0c94aa (commit)
       via  a31684342e5235147f241173e34c1be1540b9c91 (commit)
       via  4742759cba391a42952b8ee822c742e6785a8693 (commit)
      from  fb3adfaa19804d1dd4ba91d87b9e63777c681a4b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=9ea361a5c96634f8e730c33d0faa15ebf73a6ae6


commit 9ea361a5c96634f8e730c33d0faa15ebf73a6ae6
Author: Rob Savoye <address@hidden>
Date:   Wed Dec 19 16:28:35 2018 -0700

    Drop pdev namespace

diff --git a/daemon/threads.cc b/daemon/threads.cc
index f375b50..1dd05c0 100644
--- a/daemon/threads.cc
+++ b/daemon/threads.cc
@@ -130,7 +130,7 @@ client_handler(Tcpip &net)
 
 #ifdef BUILD_OWNET
 void
-ownet_handler(pdev::Ownet &ownet)
+ownet_handler(Ownet &ownet)
 {
     DEBUGLOG_REPORT_FUNCTION;
     dbglogfile << "PowerGuru - 1 Wire Mode" << std::endl;
@@ -141,15 +141,15 @@ ownet_handler(pdev::Ownet &ownet)
     query += "";
     query += ");";
 
-    std::map<std::string, pdev::ownet_t *> sensors = ownet.getSensors();
-    std::map<std::string, pdev::ownet_t *>::iterator it;
+    std::map<std::string, ownet_t *> sensors = ownet.getSensors();
+    std::map<std::string, ownet_t *>::iterator it;
     while (ownet.getPollSleep() != 0) {
         for (it = sensors.begin(); it != sensors.end(); it++) {
             if (it->second->family == "10") {
                 ownet.getTemperature(it->first.c_str());
             }
         }
-        //ownet.dump();
+        ownet.dump();
         
         // Don't eat up all the cpu cycles!
         
std::this_thread::sleep_for(std::chrono::seconds(ownet.getPollSleep()));
@@ -159,7 +159,7 @@ ownet_handler(pdev::Ownet &ownet)
 
 #ifdef BUILD_OUTBACK
 void
-outback_handler(pdev::Ownet &ownet)
+outback_handler(Ownet &ownet)
 {
     DEBUGLOG_REPORT_FUNCTION;
 
@@ -171,7 +171,7 @@ outback_handler(pdev::Ownet &ownet)
 
 #ifdef BUILD_XANTREX
 void
-xantrex_handler(pdev::Ownet &ownet)
+xantrex_handler(Ownet &ownet)
 {
     DEBUGLOG_REPORT_FUNCTION;
 

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=73c2eaeacc427785fc3abbfa9ccdabe299481240


commit 73c2eaeacc427785fc3abbfa9ccdabe299481240
Author: Rob Savoye <address@hidden>
Date:   Wed Dec 19 16:27:54 2018 -0700

    Fix empty read buffer

diff --git a/client/threads.cc b/client/threads.cc
index e5a9de8..a554bc2 100644
--- a/client/threads.cc
+++ b/client/threads.cc
@@ -120,7 +120,7 @@ daemon_handler(Tcpip &net)
                 }
                 // Store the pointer to the data to make the code easier to 
read.
                 std::string buffer = (char *)data.data();
-                // Check to see if the sock was closed, so the read failed.
+                // Check to see if the socket was closed, so the read failed.
                 if (buffer[0] == 255) {
                     std::cerr << "Done!!!!" << std::endl;
                     loop = false;
@@ -137,7 +137,14 @@ daemon_handler(Tcpip &net)
                     sleep(1);
                     continue;
                 }
-                buffer.erase(buffer.find('\n')-1);
+                size_t pos = buffer.find('\n');
+                if (pos == 0 || pos == std::string::npos) {
+                    data.clear();
+                    buffer.clear();
+                    loop = false;
+                    continue;
+                }
+                buffer.erase(pos);
                 // if the first character is a <, assume it's in XML formst.
                 if (buffer[0] == '<') {
                     XML xml;

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=51d3a563ba37b8f5bb2ffc393ca3495ae7f0837b


commit 51d3a563ba37b8f5bb2ffc393ca3495ae7f0837b
Author: Rob Savoye <address@hidden>
Date:   Wed Dec 19 16:26:45 2018 -0700

    Add libpdev to the link

diff --git a/client/Makefile.am b/client/Makefile.am
index a6d72fc..565a735 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -1,6 +1,6 @@
 # 
-# Copyright (C) 2005, 2006, 2007, 2008,        2009, 2010, 2011
-#      Free Software Foundation, Inc.
+# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
+# 2014, 2015, 2016, 2017, 2018 Free Software Foundation, Inc.
 # 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -25,6 +25,12 @@ pguru_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/devices
 
 pguru_SOURCES = cmd.cc threads.cc
 pguru_LDADD = ../lib/libpguru.la -lpthread -ldl
+# Use a GCC specs file to add our configured sysroot path before the
+# one specified by GCC to work around a problem when trying to
+# link executables fot the Raspberry PI using the normal cross gcc
+# packaged by the distribution.
+# FIXME: this is a work in progress
+# pguru_LDFLAGS = -specs=`cd $(top_srcdir) && pwd`/cross.spec
 
 if BUILD_LIBXML
 pguru_CPPFLAGS += $(LIBXML_CPPFLAGS)
@@ -36,7 +42,7 @@ pguru_LDADD += ../snmp/libpgsnmp.la $(SNMP_LIBS)
 endif
 
 if BUILD_OWNET
-pguru_LDADD += $(OWNET_LIBS)
+pguru_LDADD += ../devices/libpdev.la $(OWNET_LIBS)
 endif
 
 if BUILD_POSTGRESQL

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=08754deac07e0a7a97b24f9ae9e5b6f93e0c94aa


commit 08754deac07e0a7a97b24f9ae9e5b6f93e0c94aa
Author: Rob Savoye <address@hidden>
Date:   Wed Dec 19 16:25:30 2018 -0700

    Drop using a pdev namespace

diff --git a/devices/ownet.cc b/devices/ownet.cc
index ca2169f..01a68c5 100644
--- a/devices/ownet.cc
+++ b/devices/ownet.cc
@@ -27,28 +27,113 @@
 
 extern LogFile dbglogfile;
 
-namespace pdev {
+Ownet::Ownet(void) {
+    DEBUGLOG_REPORT_FUNCTION;
 
-#if 0
-//Ownet::~Ownet(void) {
-//    OW_finish();
-//};
+    dbglogfile << "Trying to connect to the owserver" << std::endl;
+    char *buf = 0;
+    size_t s  = 0;
 
-void
-Ownet::dump(void) {
-    DEBUGLOG_REPORT_FUNCTION;
-    std::map<std::string, ownet_t>::iterator it;
+    //OW_init("/dev/ttyS0");
+    int count = 5;
+    while (count-- > 0) {
+        if (OW_init("192.168.0.50:4304") < 0) {
+            dbglogfile << "WARNING: Couldn't connect to owserver!" << 
std::endl;
+            //return;
+        } else {
+            dbglogfile << "Connected to owserver." << std::endl;
+            _owserver = true;
+            break;
+        }
+    }
+    // 0=mixed  output,  1=syslog, 2=console.
+    OW_set_error_print("2");
+    // (0=default, 1=err_connect, 2=err_call, 3=err_data, 4=err_detail,
+    // 5=err_debug, 6=err_beyond)
+    OW_set_error_level("4");
+    OW_get("/", &buf, &s);
+    // buf looks like:
+    // 
10.67C6697351FF/,05.4AEC29CDBAAB/,bus.0/,uncached/,settings/,system/,statistics/,structure/,simultaneous/,alarm/
+    //
+    //if (s <= 0) {
+    //    dbglogfile << "S: " << (int)s << std::endl;
+    // return;
+    //}
 
-    for (it = _sensors.begin(); it != _sensors.end(); it++) {
-        dbglogfile << "Data for device: " << it->first << std::endl;
-        dbglogfile << "\tfamily: " << it->second.family << std::endl;
-        dbglogfile << "\ttype: " << it->second.type << std::endl;
-        dbglogfile << "\tid: " << it->second.id << std::endl;
+    std::vector<std::string> results;
+    if (buf != 0) {
+        boost::split(results, buf, boost::is_any_of(","));
+        free(buf);
+        s = 0;
+        if( results.size() <= 0) {
+            return;
+        }
     }
-}
+
+#ifdef HAVE_LIBPQ
+    if (!pdb.openDB()) {
+        dbglogfile << "ERROR: Couldn't open database!" << std::endl;
+        exit(1);
+    }
+#endif
+
+    int i = 0;
+    std::vector<std::string>::iterator it;
+    for(it = results.begin(); it != results.end(); it++,i++ ) {
+        ownet_t *data = new ownet_t[1];
+        data->family = getValue(it->c_str(), "family");
+        data->type = getValue(it->c_str(), "type");
+        data->id = getValue(it->c_str(), "id");
+        if (data->type.length() == 0 || data->id.length() == 0) {
+            break;
+        }
+        std::string dev = *it + "temperature";
+        if (OW_present(dev.c_str()) == 0) {
+            dbglogfile << "Temperature sensor found: " << *it << std::endl;
+            temperature_t *temp = new temperature_t[1];
+            memset(temp, 0, sizeof(temperature_t));
+            temp->temp = std::stof(getValue(*it, "temperature"));
+            temp->lowtemp = std::stof(getValue(*it, "templow"));
+            temp->hightemp = std::stof(getValue(*it, "temphigh"));
+            _temperatures[*it] = temp;
+
+            std::string stamp;
+#ifdef HAVE_LIBPQ
+            stamp = pdb.gettime(stamp);
+            std::string query = data->family + ',';
+            query += "\'" + data->id;
+            query += "\', \'" + data->type;
+            query += "\', \'" + stamp;
+            query += "\', " + std::to_string(temp->temp);
+            query += ", " + std::to_string(temp->lowtemp);
+            query +=  ", " + std::to_string(temp->hightemp);
+            pdb.queryInsert(query);
 #endif
+        } else {
+            dbglogfile << "Temperature sensor not found!" << std::endl;
+        }
+        std::lock_guard<std::mutex> guard(_mutex);
+        _sensors[*it] = data;
+    }
+}
+
+void Ownet::dump(void) {
+    DEBUGLOG_REPORT_FUNCTION;
 
-} // end of namespace
+    std::map<std::string, ownet_t *>::iterator sit;
+    for (sit = _sensors.begin(); sit != _sensors.end(); sit++) {
+        std::cout << "Data for device: " << sit->first << std::endl;
+        std::cout << "\tfamily: " << sit->second->family << std::endl;
+        std::cout << "\ttype: " << sit->second->type << std::endl;
+        std::cout << "\tid: " << sit->second->id << std::endl;
+    }
+    std::map<std::string, temperature_t *>::iterator tit;
+    for (tit = _temperatures.begin(); tit != _temperatures.end(); tit++) {
+        std::cout << "\tCurrent temperature: " << tit->second->temp << 
std::endl;
+        std::cout << "\tLow temperture: " << tit->second->lowtemp << std::endl;
+        std::cout << "\tHigh Temperature: " << tit->second->hightemp << 
std::endl;
+    }
+}
 
 // local Variables:
 // mode: C++
diff --git a/devices/ownet.h b/devices/ownet.h
index 4829984..50e7a58 100644
--- a/devices/ownet.h
+++ b/devices/ownet.h
@@ -35,8 +35,6 @@
 
 extern LogFile dbglogfile;
 
-namespace pdev {
-
 struct ownet {
     std::string family;
     std::string id;
@@ -62,6 +60,10 @@ private:
     Database pdb;
 #endif
 public:
+    Ownet(void);
+    ~Ownet(void) {
+        OW_finish();
+    };
     //
     // Thread have a polling frequency to avoid eating up all the cpu cycles
     // by polling to quickly.
@@ -125,7 +127,7 @@ public:
         std::string type = getValue(device, "type");
 
         temperature_t *temp = 0;
-        if (family == "10") {
+        if (family == "10" | family == "28") {
             // dbglogfile << device << " is a thermometer" << std::endl;
             temp = new temperature_t[1];
             temp->temp = std::stof(getValue(device, "temperature"));
@@ -153,7 +155,9 @@ public:
         return temp;
     }
 
-    void dump(void) {
+    void dump(void);
+#if 0
+        {
         DEBUGLOG_REPORT_FUNCTION;
 
         std::map<std::string, ownet_t *>::iterator sit;
@@ -170,7 +174,8 @@ public:
             std::cout << "\tHigh Temperature: " << tit->second->hightemp << 
std::endl;
         }
     }
-
+#endif
+    
     std::vector<std::string> &
     listDevices(std::vector<std::string> &list) {
         DEBUGLOG_REPORT_FUNCTION;
@@ -183,107 +188,8 @@ public:
         return list;
     }
 
-    Ownet(void) {
-        DEBUGLOG_REPORT_FUNCTION;
-
-        dbglogfile << "Trying to connect to the owserver" << std::endl;
-        char *buf = 0;
-        size_t s  = 0;
-
-        //OW_init("/dev/ttyS0");
-        int count = 5;
-        while (count-- > 0) {
-            if (OW_init("localhost:4304") < 0) {
-                dbglogfile << "WARNING: Couldn't connect to owserver!" << 
std::endl;
-                //return;
-            } else {
-                dbglogfile << "Connected to owserver." << std::endl;
-                _owserver = true;
-                break;
-            }
-        }
-        // 0=mixed  output,  1=syslog, 2=console.
-        OW_set_error_print("1");
-        // (0=default, 1=err_connect, 2=err_call, 3=err_data, 4=err_detail,
-        // 5=err_debug, 6=err_beyond)
-        OW_set_error_level("4");
-        OW_get("/", &buf, &s);
-        // buf looks like:
-        // 
10.67C6697351FF/,05.4AEC29CDBAAB/,bus.0/,uncached/,settings/,system/,statistics/,structure/,simultaneous/,alarm/
-        //
-        //if (s <= 0) {
-        //    dbglogfile << "S: " << (int)s << std::endl;
-            // return;
-        //}
-
-        std::vector<std::string> results;
-        if (buf != 0) {
-            boost::split(results, buf, boost::is_any_of(","));
-            free(buf);
-            s = 0;
-            if( results.size() <= 0) {
-                return;
-            }
-        }
-
-#ifdef HAVE_LIBPQ
-        if (!pdb.openDB()) {
-            dbglogfile << "ERROR: Couldn't open database!" << std::endl;
-            exit(1);
-        }
-#endif
-
-        int i = 0;
-        std::vector<std::string>::iterator it;
-        for(it = results.begin(); it != results.end(); it++,i++ ) {
-            ownet_t *data = new ownet_t[1];
-            data->family = getValue(it->c_str(), "family");
-            data->type = getValue(it->c_str(), "type");
-            data->id = getValue(it->c_str(), "id");
-            if (data->type.length() == 0 || data->id.length() == 0) {
-                break;
-            }
-            std::string dev = *it + "temperature";
-            if (OW_present(dev.c_str()) == 0) {
-                dbglogfile << "Temperature sensor found: " << *it << std::endl;
-                temperature_t *temp = new temperature_t[1];
-                memset(temp, 0, sizeof(temperature_t));
-                temp->temp = std::stof(getValue(*it, "temperature"));
-                temp->lowtemp = std::stof(getValue(*it, "templow"));
-                temp->hightemp = std::stof(getValue(*it, "temphigh"));
-                _temperatures[*it] = temp;
-
-                std::string stamp;
-#ifdef HAVE_LIBPQ
-                stamp = pdb.gettime(stamp);
-                std::string query = data->family + ',';
-                query += "\'" + data->id;
-                query += "\', \'" + data->type;
-                query += "\', \'" + stamp;
-                query += "\', " + std::to_string(temp->temp);
-                query += ", " + std::to_string(temp->lowtemp);
-                query +=  ", " + std::to_string(temp->hightemp);
-                pdb.queryInsert(query);
-#endif
-            } else {
-                dbglogfile << "Temperature sensor not found!" << std::endl;
-            }
-            std::lock_guard<std::mutex> guard(_mutex);
-            _sensors[*it] = data;
-        }
-    }
-
-//    ~Ownet(void);
-
-    ~Ownet(void) {
-        OW_finish();
-    };
-
 };
 
-// end of namespace pdev
-}
-
 // __OWNET_H__
 #endif
 

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=a31684342e5235147f241173e34c1be1540b9c91


commit a31684342e5235147f241173e34c1be1540b9c91
Author: Rob Savoye <address@hidden>
Date:   Wed Dec 19 16:25:01 2018 -0700

    Add -pipe for armv6cross builds

diff --git a/configure.ac b/configure.ac
index 104d133..1a82c2b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,10 +139,9 @@ dnl flags to generate an executable for the ARMv6.
 arch="`${CC} -v |& grep -o -- "--with-arch[[0-9\-]]*=[[a-z0-9\-]]*" | head -1 
| cut -d '=' -f 2`"
 case ${arch} in
      armv5te|armv7-a)
-dnl            CXXFLAGS="${CXXFLAGS} -march=armv6 -mfpu=vfp -mfloat-abi=hard"
-        CXXFLAGS="${CXXFLAGS} -marm -mfpu=vfp -mfloat-abi=hard"
-       ;;
-     armv6z) ;;
+        CXXFLAGS="${CXXFLAGS} -marm -mfpu=vfp -mfloat-abi=hard -pipe" ;;
+     armv6*)
+        CXXFLAGS="${CXXFLAGS} -pipe" ;;
      *) ;;
 esac
 gcc_sysroot=""
@@ -165,9 +164,9 @@ if test x"${cross_compiling}" = xyes; then
   for i in ${gcc_sysroot} ${sysroot}; do
     if test ! -d ${i}/usr && ! -d ${i}/usr/include; then
       AC_MSG_ERROR([Specified sysroot \"${i}\" doesn't exist!])
-      AC_MSG_RESULT(["not found"])
+      AC_MSG_RESULT([not found])
     else
-      AC_MSG_RESULT(["found"])
+      AC_MSG_RESULT([found])
     fi
   done
 

http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=4742759cba391a42952b8ee822c742e6785a8693


commit 4742759cba391a42952b8ee822c742e6785a8693
Author: Rob Savoye <address@hidden>
Date:   Wed Dec 19 16:24:24 2018 -0700

    Add debug config dump

diff --git a/Makefile.am b/Makefile.am
index c637f98..cd9479f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -78,6 +78,11 @@ EXTRA_DIST = \
 #        done \
 #      fi
 
+# Install executables into qemu, which we do a lot when experimenting with
+# toolchains and cross compiing something that actually works.
+install-bin:
+       rsync -avrp -e "ssh -p 5022" client/pguru daemon/pgd localhost:/tmp/
+
 # Build an RPM package
 rpm redhat: dist-gzip $(srcdir)/rpm/powerguru.spec
        cp -f $(srcdir)/rpm/powerguru.spec /usr/src/redhat/SPECS/
@@ -122,3 +127,11 @@ endif
 if BUILD_OWNET
        @echo " Building with 1-Wire support"
 endif
+if BUILD_CROSS
+       @echo " Dumping compiler data for ${CXX}"
+       @echo " Default search dirs:"
+       @${CXX} -print-search-dirs
+       @echo " Default sysroot: `${CXX} -print-sysroot`"
+       @echo " User supplied sysroot: $(sysroot)"
+       @echo " Libc.so is from here: `${CXX} -print-file-name=libc.so`"
+endif

-----------------------------------------------------------------------

Summary of changes:
 Makefile.am        |  13 ++++++
 client/Makefile.am |  12 ++++--
 client/threads.cc  |  11 ++++-
 configure.ac       |  11 +++--
 daemon/threads.cc  |  12 +++---
 devices/ownet.cc   | 117 +++++++++++++++++++++++++++++++++++++++++++++--------
 devices/ownet.h    | 114 +++++----------------------------------------------
 7 files changed, 153 insertions(+), 137 deletions(-)


hooks/post-receive
-- 
powerguru



reply via email to

[Prev in Thread] Current Thread [Next in Thread]