summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Sharma <harsh.sharma@multitech.com>2019-12-20 12:12:05 -0600
committerHarsh Sharma <harsh.sharma@multitech.com>2019-12-20 12:12:05 -0600
commit41f2282b2a80f772bf363e8127669377873627cb (patch)
tree90a8710f0069161a29417cf3c3c1af9c5a6ced4c
parent8ce2b9763c880084fd9d38fae6033e487fde58d9 (diff)
downloadmts-io-sysfs-41f2282b2a80f772bf363e8127669377873627cb.tar.gz
mts-io-sysfs-41f2282b2a80f772bf363e8127669377873627cb.tar.bz2
mts-io-sysfs-41f2282b2a80f772bf363e8127669377873627cb.zip
Bug fix for writing device_info.json
-rwxr-xr-xbuild/mts-io-sysfsbin0 -> 256608 bytes
-rw-r--r--include/General.h2
-rw-r--r--src/Device/Device.cpp10
-rw-r--r--src/Version.cpp2
4 files changed, 6 insertions, 8 deletions
diff --git a/build/mts-io-sysfs b/build/mts-io-sysfs
new file mode 100755
index 0000000..fb90f8d
--- /dev/null
+++ b/build/mts-io-sysfs
Binary files differ
diff --git a/include/General.h b/include/General.h
index 3e89c20..81f5a3d 100644
--- a/include/General.h
+++ b/include/General.h
@@ -67,7 +67,7 @@ typedef unsigned int uint; //32 bit - even on 64 bit machines
#define READ_ACCESS 0x00
#define SPI_SPEED 8000000
-
+#define DEVICE_INFO_FILE "/var/run/config/device_info.json"
#define RESET_SHORT_CMD "reset_short_handler"
#define RESET_LONG_CMD "reset_long_handler"
#define KILL_SIGNAL "kill -l "
diff --git a/src/Device/Device.cpp b/src/Device/Device.cpp
index 573e10b..bbfb189 100644
--- a/src/Device/Device.cpp
+++ b/src/Device/Device.cpp
@@ -410,13 +410,11 @@ void Device::writeJson() {
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
deviceInfo.Accept(writer);
- std::string json (buffer.GetString(), buffer.GetSize());
- std::ofstream of ("/var/run/config/device_info.json");
- of << json;
- if (!of.good()) {
- logError("Can't write to /var/run/config/device_info.json");
+ std::ofstream os(DEVICE_INFO_FILE);
+ if (!os) {
+ logError("Can't write to " + std::string(DEVICE_INFO_FILE));
exitHandler(99);
} else {
- exitHandler(0);
+ os << buffer.GetString();
}
}
diff --git a/src/Version.cpp b/src/Version.cpp
index 5585cc1..0786260 100644
--- a/src/Version.cpp
+++ b/src/Version.cpp
@@ -1,4 +1,4 @@
//Pre-Build Auto-Generated Source
#include "Version.h"
-const std::string Version::version("4.2.3-12-g42e11db");
+const std::string Version::version("v1.0.0");