diff --git a/helpers/CHANGELOG.md b/helpers/CHANGELOG.md new file mode 100644 index 0000000000..6fe8066658 --- /dev/null +++ b/helpers/CHANGELOG.md @@ -0,0 +1,18 @@ +All notable changes to this RDK Service will be documented in this file. + + Each RDK Service has a CHANGELOG file that contains all changes done so far. When version is updated, add a entry in the CHANGELOG.md at the top with user friendly information on what was changed with the new version. Please don't mention JIRA tickets in CHANGELOG. + + Please Add entry in the CHANGELOG for each version change and indicate the type of change with these labels: + Added for new features. + Changed for changes in existing functionality. + Deprecated for soon-to-be removed features. + Removed for now removed features. + Fixed for any bug fixes. + Security in case of vulnerabilities. + + Changes in CHANGELOG should be updated when commits are added to the main or release branches. There should be one CHANGELOG entry per JIRA Ticket. This is not enforced on sprint branches since there could be multiple changes for the same JIRA ticket during development. + + For more details, refer to versioning section under Main README. +## [1.0.1] - 2024-06-25 +### Fixed +- Added retry logic for IARM connect failure diff --git a/helpers/UtilsIarm.h b/helpers/UtilsIarm.h index 1d50acafe0..213d6fb8bd 100644 --- a/helpers/UtilsIarm.h +++ b/helpers/UtilsIarm.h @@ -3,6 +3,7 @@ #include "UtilsLogging.h" #include "libIBus.h" +#include #define IARM_CHECK(FUNC) { \ if ((res = FUNC) != IARM_RESULT_SUCCESS) { \ @@ -29,19 +30,27 @@ struct IARM { LOGINFO("IARM already connected"); result = true; } else { - res = IARM_Bus_Init(NAME); - LOGINFO("IARM_Bus_Init: %d", res); - if (res == IARM_RESULT_SUCCESS || res == IARM_RESULT_INVALID_STATE /* already inited or connected */) { - res = IARM_Bus_Connect(); - LOGINFO("IARM_Bus_Connect: %d", res); - if (res == IARM_RESULT_SUCCESS || res == IARM_RESULT_INVALID_STATE /* already connected or not inited */) { - result = isConnected(); + unsigned int retryCount = 0; + do + { + res = IARM_Bus_Init(NAME); + LOGINFO("IARM_Bus_Init: %d", res); + if (res == IARM_RESULT_SUCCESS || res == IARM_RESULT_INVALID_STATE /* already inited or connected */) { + res = IARM_Bus_Connect(); + LOGINFO("IARM_Bus_Connect: %d", res); + if (res == IARM_RESULT_SUCCESS || res == IARM_RESULT_INVALID_STATE /* already connected or not inited */) { + result = isConnected(); + LOGERR("ARM_Bus_Connect result: %d res: %d retryCount :%d ",result, res, retryCount); + } else { + LOGERR("IARM_Bus_Connect failure:result :%d res: %d retryCount :%d ",result, res, retryCount); + } } else { - LOGERR("IARM_Bus_Connect failure: %d", res); + LOGERR("IARM_Bus_Init failure: result :%d res: %d retryCount :%d",result, res,retryCount); } - } else { - LOGERR("IARM_Bus_Init failure: %d", res); - } + + if(result == false) usleep(100000); + + }while((result == false) && (retryCount++ < 20)); } return result; @@ -52,7 +61,7 @@ struct IARM { IARM_Result_t res; int isRegistered = 0; res = IARM_Bus_IsConnected(NAME, &isRegistered); - LOGINFO("IARM_Bus_IsConnected: %d (%d)", res, isRegistered); + LOGINFO("IARM_Bus_IsConnected: res:%d isRegistered (%d)", res, isRegistered); return (isRegistered == 1); }