summaryrefslogtreecommitdiff
path: root/riff
diff options
context:
space:
mode:
authorSrimanta Panda <srimanta.panda@stericsson.com>2012-05-28 11:13:20 +0200
committerSrimanta Panda <srimanta.panda@stericsson.com>2012-05-28 11:13:20 +0200
commit09d76a99fe7837c38454e213bb82e01873c61e2b (patch)
treeee39cd60e6ebde353f03f91de09f17c0eddab486 /riff
parent7b1ae2029ad33a38e1e718a33e2879325b389332 (diff)
Improved error messages in riff
A clear error message is displayed when RIFF fails because of an error from LCD library. RIFF displays an error description related to the error number received from LCD.
Diffstat (limited to 'riff')
-rw-r--r--riff/DUT.cpp16
-rw-r--r--riff/DUT.h4
-rw-r--r--riff/InitializeDut.cpp32
-rw-r--r--riff/InitializeDut.h1
-rw-r--r--riff/ProcessRawImage.cpp2
-rw-r--r--riff/main.cpp2
6 files changed, 46 insertions, 11 deletions
diff --git a/riff/DUT.cpp b/riff/DUT.cpp
index 747727d..e48b7f1 100644
--- a/riff/DUT.cpp
+++ b/riff/DUT.cpp
@@ -60,6 +60,7 @@ DUT::~DUT()
if (0 != error) {
logger_.log(Logger::ERR, "LCD ERROR: Failed to destroy LCD context %d", error);
+ displayLCDError(error);
} else {
logger_.log(Logger::INFO, "LCD context destroyed successfully");
}
@@ -96,6 +97,7 @@ void DUT::executeSequence()
if ((error != 0) && (!strcmp((*i)->get_command_name(), "INITIALIZE_DUT"))) {
errorcode_ = error;
} else if ((error != 0) && (strcmp((*i)->get_command_name(), "SHUTDOWN"))) {
+ displayLCDError(error);
continue;
}
@@ -112,4 +114,18 @@ void* DUT::ExecutionThreadFunction(void* arg)
return 0;
}
+void DUT::displayLCDError(uint32 errorno)
+{
+ char ShortDescription[MAX_LCD_SHORTDESC], LongDescription[MAX_LCD_LONGDESC];
+
+ memset(LongDescription, 0x00, MAX_LCD_LONGDESC);
+ memset(ShortDescription, 0x00, MAX_LCD_SHORTDESC);
+ GetLoaderErrorDescription(errorno, (uint8 *)ShortDescription, (uint8 *)LongDescription, MAX_LCD_SHORTDESC, MAX_LCD_LONGDESC);
+ if (strlen(LongDescription) != 0) {
+ logger_.log(Logger::ERR, "LCD ERROR %d : %s", errorno, LongDescription);
+ }
+
+ return;
+}
+
/* @} */
diff --git a/riff/DUT.h b/riff/DUT.h
index 98ddd1b..2303458 100644
--- a/riff/DUT.h
+++ b/riff/DUT.h
@@ -27,6 +27,9 @@
#include <string>
#include <vector>
+#define MAX_LCD_LONGDESC 512
+#define MAX_LCD_SHORTDESC 128
+
/**
* @brief Class that wraps all parameters related to the connected device.
*
@@ -118,6 +121,7 @@ private:
bool shutdown_;
static void* ExecutionThreadFunction(void* arg);
void executeSequence();
+ void displayLCDError(uint32 errorno);
};
/* @} */
diff --git a/riff/InitializeDut.cpp b/riff/InitializeDut.cpp
index 9088c13..97522a4 100644
--- a/riff/InitializeDut.cpp
+++ b/riff/InitializeDut.cpp
@@ -378,18 +378,18 @@ int InitializeDut::run(DUT* dut)
error = initializeHardware(commDevice);
if (0 != error)
{
- logger_.log(Logger::ERR,"LCD ERROR: Error while initializing device %d", error);
+ logger_.log(Logger::ERR,"ERROR: Error while initializing device %d", error);
return error;
}
- logger_.log(Logger::INFO, "Initializing finished");
+ logger_.log(Logger::INFO, "Hardware Initialization finished");
logger_.log(Logger::INFO, "Starting initialization of LCD...");
void** deviceObjectStorage = comm_get_object_storage(commDevice);
error = CreateContext(&lcdContext, dut->getId());
if (0 != error)
{
- logger_.log(Logger::ERR,"LCD ERROR: Error while creating LCD context %d", error);
+ displayLCDError("Error while creating LCD context", error);
return error;
}
@@ -397,7 +397,7 @@ int InitializeDut::run(DUT* dut)
error = ConfigureCommunicationDevice(lcdContext, (void*)comm_read_nowait, (void*)comm_write_nowait, (void*)comm_cancel);
if (0 != error)
{
- logger_.log(Logger::ERR,"LCD ERROR: Error while configuring communication device %d", error);
+ displayLCDError("Error while configuring communication device", error);
return error;
}
@@ -405,15 +405,14 @@ int InitializeDut::run(DUT* dut)
error = SwitchProtocolFamily(lcdContext, R15_PROTOCOL_FAMILY);
if (0 != error)
{
- logger_.log(Logger::ERR,"LCD ERROR: Error while setting protocol family %d", error);
+ displayLCDError("Error while setting protocol family", error);
return error;
}
-
error = StartContext(lcdContext, deviceObjectStorage);
if (0 != error)
{
- logger_.log(Logger::ERR,"LCD ERROR: Error while starting LCD context %d", error);
+ displayLCDError("Error while starting LCD context", error);
return error;
}
@@ -422,7 +421,7 @@ int InitializeDut::run(DUT* dut)
error = SetProgressCallback(lcdContext, (void*)comm_progress);
if (0 != error)
{
- logger_.log(Logger::ERR,"LCD ERROR: Error while setting Progress listener %d", error);
+ displayLCDError("Error while setting Progress listener", error);
return error;
}
@@ -431,7 +430,7 @@ int InitializeDut::run(DUT* dut)
error = System_LoaderStartupStatus(dut->getLCDContext(), version, &versionSize, protocol, &protocolSize);
if (0 != error)
{
- logger_.log(Logger::ERR,"LCD ERROR: Failed to receive loader startup status %d", error);
+ displayLCDError("Failed to receive loader startup status", error);
return error;
}
@@ -449,4 +448,19 @@ const char * InitializeDut::get_command_name()
return (char *)"INITIALIZE_DUT";
}
+void InitializeDut::displayLCDError(const char* message, uint32 errorno)
+{
+ char ShortDescription[MAX_LCD_SHORTDESC], LongDescription[MAX_LCD_LONGDESC];
+
+ logger_.log(Logger::ERR,"LCD ERROR: %s %d", message, errorno);
+
+ memset(LongDescription, 0x00, MAX_LCD_LONGDESC);
+ memset(ShortDescription, 0x00, MAX_LCD_SHORTDESC);
+ GetLoaderErrorDescription(errorno, (uint8 *)ShortDescription, (uint8 *)LongDescription, MAX_LCD_SHORTDESC, MAX_LCD_LONGDESC);
+ if (strlen(LongDescription) != 0)
+ logger_.log(Logger::ERR, "LCD ERROR %d : %s", errorno, LongDescription);
+
+ return;
+}
+
/* @} */
diff --git a/riff/InitializeDut.h b/riff/InitializeDut.h
index 6e0ab31..b4e2829 100644
--- a/riff/InitializeDut.h
+++ b/riff/InitializeDut.h
@@ -79,6 +79,7 @@ private:
int readMeminitFile(char* buf);
int readNormal(char* buf);
int initializeHardware(Device_t device);
+ void displayLCDError(const char* message, uint32 errorno);
};
diff --git a/riff/ProcessRawImage.cpp b/riff/ProcessRawImage.cpp
index e95c5af..716b2b4 100644
--- a/riff/ProcessRawImage.cpp
+++ b/riff/ProcessRawImage.cpp
@@ -55,7 +55,7 @@ int ProcessRawImage::run(DUT* dut)
logger_.log(Logger::PROGRESS, "Flashing finished successfully");
} else {
error = -1;
- logger_.log(Logger::ERR,"LCD ERROR: Flash image is empty or doesn't exist %d", error);
+ logger_.log(Logger::ERR,"ERROR: Flash image is empty or doesn't exist %d", error);
return error;
}
diff --git a/riff/main.cpp b/riff/main.cpp
index ab7426f..371d91a 100644
--- a/riff/main.cpp
+++ b/riff/main.cpp
@@ -30,7 +30,7 @@ volatile bool isDone = false;
const string info = \
"\n \
----------------------- riff - Raw Image File Flasher -------------------------\n \
-Version: 0.5.0\n \
+Version: 0.5.1\n \
"
"Flash a device. Try `riff --help' for more information. \n \
"