fix can error. fix cmake plugin_install_dir
authorKevron Rees <tripzero.kev@gmail.com>
Sun, 3 Apr 2016 23:36:30 +0000 (16:36 -0700)
committerKevron Rees <tripzero.kev@gmail.com>
Sun, 3 Apr 2016 23:36:30 +0000 (16:36 -0700)
can: add bcm_timestamp conversion.  timeval to bcm_timeval conversion doesn't work with new gcc
cmake: Fix install path for plugins.  Was not being populated properly

CMakeLists.txt
lib/timestamp.cpp
lib/timestamp.h
plugins/common/cansocketbcm.cpp

index 26b4933..0fa62aa 100644 (file)
@@ -24,7 +24,7 @@ add_definitions(-DPROJECT_SERIES="${PROJECT_SERIES}")
 
 set (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
 set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" )
-set (PLUGIN_INSTALL_PATH "${LIB_INSTALL_DIR}/${PROJECT_NAME}")
+set (PLUGIN_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}")
 set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
 set (DOC_INSTALL_DIR "${CMAKE_INSTALL_DOCDIR}/${PROJECT_SERIES}")
 set (PLUGIN_SEGMENT_INSTALL_PATH "/${CMAKE_INSTALL_SYSCONFDIR}/ambd/plugins.d")
index 7b1f593..9c25902 100644 (file)
@@ -68,3 +68,8 @@ struct ::timeval amb::Timestamp::toTimeval(const double time)
 {
     return { (__time_t) time, (__suseconds_t)fmod(time*1e6, 1e6) };
 }
+
+struct ::bcm_timeval amb::Timestamp::toBcmTimeval(const double time)
+{
+    return { (long) time, (long)fmod(time*1e6, 1e6) };
+}
index 0e7d1b6..d654d3f 100644 (file)
@@ -2,6 +2,7 @@
 #define _TIMESTAMP_H___
 
 #include <time.h>
+#include <linux/can/bcm.h>
 
 namespace amb {
 
@@ -44,6 +45,8 @@ public:
     static double fromTimeval(const struct ::timeval& tv);
     static struct ::timeval toTimeval(const double time);
 
+    static struct ::bcm_timeval toBcmTimeval(const double time);
+
 public:
        /*!
         * \brief instance
index d923ce3..3e7c4a9 100644 (file)
@@ -255,8 +255,8 @@ bool CANSocketBCM::registerCyclicMessageForReceive(int canId, double minCycleTim
     hdr.flags = RX_FILTER_ID | RX_CHECK_DLC | SETTIMER | STARTTIMER | RX_ANNOUNCE_RESUME;
     hdr.nframes = 0;
     hdr.can_id = canId;
-    hdr.ival1 = amb::Timestamp::toTimeval(maxCycleTime);
-    hdr.ival2 = amb::Timestamp::toTimeval(minCycleTime);
+    hdr.ival1 = amb::Timestamp::toBcmTimeval(maxCycleTime);
+    hdr.ival2 = amb::Timestamp::toBcmTimeval(minCycleTime);
 
     // and write
     ssize_t nbytes = ::write(mSocket, &hdr, sizeof(hdr));