From 09d76a99fe7837c38454e213bb82e01873c61e2b Mon Sep 17 00:00:00 2001 From: Srimanta Panda Date: Mon, 28 May 2012 11:13:20 +0200 Subject: 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. --- README | 3 ++- README-WINDOWS | 3 ++- packages/control | 4 ++-- riff/DUT.cpp | 16 ++++++++++++++++ riff/DUT.h | 4 ++++ riff/InitializeDut.cpp | 32 +++++++++++++++++++++++--------- riff/InitializeDut.h | 1 + riff/ProcessRawImage.cpp | 2 +- riff/main.cpp | 2 +- 9 files changed, 52 insertions(+), 15 deletions(-) diff --git a/README b/README index 265d3d0..8911776 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -riff - Raw Image File Flasher version 0.5.0 +riff - Raw Image File Flasher version 0.5.1 ================================================================================= Description: @@ -105,6 +105,7 @@ Version history and changelog: 0.4.1 Packaging and README updated. 0.4.2 Larger image file support. 0.5.0 Support for Windows. +0.5.1 Error description for LCD error number ================================================================================= Contact and support diff --git a/README-WINDOWS b/README-WINDOWS index e8d3b1b..1577318 100644 --- a/README-WINDOWS +++ b/README-WINDOWS @@ -1,4 +1,4 @@ -riff - Raw Image File Flasher version 0.5.0 +riff - Raw Image File Flasher version 0.5.1 ================================================================================= Description: @@ -102,6 +102,7 @@ Version history and changelog: 0.4.1 Packaging and README updated. 0.4.2 Larger image file support. 0.5.0 Support for Windows. +0.5.1 Error description for LCD error number ================================================================================= Contact and support diff --git a/packages/control b/packages/control index 92eb075..9aa9018 100644 --- a/packages/control +++ b/packages/control @@ -1,8 +1,8 @@ Package: riff -Version: 0.5.0 +Version: 0.5.1 Priority: optional Architecture: all -Depends: libusb-1.0-0, riff-configpack (>= 0.4.3), riff-loadercomm (>= 0.4.3) +Depends: libusb-1.0-0, riff-configpack (>= 0.4.5), riff-loadercomm (>= 0.4.4) Installed-Size: Maintainer: packages@igloocommunity.org Section: devel 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 #include +#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 \ " -- cgit v1.2.3