From 41f2282b2a80f772bf363e8127669377873627cb Mon Sep 17 00:00:00 2001 From: Harsh Sharma Date: Fri, 20 Dec 2019 12:12:05 -0600 Subject: Bug fix for writing device_info.json --- build/mts-io-sysfs | Bin 0 -> 256608 bytes include/General.h | 2 +- src/Device/Device.cpp | 10 ++++------ src/Version.cpp | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) create mode 100755 build/mts-io-sysfs diff --git a/build/mts-io-sysfs b/build/mts-io-sysfs new file mode 100755 index 0000000..fb90f8d Binary files /dev/null and b/build/mts-io-sysfs 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 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"); -- cgit v1.2.3