46 #ifdef OFFLINE_MAINT_REBOOT
47 #include <sys/socket.h>
48 #include <netinet/in.h>
49 #include <arpa/inet.h>
50 #include <sys/types.h>
52 #include <sys/ioctl.h>
60 #include "comcastIrKeyCodes.h"
62 #include "plat_power.h"
65 #include "libIBusDaemon.h"
70 #include "pwrlogger.h"
72 #include "resetModes.h"
75 #include "deepSleepMgr.h"
76 #include "exception.hpp"
84 static void _speechEventHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len);
85 #ifdef USE_UNIFIED_CONTROL_MGR_API_1
86 #include "ctrlm_ipc.h"
87 #include "ctrlm_ipc_rcu.h"
88 static void _ctrlmMessageHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len);
90 #ifdef USE_UNIFIED_RF4CE_MGR_API_4
91 #include "vrexMgrApi.h"
95 #ifdef RF4CE_GENMSO_API
97 static void _rfMessageHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len);
98 #elif defined(RF4CE_API)
100 static void _rf4ceMessageHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len);
101 #elif defined(RF4CE_GPMSO_API)
102 #include "rf4ceMgr.h"
103 static void _gpMessageHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len);
105 #warning "No RF4CE API defined"
110 #define PADDING_SIZE 32
111 #define _UIMGR_SETTINGS_MAGIC 0xFEBEEFAC
114 unsigned int brightness;
122 volatile IARM_Bus_PWRMgr_PowerState_t powerState;
124 #ifdef ENABLE_DEEP_SLEEP
125 uint32_t deep_sleep_timeout;
127 #ifdef ENABLE_LLAMA_PLATCO_SKY_XIONE
130 char padding[PADDING_SIZE];
133 typedef enum _UIDev_PowerState_t {
134 UIDEV_POWERSTATE_OFF,
135 UIDEV_POWERSTATE_STANDBY,
137 UIDEV_POWERSTATE_UNKNOWN
138 } UIDev_PowerState_t;
144 UIDev_PowerState_t powerState;
145 char padding[PADDING_SIZE];
149 static const char *m_settingsFile = NULL;
150 static bool isCecLocalLogicEnabled =
false;
152 #define MAX_NUM_VIDEO_PORTS 5
159 #ifdef _ENABLE_FP_KEY_SENSITIVITY_IMPROVEMENT
160 #ifndef POWER_KEY_SENSITIVITY
161 #define POWER_KEY_SENSITIVITY 500
163 static struct timeval powerKeyIntervals[] = {
170 #define PWRMGR_SET_POWER_KEYDOWN_TM() do\
172 if (POWER_KEY_SENSITIVITY) {\
173 struct timeval __tv;\
174 gettimeofday(&__tv, NULL);\
175 printf("[POWERKEY-DOWN][%ld\[%d]\r\n", __tv.tv_sec, __tv.tv_usec);\
177 powerKeyIntervals[0] = (__tv);\
178 powerKeyIntervals[1].tv_sec = 0;\
179 powerKeyIntervals[1].tv_usec = 0;\
183 #define PWRMGR_SET_POWER_KEYUP_TM() do\
185 if (POWER_KEY_SENSITIVITY && powerKeyIntervals[0].tv_sec != 0) {\
186 struct timeval __tv;\
187 gettimeofday(&__tv, NULL);\
188 printf("[POWERKEY-UP ][%ld\[%d]\r\n", __tv.tv_sec, __tv.tv_usec);\
190 powerKeyIntervals[1] = (__tv);\
196 #define TIMEVAL_DIFF(t2,t1) ((int)(((((int)(t2.tv_sec - t1.tv_sec)) - 1) * 1000) + (((1000*1000 + t2.tv_usec) - t1.tv_usec)/1000)))
197 #define PWRMGR_GET_POWER_KEY_INTERVAL() \
198 (((powerKeyIntervals[1].tv_sec) && (powerKeyIntervals[1].tv_sec >= powerKeyIntervals[0].tv_sec)) ?\
199 (TIMEVAL_DIFF(powerKeyIntervals[1], powerKeyIntervals[0])) :\
200 (POWER_KEY_SENSITIVITY))
202 static volatile IARM_Bus_PWRMgr_PowerState_t transitionState;
203 static volatile IARM_Bus_PWRMgr_PowerState_t targetState;
205 static pthread_cond_t powerStateCond = PTHREAD_COND_INITIALIZER;
206 static pthread_mutex_t powerStateMutex = PTHREAD_MUTEX_INITIALIZER;
207 static pthread_t asyncPowerThreadId = NULL;
209 static void _SetPowerStateAsync(IARM_Bus_PWRMgr_PowerState_t curState, IARM_Bus_PWRMgr_PowerState_t newState);
211 static pthread_mutex_t wareHouseOpsMutex = PTHREAD_MUTEX_INITIALIZER;
212 static pthread_t asyncPowerWarehouseOpsThreadId = NULL;
215 static void _sleepModeChangeHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len);
216 static void _controlEventHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len);
217 static void _irEventHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len);
218 static void _systemStateChangeHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len);
219 static IARM_Result_t _SetPowerState(
void *arg);
220 static IARM_Result_t _GetPowerState(
void *arg);
221 static IARM_Result_t _WareHouseReset(
void *arg);
222 static IARM_Result_t _WareHouseClear(
void *arg);
223 static IARM_Result_t _ColdFactoryReset(
void *);
224 static IARM_Result_t _FactoryReset(
void *);
225 static IARM_Result_t _UserFactoryReset(
void *);
226 static IARM_Result_t _GetPowerStateBeforeReboot(
void *arg);
227 static IARM_Result_t _HandleReboot(
void *arg);
228 #ifdef ENABLE_SET_WAKEUP_SRC_CONFIG
229 static IARM_Result_t _SetWakeupSrcConfig(
void *arg);
230 #endif //ENABLE_SET_WAKEUP_SRC_CONFIG
231 void _handleDeepsleepTimeoutWakeup();
232 void handleDeepsleepTimeoutWakeup ();
233 static void* deepsleepTimeoutWakeupThread (
void * arg);
234 static int _InitSettings(
const char *settingsFile);
235 static int _WriteSettings(
const char *settingsFile);
237 static IARM_Bus_PWRMgr_PowerState_t _ConvertUIDevToIARMBusPowerState(UIDev_PowerState_t powerState);
238 static int ecm_connectivity_lost = 0;
241 static bool deepSleepWakeup =
false;
242 extern void IARM_Bus_PWRMGR_RegisterSleepTimerAPIs(
void *);
246 static IARM_Bus_Daemon_SysMode_t isEASInProgress = IARM_BUS_SYS_MODE_NORMAL;
249 GMainLoop *pwrMgr_Gloop = NULL;
250 static gboolean heartbeatMsg(gpointer data);
251 std::string powerStateBeforeReboot_gc;
252 static IARM_Bus_PWRMgr_PowerState_t g_last_known_power_state = IARM_BUS_PWRMGR_POWERSTATE_ON;
254 #ifdef ENABLE_DEEP_SLEEP
256 extern IARM_Result_t GetPwrMgrDeepSleepStatus(
int *status);
257 extern IARM_Result_t PwrMgrDeepSleepWakeup(IARM_Bus_CommonAPI_PowerPreChange_Param_t *arg);
258 extern void IARM_Bus_PWRMGR_RegisterDeepSleepAPIs();
259 extern void HandleDeepSleepStateChange(
void *data);
260 extern void PwrMgrDeepSleepTimeout();
263 static IARM_Result_t _SetDeepSleepTimeOut(
void *arg);
266 static gboolean deep_sleep_wakeup_fn(gpointer data);
269 static uint32_t getWakeupTime();
272 static gboolean invoke_deep_sleep_on_bootup_timeout(gpointer data);
275 static uint32_t deep_sleep_wakeup_timeout_sec = 28800;
276 static uint8_t IsWakeupTimerSet = 0;
277 static guint wakeup_event_src = 0;
278 static guint dsleep_bootup_event_src = 0;
279 static time_t timeAtDeepSleep = 0;
280 #endif // END OF #ifdef ENABLE_DEEP_SLEEP
282 #ifdef ENABLE_LLAMA_PLATCO_SKY_XIONE
283 static bool nwStandbyMode_gs =
false;
285 #ifdef OFFLINE_MAINT_REBOOT
286 gint64 standby_time = 0;
287 static bool rfcUpdated =
false;
288 static int standby_reboot_threshold = 86400*3;
289 static int force_reboot_threshold = 172800*3;
291 #define MAX_RFC_LEN 15
293 #define UPTIME_ABOVE_STANDBY_REBOOT(time) (time >= standby_reboot_threshold)
294 #define UPTIME_ABOVE_FORCE_REBOOT(time) (time >= force_reboot_threshold)
295 #define REBOOT_GRACE_INTERVAL(u, s) ((u - s) >= 900)
297 #define STANDBY_REBOOT_ENABLE "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.StandbyReboot.Enable"
298 #define STANDBY_REBOOT "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.StandbyReboot.StandbyAutoReboot"
299 #define FORCE_REBOOT "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.StandbyReboot.ForceAutoReboot"
302 static IARM_Result_t _SetNetworkStandbyMode(
void *arg);
303 static IARM_Result_t _GetNetworkStandbyMode(
void *arg);
305 static void setPowerStateBeforeReboot (IARM_Bus_PWRMgr_PowerState_t powerState) {
306 switch (powerState) {
307 case IARM_BUS_PWRMGR_POWERSTATE_OFF:
308 powerStateBeforeReboot_gc = std::string (
"OFF");
310 case IARM_BUS_PWRMGR_POWERSTATE_STANDBY:
311 powerStateBeforeReboot_gc = std::string (
"STANDBY");
313 case IARM_BUS_PWRMGR_POWERSTATE_ON:
314 powerStateBeforeReboot_gc = std::string (
"ON");
316 case IARM_BUS_PWRMGR_POWERSTATE_STANDBY_LIGHT_SLEEP:
317 powerStateBeforeReboot_gc = std::string (
"LIGHT_SLEEP");
319 case IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP:
320 powerStateBeforeReboot_gc = std::string (
"DEEP_SLEEP");
323 powerStateBeforeReboot_gc = std::string (
"UNKNOWN");
326 printf (
"[%s]:[%d] powerStateBeforeReboot: %s \n", __FUNCTION__, __LINE__, powerStateBeforeReboot_gc.c_str());
329 IARM_Result_t PWRMgr_Start(
int argc,
char *argv[])
331 char *settingsFile = NULL;
334 if (argc == 2) settingsFile = argv[1];
336 setvbuf(stdout, NULL, _IOLBF, 0);
341 #ifdef ENABLE_DEEP_SLEEP
352 LOG(
"Exception Caught during [device::Manager::Initialize]\r\n");
355 _InitSettings(settingsFile);
356 #ifdef _ENABLE_FP_KEY_SENSITIVITY_IMPROVEMENT
357 transitionState = m_settings.powerState;
358 targetState = m_settings.powerState;
370 #ifdef ENABLE_DEEP_SLEEP
383 #ifdef USE_UNIFIED_CONTROL_MGR_API_1
389 #ifdef USE_UNIFIED_RF4CE_MGR_API_4
396 #ifdef RF4CE_GENMSO_API
398 #elif defined(RF4CE_API)
400 #elif defined(RF4CE_GPMSO_API)
403 #warning "No RF4CE API defined"
414 #ifdef ENABLE_SET_WAKEUP_SRC_CONFIG
416 #endif //ENABLE_SET_WAKEUP_SRC_CONFIG
418 #ifdef ENABLE_THERMAL_PROTECTION
419 initializeThermalProtection();
420 #endif //ENABLE_THERMAL_PROTECTION
422 #ifdef ENABLE_DEEP_SLEEP
423 IARM_Bus_PWRMGR_RegisterDeepSleepAPIs();
427 pwrMgr_Gloop = g_main_loop_new ( NULL, FALSE );
428 if(pwrMgr_Gloop != NULL) {
429 g_timeout_add_seconds (300, heartbeatMsg, pwrMgr_Gloop);
435 IARM_Bus_PWRMGR_RegisterSleepTimerAPIs(pwrMgr_Gloop);
437 RFC_ParamData_t rfcParam;
438 WDMP_STATUS status = getRFCParameter(
"TestComponent",
"Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.CECLocalLogic.Enable", &rfcParam);
439 if(strncmp(rfcParam.value,
"true",4) == 0)
441 isCecLocalLogicEnabled=
true;
442 LOG(
"pwrMgr:RFC CEC Local Logic feature enabled \r\n");
444 char *rdk_deep_sleep_wakeup = getenv(
"RDK_DEEPSLEEP_WAKEUP_ON_POWER_BUTTON");
445 deepSleepWakeup = (rdk_deep_sleep_wakeup && atoi(rdk_deep_sleep_wakeup));
450 printf (
"initial value m_sleepMode:%d \n", m_sleepMode);
454 LOG(
"PwrMgr: Exception coughht while processing getPreferredSleepMode\r\n");
456 return IARM_RESULT_SUCCESS;
459 IARM_Result_t PWRMgr_Loop()
465 g_main_loop_run (pwrMgr_Gloop);
466 g_main_loop_unref(pwrMgr_Gloop);
468 return IARM_RESULT_SUCCESS;
471 #ifdef OFFLINE_MAINT_REBOOT
472 bool isStandbyRebootEnabled()
474 RFC_ParamData_t rfcParam;
475 char* key = STANDBY_REBOOT_ENABLE;
476 if (WDMP_SUCCESS == getRFCParameter(
"PwrMgr", key, &rfcParam))
478 return (strncasecmp(rfcParam.value,
"true", 4) == 0);
484 int getStandbyRebootValue(
char* key)
486 RFC_ParamData_t param;
487 char rfcVal[MAX_RFC_LEN+1] = {0};
490 if (WDMP_SUCCESS == getRFCParameter(
"PwrMgr", key, ¶m))
492 len = strlen(param.value);
493 if (len > MAX_RFC_LEN)
498 if ( (param.value[0] ==
'"') && (param.value[len] ==
'"'))
500 strncpy (rfcVal, ¶m.value[1], len - 1);
505 strncpy (rfcVal, param.value, MAX_RFC_LEN-1);
518 return ((stat(
"/tmp/addressaquired_ipv4", &buf) != 0)
519 && (stat(
"/tmp/addressaquired_ipv6", &buf) != 0));
522 struct ifaddrs *ifAddr, *ifAddrIt;
526 for (ifAddrIt = ifAddr; ifAddrIt != NULL; ifAddrIt = ifAddrIt->ifa_next)
528 if (NULL != ifAddrIt->ifa_addr
529 && (!strcmp(ifAddrIt->ifa_name,
"eth0:0") || !strcmp(ifAddrIt->ifa_name,
"wlan0:0")))
531 LOG(
"ifa_name=%s sa_family=%s ifa_flags=0x%X\n",
533 ifAddrIt->ifa_addr->sa_family == AF_INET?
"AF_INET" : ifAddrIt->ifa_addr->sa_family == AF_INET6?
"AF_INET6" :
"None",
534 (ifAddrIt->ifa_flags & IFF_RUNNING) );
537 if (NULL != ifAddrIt->ifa_addr
538 && (ifAddrIt->ifa_addr->sa_family == AF_INET || ifAddrIt->ifa_addr->sa_family == AF_INET6)
539 && (!strcmp(ifAddrIt->ifa_name,
"eth0:0") || !strcmp(ifAddrIt->ifa_name,
"wlan0:0"))
540 && (ifAddrIt->ifa_flags & IFF_RUNNING))
553 IARM_Bus_PWRMgr_PowerState_t curState = pSettings->powerState;
554 LOG(
"%s PowerState = %d\n", __func__, curState);
555 return (curState == IARM_BUS_PWRMGR_POWERSTATE_STANDBY
556 || curState == IARM_BUS_PWRMGR_POWERSTATE_STANDBY_LIGHT_SLEEP);
562 static gboolean heartbeatMsg(gpointer data)
566 LOG(
"I-ARM POWER Mgr: HeartBeat at %s\r\n", ctime(&curr));
568 #ifdef OFFLINE_MAINT_REBOOT
571 LOG(
"StandbyReboot.Enable = %s\n", isStandbyRebootEnabled() ?
"true" :
"false");
573 standby_reboot_threshold = getStandbyRebootValue(STANDBY_REBOOT);
574 if (standby_reboot_threshold == -1)
576 standby_reboot_threshold = 86400*3;
578 LOG(
"StandbyReboot.StandbyAutoReboot = %d\n", standby_reboot_threshold);
580 force_reboot_threshold = getStandbyRebootValue(FORCE_REBOOT);
581 if (force_reboot_threshold == -1)
583 force_reboot_threshold = 172800*3;
585 LOG(
"StandbyReboot.ForceAutoReboot = %d\n", force_reboot_threshold);
589 if (isStandbyRebootEnabled())
591 gint64 uptime = g_get_monotonic_time()/G_USEC_PER_SEC;
592 if (UPTIME_ABOVE_STANDBY_REBOOT(uptime))
594 if (REBOOT_GRACE_INTERVAL(uptime, standby_time) && isInStandby())
596 LOG(
"Going to reboot after %lld\n", uptime);
598 system(
"sh /rebootNow.sh -s PwrMgr -o 'Standby Maintenance reboot'");
601 if (UPTIME_ABOVE_FORCE_REBOOT(uptime))
603 LOG(
"Going to reboot after %lld\n", uptime);
605 system(
"sh /rebootNow.sh -s PwrMgr -o 'Forced Maintenance reboot'");
615 IARM_Result_t PWRMgr_Stop(
void)
620 g_main_loop_quit(pwrMgr_Gloop);
627 LOG(
"Exception Caught during [device::Manager::Initialize]\r\n");
632 #ifdef USE_UNIFIED_CONTROL_MGR_API_1
638 #ifdef USE_UNIFIED_RF4CE_MGR_API_4
645 #ifdef RF4CE_GENMSO_API
647 #elif defined(RF4CE_API)
649 #elif defined(RF4CE_GPMSO_API)
652 #warning "No RF4CE API defined"
660 #ifdef ENABLE_DEEP_SLEEP
663 return IARM_RESULT_SUCCESS;
666 void _sleepModeChangeHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len)
668 if (strcmp(owner,IARM_BUS_DSMGR_NAME) == 0)
674 m_sleepMode = eventData->data.sleepModeInfo.sleepMode;
675 printf(
"%s m_sleepMode :%d \n",__FUNCTION__,m_sleepMode);
685 static void _systemStateChangeHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len)
691 unsigned long secs = 0;
692 IARM_Bus_SYSMgr_SystemState_t stateId = sysEventData->data.systemStates.stateId;
693 state = sysEventData->data.systemStates.state;
694 error = sysEventData->data.systemStates.error;
700 case IARM_BUS_SYSMGR_SYSSTATE_DSG_CA_TUNNEL:
701 case IARM_BUS_SYSMGR_SYSSTATE_ECM_IP:
704 fp = fopen(
"/proc/uptime",
"r");
707 setvbuf(fp, (
char *) NULL, _IONBF, 0);
708 fseek(fp, 0, SEEK_SET);
709 if(0 > fscanf(fp,
"%ld", &secs))
711 LOG(
"Error: fscanf on uptime failed \r\n");
713 ecm_connectivity_lost = 1;
719 LOG(
"Error: fopen on uptime failed \r\n");
721 ecm_connectivity_lost = 1;
726 if(0 == ecm_connectivity_lost)
728 if (stateId == IARM_BUS_SYSMGR_SYSSTATE_ECM_IP)
730 LOG(
"[PwrMgr] ECM connectivity Lost on ECM_IP Event..\r\n");
731 ecm_connectivity_lost = 1;
733 else if ((stateId == IARM_BUS_SYSMGR_SYSSTATE_DSG_CA_TUNNEL) && (0 == state))
735 LOG(
"[PwrMgr] ECM connectivity Lost on DSG_CA_TUNNEL Event ..\r\n");
736 ecm_connectivity_lost = 1;
744 if(1 == ecm_connectivity_lost)
746 if (stateId == IARM_BUS_SYSMGR_SYSSTATE_ECM_IP)
748 LOG(
"[PwrMgr] ECM connectivity recovered on ECM_IP Event..\r\n");
749 ecm_connectivity_lost = 0;
751 else if ((stateId == IARM_BUS_SYSMGR_SYSSTATE_DSG_CA_TUNNEL) && (2 == state))
753 LOG(
"[PwrMgr] ECM connectivity recovered on DSG_CA_TUNNEL Event..\r\n");
754 ecm_connectivity_lost = 0;
766 static void _irEventHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len)
770 int keyCode = irEventData->data.irkey.keyCode;
771 int keyType = irEventData->data.irkey.keyType;
772 int isFP = irEventData->data.irkey.isFP;
780 LOG(
"Unexpected Key type recieved %X\r\n",
keyType);
785 #ifdef _ENABLE_FP_KEY_SENSITIVITY_IMPROVEMENT
786 if( (
keyType == KET_KEYDOWN) && (keyCode == KED_FP_POWER))
788 PWRMGR_SET_POWER_KEYDOWN_TM();
792 if( (
keyType == KET_KEYUP) && (keyCode == KED_FP_POWER) && isFP && ecm_connectivity_lost )
795 LOG(
"[PwrMgr] Rebooting the box due to ECM connectivity Loss ..\r\n");
796 m_settings.powerState = IARM_BUS_PWRMGR_POWERSTATE_ON;
797 _WriteSettings(m_settingsFile);
798 PwrMgr_Reset(IARM_BUS_PWRMGR_POWERSTATE_ON,
false);
805 IARM_Bus_PWRMgr_PowerState_t curState = pSettings->powerState;
806 IARM_Bus_PWRMgr_PowerState_t newState = ((curState == IARM_BUS_PWRMGR_POWERSTATE_ON) ? IARM_BUS_PWRMGR_POWERSTATE_STANDBY : IARM_BUS_PWRMGR_POWERSTATE_ON);
807 #ifdef ENABLE_LLAMA_PLATCO
809 if(curState == IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP && keyCode != KED_DEEPSLEEP_WAKEUP)
811 LOG(
" Ignoring the IR Events in Deepsleep Mode ..\r\n");
816 #ifdef _ENABLE_FP_KEY_SENSITIVITY_IMPROVEMENT
820 if (( (
keyType == KET_KEYUP) && (keyCode == KED_DISCRETE_POWER_ON) && (newState == IARM_BUS_PWRMGR_POWERSTATE_ON) ) ||
821 ((
keyType == KET_KEYUP) && (keyCode == KED_DISCRETE_POWER_STANDBY) && (newState == IARM_BUS_PWRMGR_POWERSTATE_STANDBY)))
824 LOG(
"Setting Discrete Powerstate cur=%d,new=%d\r\n", curState, newState);
827 _SetPowerState((
void *)¶m);
834 if (keyCode == KED_UNDEFINEDKEY)
838 static int skipWakupKey = 0;
840 int isPassthruKey= 0;
841 static const int passthruKeys[] = {
850 static const int skipWakeupKeys[] = {
854 KED_DISCRETE_POWER_ON,
855 KED_DISCRETE_POWER_STANDBY,
866 static const char *keytypeString[3] = {
"Pressed",
"Released",
"Repeat"};
868 #ifdef _ENABLE_WAKEUP_KEY
871 for (i = 0; i <
sizeof(passthruKeys) /
sizeof(passthruKeys[0]); i++) {
872 if (keyCode == passthruKeys[i]) {
878 for (i = 0; i <
sizeof(skipWakeupKeys) /
sizeof(skipWakeupKeys[0]); i++) {
879 if (keyCode == skipWakeupKeys[i]) {
894 LOG(
"%s Power %s\n",((isFP == 1) ?
"FrontPanel":
"RF/IR"),keytypeString[((
keyType>>8)-0x80)]);
897 #ifdef _DISABLE_KEY_POWEROFF
898 const int disableFPResetLogic = 1;
900 const int disableFPResetLogic = 0;
903 if (disableFPResetLogic && keyCode == KED_FP_POWER && isFP) {
904 printf(
"Disable FP Reset Logic\r\n");
907 static const int skipControlKeys[] = {
913 bool is_control_key =
false;
914 for (
int i = 0; i <
sizeof(skipControlKeys) /
sizeof(skipControlKeys[0]); ++i) {
915 if (keyCode == skipControlKeys[i]) {
916 is_control_key =
true;
920 if (!is_control_key) {
921 resetState = checkResetSequence(
keyType,keyCode);
925 LOG(
"Control Key (%02x, %02x), do not check Reset sequence", keyCode,
keyType);
931 if ((keyCode == KED_FP_POWER) || (keyCode == KED_RF_POWER) || isWakeupKey)
935 IARM_Bus_PWRMgr_PowerState_t curState = pSettings->powerState;
936 #ifdef _ENABLE_FP_KEY_SENSITIVITY_IMPROVEMENT
937 if (POWER_KEY_SENSITIVITY) {
938 curState = transitionState;
941 IARM_Bus_PWRMgr_PowerState_t newState;
944 newState = ((curState == IARM_BUS_PWRMGR_POWERSTATE_ON) ? IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP: IARM_BUS_PWRMGR_POWERSTATE_ON);
948 newState = ((curState == IARM_BUS_PWRMGR_POWERSTATE_ON) ? IARM_BUS_PWRMGR_POWERSTATE_STANDBY : IARM_BUS_PWRMGR_POWERSTATE_ON);
950 if((keyCode == KED_DEEPSLEEP_WAKEUP) && (
keyType == KET_KEYUP) && (curState == IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP))
952 #ifdef PLATCO_BOOTTO_STANDBY
953 newState = IARM_BUS_PWRMGR_POWERSTATE_STANDBY;
954 LOG(
"KED_DEEPSLEEP_WAKEUP in DEEP_SLEEP so change the state to STANDBY cur=%d,new=%d\r\n", curState, newState);
956 newState = IARM_BUS_PWRMGR_POWERSTATE_ON;
957 LOG(
"KED_DEEPSLEEP_WAKEUP in DEEP_SLEEP so change the state to ON cur=%d,new=%d\r\n", curState, newState);
960 #ifdef _ENABLE_FP_KEY_SENSITIVITY_IMPROVEMENT
969 if (isWakeupKey &&
keyType == KET_KEYDOWN) {
970 if (curState != IARM_BUS_PWRMGR_POWERSTATE_ON) {
979 #ifdef _DISABLE_KEY_POWEROFF
980 const int disableKeyPowerOff = 1;
982 const int disableKeyPowerOff = 0;
985 #ifdef _ENABLE_WAKEUP_KEY
987 if (((keyCode == KED_RF_POWER || isWakeupKey) && curState != IARM_BUS_PWRMGR_POWERSTATE_ON && (keyCode == KED_SELECT ? difftime(time(NULL), xre_timer) >= 3.0:1)) || (keyCode == KED_FP_POWER))
990 if ((keyCode == KED_RF_POWER) || (isWakeupKey && curState != IARM_BUS_PWRMGR_POWERSTATE_ON && (keyCode == KED_SELECT ? difftime(time(NULL), xre_timer) >= 3.0:1)) || (keyCode == KED_FP_POWER))
993 #ifdef _ENABLE_FP_KEY_SENSITIVITY_IMPROVEMENT
994 LOG(
"before handling Power Manager Settings State vs new State(%x, %x) transition state %x \r\n", curState, newState, transitionState);
997 if (
keyType == KET_KEYUP && curState != newState && (resetState == 0)) {
998 LOG(
"Setting Powerstate cur=%d,new=%d\r\n", curState, newState);
1002 int doNothandlePowerKey = ((disableKeyPowerOff) && (curState == IARM_BUS_PWRMGR_POWERSTATE_ON) && (newState != IARM_BUS_PWRMGR_POWERSTATE_ON));
1003 if ((deepSleepWakeup) && (curState != IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP)) {
1004 doNothandlePowerKey = 1;
1005 LOG(
"RDK_DEEPSLEEP_WAKEUP_ON_POWER_BUTTON is set, power-ON only from DEEPSLEEP\r\n");
1008 #ifdef _ENABLE_FP_KEY_SENSITIVITY_IMPROVEMENT
1009 if (doNothandlePowerKey) {
1010 printf(
"Ignore Power Key when in ON state \r\n");
1014 PWRMGR_SET_POWER_KEYUP_TM();
1015 if (PWRMGR_GET_POWER_KEY_INTERVAL() >= POWER_KEY_SENSITIVITY) {
1016 LOG(
"Taking PowerKey for Sensitivity %d, cur=%d,new=%d\r\n", PWRMGR_GET_POWER_KEY_INTERVAL(), curState, newState);
1017 _SetPowerStateAsync(curState, newState);
1020 LOG(
"Ignoring PowerKey for Sensitivity %d, cur=%d,new=%d\r\n", PWRMGR_GET_POWER_KEY_INTERVAL(), curState, newState);
1024 if (!doNothandlePowerKey) {
1025 _SetPowerState((
void *)¶m);
1028 if (!doNothandlePowerKey) {
1029 setResetPowerState(newState);
1033 LOG(
"NOT NOT NOT Setting Powerstate cur=%d,new=%d on keyType %x\r\n", curState, newState,
keyType);
1046 static IARM_Result_t _SetPowerState(
void *arg)
1048 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1051 IARM_Bus_CommonAPI_PowerPreChange_Param_t powerPreChangeParam;
1052 IARM_Bus_PWRMgr_PowerState_t newState = param->
newState;
1053 IARM_Bus_PWRMgr_PowerState_t curState = pSettings->powerState;
1054 static const char *powerstateString[5] = {
"OFF",
"STANDBY",
"ON",
"LIGHTSLEEP",
"DEEPSLEEP"};
1056 LOG(
"[%s:%d] Entering...\r\n",__FUNCTION__,__LINE__);
1058 if(curState != newState) {
1060 #ifdef ENABLE_DEEP_SLEEP
1066 if(dsleep_bootup_event_src)
1068 g_source_remove(dsleep_bootup_event_src);
1069 dsleep_bootup_event_src = 0;
1071 LOG(
"Removed Deep sleep boot up event Time source %d \r\n",dsleep_bootup_event_src);
1073 if( (IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP == curState)
1074 && (IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP != newState))
1076 IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
1078 rpcRet = GetPwrMgrDeepSleepStatus(&dsStatus);
1081 LOG(
"%s deepsleep in progress ignoreing the request dsStatus %d rpcRet :%d\r\n",__FUNCTION__,dsStatus,rpcRet);
1084 IARM_Bus_CommonAPI_PowerPreChange_Param_t deepSleepWakeupParam;
1086 LOG(
"Waking up from Deep Sleep.. \r\n");
1087 deepSleepWakeupParam.curState = curState;
1088 deepSleepWakeupParam.newState = newState;
1091 PwrMgrDeepSleepWakeup(&deepSleepWakeupParam);
1096 LOG(
"Power Mode Change from %s to %s start\n",powerstateString[curState],powerstateString[newState]);
1098 powerPreChangeParam.newState = param->
newState;
1099 powerPreChangeParam.curState = pSettings->powerState;
1100 IARM_BusDaemon_PowerPrechange(powerPreChangeParam);
1102 LOG(
"Power Mode Change from %s to %s end\n",powerstateString[curState],powerstateString[newState]);
1103 #ifdef OFFLINE_MAINT_REBOOT
1104 if(newState != IARM_BUS_PWRMGR_POWERSTATE_ON) {
1106 standby_time = g_get_monotonic_time()/G_USEC_PER_SEC;
1107 LOG(
"Power state changed at %lld\n", standby_time);
1111 pSettings->powerState = newState;
1112 _WriteSettings(m_settingsFile);
1113 #ifdef _ENABLE_FP_KEY_SENSITIVITY_IMPROVEMENT
1114 if(transitionState != newState)
1116 transitionState = newState;
1118 if(targetState != newState)
1120 targetState = newState;
1123 #ifndef ENABLE_LLAMA_PLATCO
1124 if (newState != IARM_BUS_PWRMGR_POWERSTATE_ON) {
1126 LOG(
"Invoking clean up script\r\n");
1127 if(param->
keyCode != KED_FP_POWER)
1129 system(
"/lib/rdk/standbyCleanup.sh");
1134 LOG(
"Standby operation due to KED_FP_POWER key press, Invoking script with forceShutdown \r\n");
1135 system(
"/lib/rdk/standbyCleanup.sh --forceShutdown");
1144 LOG(
"[PwrMgr] Post Power Mode Change Event \r\n");
1149 if(pwrModeEventData == NULL)
1151 LOG(
"[%s:%d] Failed due to memory allocation. \r\n",__FUNCTION__,__LINE__);
1152 return IARM_RESULT_OOM;
1156 pwrModeEventData->data.state.curState = curState;
1157 pwrModeEventData->data.state.newState = newState;
1159 #ifdef ENABLE_DEEP_SLEEP
1160 if(IsWakeupTimerSet)
1163 pwrModeEventData->data.state.deep_sleep_timeout = deep_sleep_wakeup_timeout_sec;
1168 deep_sleep_wakeup_timeout_sec = getWakeupTime();
1169 pwrModeEventData->data.state.deep_sleep_timeout = deep_sleep_wakeup_timeout_sec;
1172 #ifdef ENABLE_LLAMA_PLATCO_SKY_XIONE
1173 pwrModeEventData->data.state.nwStandbyMode = nwStandbyMode_gs;
1179 if(IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP == newState)
1188 time(&timeAtDeepSleep);
1189 #ifdef ENABLE_LLAMA_PLATCO_SKY_XIONE
1190 #ifndef USE_WAKEUP_TIMER_EVT
1191 wakeup_event_src = g_timeout_add_seconds ((guint)1, deep_sleep_wakeup_fn, pwrMgr_Gloop);
1194 LOG(
"deep_sleep_wakeup_fn is not running\r\n");
1197 LOG(
"Networkstandbymode for Source %d is: %s \r\n",wakeup_event_src, (nwStandbyMode_gs?(
"Enabled"):(
"Disabled")));
1199 wakeup_event_src = g_timeout_add_seconds ((guint)30, deep_sleep_wakeup_fn, pwrMgr_Gloop);
1202 LOG(
"Added Deep Sleep Wakeup Time Source %d for %d Sec \r\n",wakeup_event_src,deep_sleep_wakeup_timeout_sec);
1205 else if(wakeup_event_src)
1209 LOG(
"Removed Deep sleep Wakeup Time source %d for %d Sec.. \r\n",wakeup_event_src,deep_sleep_wakeup_timeout_sec);
1210 g_source_remove(wakeup_event_src);
1211 wakeup_event_src = 0;
1212 timeAtDeepSleep = 0;
1217 (
void *)pwrModeEventData,
1222 #ifdef ENABLE_DEEP_SLEEP
1223 if(IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP == newState)
1225 HandleDeepSleepStateChange((
void *)pwrModeEventData);
1228 if(pwrModeEventData)
1230 free(pwrModeEventData);
1231 pwrModeEventData = NULL;
1235 if(pwrModeEventData)
1237 free(pwrModeEventData);
1238 pwrModeEventData = NULL;
1241 if(IARM_BUS_PWRMGR_POWERSTATE_ON == newState) {
1243 LOG(
"IARMCEC_SendCECImageViewOn and IARMCEC_SendCECActiveSource. \r\n");
1252 LOG(
"Warning:PowerState is same as requested\r\n");
1254 LOG(
"[%s:%d] Exiting...\n",__FUNCTION__,__LINE__);
1259 static IARM_Result_t _GetPowerState(
void *arg)
1263 param->
curState = pSettings->powerState;
1264 param->
prevState = g_last_known_power_state;
1266 return IARM_RESULT_SUCCESS;
1269 static IARM_Result_t _GetPowerStateBeforeReboot(
void *arg)
1273 strncpy (param->
powerStateBeforeReboot, powerStateBeforeReboot_gc.c_str(), strlen(powerStateBeforeReboot_gc.c_str()));
1274 return IARM_RESULT_SUCCESS;
1278 static IARM_Result_t _HandleReboot(
void *arg)
1280 IARM_Result_t result = IARM_RESULT_SUCCESS;
1282 param->reboot_reason_custom[
sizeof(param->reboot_reason_custom) - 1] =
'\0';
1283 param->reboot_reason_custom[
sizeof(param->reboot_reason_other) - 1] =
'\0';
1284 param->requestor[
sizeof(param->requestor) - 1] =
'\0';
1286 strncpy(rebootParam.reboot_reason_custom,param->reboot_reason_custom,
sizeof(param->reboot_reason_custom));
1287 rebootParam.powerState = m_settings.powerState;
1288 result =
IARM_Bus_Call(IARM_BUS_DSMGR_NAME, IARM_BUS_DSMGR_API_SetRebootConfig, &rebootParam,
sizeof(rebootParam));
1289 if (IARM_RESULT_SUCCESS != result)
1291 LOG(
"Set reboot param failed");
1293 performReboot(param->requestor, param->reboot_reason_custom, param->reboot_reason_other);
1294 return IARM_RESULT_SUCCESS;
1297 #ifdef ENABLE_SET_WAKEUP_SRC_CONFIG
1298 static IARM_Result_t _SetWakeupSrcConfig(
void *arg)
1300 IARM_Result_t retCode = IARM_RESULT_IPCCORE_FAIL;
1305 IARM_Bus_PWRMgr_SetWakeupSrcConfig_Param_t *param = (IARM_Bus_PWRMgr_SetWakeupSrcConfig_Param_t *)arg;
1306 LOG(
"[PwrMgr] Setting WakeupSrcConfiguration for src type %d to %d\n", param->srcType,param->config);
1307 result = PLAT_API_SetWakeupSrc(param->srcType, param->config);
1308 retCode = result?IARM_RESULT_IPCCORE_FAIL:IARM_RESULT_SUCCESS;
1312 retCode = IARM_RESULT_INVALID_PARAM;
1316 #endif //ENABLE_SET_WAKEUP_SRC_CONFIG
1318 static void* _AsyncPowerWareHouseOperation(
void *pWareHouseOpnArg)
1322 pthread_mutex_lock(&wareHouseOpsMutex);
1323 if (NULL == pWareHouseOpn) {
1324 LOG(
"_AsyncPowerWareHouseOperation pWareHouseOpnArg is NULL\r\n");
1325 pthread_mutex_unlock(&wareHouseOpsMutex);
1326 asyncPowerWarehouseOpsThreadId = NULL;
1332 wareHouseOpnEventData.
status = IARM_BUS_PWRMGR_WAREHOUSE_INPROGRESS;
1333 LOG(
"_AsyncPowerWareHouseOperation pWareHouseOpnArg is %d pWareHouseOpn is %d\r\n", *((
int*)pWareHouseOpnArg), *pWareHouseOpn);
1335 if (IARM_BUS_PWRMGR_WAREHOUSE_RESET == (*pWareHouseOpn)) {
1336 processWHResetNoReboot();
1337 wareHouseOpnEventData.
status = IARM_BUS_PWRMGR_WAREHOUSE_COMPLETED;
1339 else if (IARM_BUS_PWRMGR_WAREHOUSE_CLEAR == (*pWareHouseOpn)) {
1340 processWHClearNoReboot();
1341 wareHouseOpnEventData.
status = IARM_BUS_PWRMGR_WAREHOUSE_COMPLETED;
1345 LOG(
"_AsyncPowerWareHouseOperation unexpected pWareHouseOpnArg %d\r\n", (*pWareHouseOpn));
1346 wareHouseOpnEventData.
status = IARM_BUS_PWRMGR_WAREHOUSE_FAILED;
1349 LOG(
"_AsyncPowerWareHouseOperation broadcasted IARM_BUS_PWRMGR_EVENT_WAREHOUSEOPS_STATUSCHANGED event\r\n");
1352 free (pWareHouseOpn);
1354 pthread_mutex_unlock(&wareHouseOpsMutex);
1355 asyncPowerWarehouseOpsThreadId = NULL;
1362 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1364 if (asyncPowerWarehouseOpsThreadId == NULL)
1367 *pWareHouseOpn = eWareHouseOpn;
1368 LOG(
"_SetPowerWareHouseOperation eWareHouseOpn is %d pWareHouseOpn is %d\r\n", eWareHouseOpn, *pWareHouseOpn);
1369 int err = pthread_create(&asyncPowerWarehouseOpsThreadId, NULL, _AsyncPowerWareHouseOperation, (
void*)pWareHouseOpn);
1371 LOG(
"_AsyncPowerWareHouseOperation thread create failed \r\n");
1373 err = pthread_detach(asyncPowerWarehouseOpsThreadId);
1375 LOG(
"_AsyncPowerWareHouseOperation thread detach failed \r\n");
1378 LOG(
"_AsyncPowerWareHouseOperation thread detach success \r\n");
1382 retCode = IARM_RESULT_INVALID_STATE;
1383 LOG(
"_SetPowerWareHouseOperation already in progress %d. Pls call it once existing reset finished.\r\n", retCode);
1388 static IARM_Result_t _WareHouseReset(
void *arg)
1391 int ret = param->
suppressReboot ? _SetPowerWareHouseOperation (IARM_BUS_PWRMGR_WAREHOUSE_RESET) : processWHReset();
1392 LOG(
"_WareHouseReset returned : %d\r\n", ret);
1395 return IARM_RESULT_SUCCESS;
1397 return IARM_RESULT_IPCCORE_FAIL;
1400 static IARM_Result_t _WareHouseClear(
void *arg)
1403 int ret = param->
suppressReboot ? _SetPowerWareHouseOperation (IARM_BUS_PWRMGR_WAREHOUSE_CLEAR) : processWHClear();
1404 LOG(
"_WareHouseClear returned : %d\r\n", ret);
1407 return IARM_RESULT_SUCCESS;
1409 return IARM_RESULT_IPCCORE_FAIL;
1412 static IARM_Result_t _ColdFactoryReset(
void *)
1414 int ret = processColdFactoryReset();
1415 LOG(
"_ColdFactoryReset returned : %d\r\n", ret);
1418 return IARM_RESULT_SUCCESS;
1420 return IARM_RESULT_IPCCORE_FAIL;
1423 static IARM_Result_t _FactoryReset(
void *)
1425 int ret = processFactoryReset();
1426 LOG(
"_FactoryReset returned : %d\r\n", ret);
1429 return IARM_RESULT_SUCCESS;
1431 return IARM_RESULT_IPCCORE_FAIL;
1434 static IARM_Result_t _UserFactoryReset(
void *)
1436 int ret = processUserFactoryReset();
1437 LOG(
"_UserFactoryReset returned : %d\r\n", ret);
1440 return IARM_RESULT_SUCCESS;
1442 return IARM_RESULT_IPCCORE_FAIL;
1445 static int _InitSettings(
const char *settingsFile)
1447 if (settingsFile == NULL) settingsFile =
"/opt/uimgr_settings.bin";
1449 m_settingsFile = settingsFile;
1450 LOG(
"Initializing settings at file %s\r\n", settingsFile);
1452 int ret = open(settingsFile, O_CREAT|O_RDWR, S_IRWXU|S_IRUSR);
1459 int read_size =
sizeof(uint32_t) * 3;
1460 lseek(fd, 0, SEEK_SET);
1461 ret = read(fd, pSettings,read_size);
1462 if((ret == read_size))
1464 switch(pSettings->version)
1469 lseek(fd, 0, SEEK_SET);
1471 read_size = pSettings->length;
1472 ret = read(fd, &uiMgrSettings,read_size);
1473 if(ret == read_size)
1476 pSettings->magic = _UIMGR_SETTINGS_MAGIC;
1477 pSettings->version = 1;
1479 pSettings->powerState =
1480 _ConvertUIDevToIARMBusPowerState(uiMgrSettings.powerState);
1481 g_last_known_power_state = pSettings->powerState;
1482 #ifdef ENABLE_DEEP_SLEEP
1483 pSettings->deep_sleep_timeout = deep_sleep_wakeup_timeout_sec;
1485 #ifdef ENABLE_LLAMA_PLATCO_SKY_XIONE
1486 pSettings->nwStandbyMode = nwStandbyMode_gs;
1488 lseek(fd, 0, SEEK_SET);
1489 write(fd, pSettings, pSettings->length);
1503 LOG(
"[PwrMgr] Length of Persistence matches with Current Data Size \r\n");
1504 lseek(fd, 0, SEEK_SET);
1505 read_size = pSettings->length;
1506 ret = read(fd, pSettings,read_size);
1507 if(ret != read_size)
1510 LOG(
"[PwrMgr] error case, not able to read full length \r\n");
1514 g_last_known_power_state = pSettings->powerState;
1515 #ifdef ENABLE_DEEP_SLEEP
1516 deep_sleep_wakeup_timeout_sec = pSettings->deep_sleep_timeout;
1518 LOG(
"Persisted deep_sleep_delay = %d Secs \r\n",deep_sleep_wakeup_timeout_sec);
1520 #ifdef ENABLE_LLAMA_PLATCO_SKY_XIONE
1521 nwStandbyMode_gs = pSettings->nwStandbyMode;
1523 LOG(
"Persisted network standby mode is: %s \r\n", nwStandbyMode_gs?(
"Enabled"):(
"Disabled"));
1525 #ifdef PLATCO_BOOTTO_STANDBY
1526 if(stat(
"/tmp/pwrmgr_restarted",&buf) != 0)
1528 pSettings->powerState = IARM_BUS_PWRMGR_POWERSTATE_STANDBY;
1530 LOG(
"Setting default powerstate to standby\n\r");
1538 LOG(
"[PwrMgr] Length of Persistence is less than Current Data Size \r\n");
1539 lseek(fd, 0, SEEK_SET);
1540 read_size = pSettings->length;
1541 ret = read(fd, pSettings,read_size);
1542 if(ret != read_size)
1544 LOG(
"[PwrMgr] Read Failed for Data Length %d \r\n",ret);
1552 g_last_known_power_state = pSettings->powerState;
1553 lseek(fd, 0, SEEK_SET);
1554 #ifdef ENABLE_DEEP_SLEEP
1555 pSettings->deep_sleep_timeout = deep_sleep_wakeup_timeout_sec;
1557 #ifdef ENABLE_LLAMA_PLATCO_SKY_XIONE
1558 pSettings->nwStandbyMode = nwStandbyMode_gs;
1560 #ifdef PLATCO_BOOTTO_STANDBY
1561 if(stat(
"/tmp/pwrmgr_restarted",&buf) != 0) {
1562 pSettings->powerState = IARM_BUS_PWRMGR_POWERSTATE_STANDBY;
1566 LOG(
"[PwrMgr] Write PwrMgr Settings File With Current Data Length %d \r\n",pSettings->length);
1567 ret = write(fd, pSettings, pSettings->length);
1568 if(ret != pSettings->length)
1570 LOG(
"[PwrMgr] Write Failed For New Data Length %d \r\n",ret);
1578 LOG(
"[PwrMgr] Length of Persistence is more than Current Data Size. \r\n");
1580 lseek(fd, 0, SEEK_SET);
1582 ret = read(fd,pSettings,read_size);
1583 if(ret != read_size)
1585 LOG(
"[PwrMgr] Read Failed for Data Length %d \r\n",ret);
1591 g_last_known_power_state = pSettings->powerState;
1592 lseek(fd, 0, SEEK_SET);
1594 LOG(
"[PwrMgr] Write and Truncate PwrMgr Settings File With Current Data Length %d ........\r\n",pSettings->length);
1595 ret = write(fd, pSettings, pSettings->length);
1596 if(ret != pSettings->length)
1598 LOG(
"[PwrMgr] Write Failed For New Data Length %d \r\n",ret);
1605 lseek(fd, 0, SEEK_SET);
1606 fret = ftruncate(fd,pSettings->length);
1609 LOG(
"[PwrMgr] Truncate Failed For New Data Length %d \r\n",fret);
1630 #ifdef PLATCO_BOOTTO_STANDBY
1631 if(stat(
"/tmp/pwrmgr_restarted",&buf) != 0) {
1632 powerStateBeforeReboot_gc = std::string(
"UNKNOWN");
1633 printf (
"[%s]:[%d] powerStateBeforeReboot: %s\n", __FUNCTION__, __LINE__, powerStateBeforeReboot_gc.c_str());
1640 lseek(fd, 0, SEEK_SET);
1641 LOG(
"Initial Creation of UIMGR Settings\r\n");
1642 pSettings->magic = _UIMGR_SETTINGS_MAGIC;
1643 pSettings->version = 1;
1644 pSettings->length =
sizeof(*pSettings) - PADDING_SIZE;
1645 pSettings->powerState = IARM_BUS_PWRMGR_POWERSTATE_ON;
1646 #ifdef ENABLE_DEEP_SLEEP
1647 pSettings->deep_sleep_timeout = deep_sleep_wakeup_timeout_sec;
1649 #ifdef ENABLE_LLAMA_PLATCO_SKY_XIONE
1650 pSettings->nwStandbyMode = nwStandbyMode_gs;
1652 #ifdef PLATCO_BOOTTO_STANDBY
1653 if(stat(
"/tmp/pwrmgr_restarted",&buf) != 0)
1654 pSettings->powerState = IARM_BUS_PWRMGR_POWERSTATE_STANDBY;
1656 ret = write(fd, pSettings, pSettings->length);
1661 #ifdef ENABLE_DEEP_SLEEP
1665 if(pSettings->powerState == IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP)
1668 LOG(
"Box Reboots with Deep Sleep mode.. Start a Event Time SOurce .. \r\n");
1669 guint dsleep_bootup_timeout = 3600;
1670 dsleep_bootup_event_src = g_timeout_add_seconds (dsleep_bootup_timeout,invoke_deep_sleep_on_bootup_timeout,pwrMgr_Gloop);
1672 LOG(
"Added Time source %d to put the box to deep sleep after %d Sec.. \r\n",dsleep_bootup_event_src,dsleep_bootup_timeout);
1676 setPowerStateBeforeReboot (g_last_known_power_state);
1677 __TIMESTAMP();LOG(
"Setting PowerStateBeforeReboot %d \r\n", g_last_known_power_state);
1681 IARM_Bus_PWRMgr_PowerState_t state;
1684 if (pSettings->powerState == state) {
1685 LOG(
"PowerState is already sync'd with hardware to %d\r\n", state);
1689 LOG(
"PowerState sync hardware state %d with UIMGR to %d\r\n", state, pSettings->powerState);
1695 }
while(state != pSettings->powerState && loopCount < 10);
1697 if (state != pSettings->powerState) {
1698 LOG(
"CRITICAL ERROR: PowerState sync failed \r\n");
1699 pSettings->powerState = state;
1703 lseek(fd, 0, SEEK_SET);
1704 ret = write(fd, pSettings, pSettings->length);
1715 #ifdef PLATCO_BOOTTO_STANDBY
1716 if(stat(
"/tmp/pwrmgr_restarted",&buf) != 0) {
1717 _eventData.data.state.curState = IARM_BUS_PWRMGR_POWERSTATE_OFF;
1718 _eventData.data.state.newState = IARM_BUS_PWRMGR_POWERSTATE_STANDBY;
1723 _eventData.data.state.curState = g_last_known_power_state;
1724 _eventData.data.state.newState = pSettings->powerState;
1726 LOG(
"%s: Init setting powermode change from %d to %d \r\n", __FUNCTION__,_eventData.data.state.curState, \
1727 _eventData.data.state.newState);
1730 if (ret > 0 && ret < (
int)
sizeof(*pSettings)) {
1731 _DumpSettings(pSettings);
1735 if (ret > (
int)
sizeof(*pSettings)) {
1736 LOG(
"Error: Should not have read that much ! \r\n");
1746 LOG(
"Error: Failed to operate on uimgr_settings.bin, reason=[%s]\r\n", strerror(errno));
1753 static int _WriteSettings(
const char *settingsFile)
1756 int fd = open(settingsFile, O_WRONLY);
1760 lseek(fd, 0, SEEK_SET);
1762 ret = write(fd, pSettings, pSettings->length);
1768 LOG(
"Error: Failed to write on [%s], reason=[%s]\r\n", settingsFile, strerror(errno));
1771 LOG(
"Settings updated successfully\r\n");
1772 _DumpSettings(pSettings);
1780 LOG(
"PWRMGR-Settings-Mag: %X\r\n", pSettings->magic);
1781 LOG(
"PWRMGR-Settings-Ver: %d\r\n", pSettings->version);
1782 LOG(
"PWRMGR-Settings-Len: %d\r\n", pSettings->length );
1783 LOG(
"PWRMGR-Settings-PWR: %d\r\n", pSettings->powerState);
1784 LOG(
"PWRMGR-Settings-Brightness: %d\r\n", pSettings->ledSettings.brightness);
1785 #ifdef ENABLE_DEEP_SLEEP
1786 LOG(
"PWRMGR-Settings-Deep Sleep Timeout: %d\r\n", pSettings->deep_sleep_timeout);
1790 static IARM_Bus_PWRMgr_PowerState_t _ConvertUIDevToIARMBusPowerState(UIDev_PowerState_t powerState)
1792 IARM_Bus_PWRMgr_PowerState_t ret = IARM_BUS_PWRMGR_POWERSTATE_ON;
1795 case UIDEV_POWERSTATE_OFF:
1796 ret = IARM_BUS_PWRMGR_POWERSTATE_OFF;
1798 case UIDEV_POWERSTATE_STANDBY:
1799 ret = IARM_BUS_PWRMGR_POWERSTATE_ON;
1817 IARM_Bus_CommonAPI_SysModeChange_Param_t *param = (IARM_Bus_CommonAPI_SysModeChange_Param_t *)arg;
1820 printf(
"[PwrMgr] Recvd Sysmode Change::New mode --> %d,Old mode --> %d",param->newMode,param->oldMode);
1822 if (param->newMode == IARM_BUS_SYS_MODE_EAS) {
1823 isEASInProgress = IARM_BUS_SYS_MODE_EAS;
1825 else if (param->newMode == IARM_BUS_SYS_MODE_NORMAL) {
1826 isEASInProgress = IARM_BUS_SYS_MODE_NORMAL;
1828 return IARM_RESULT_SUCCESS;
1831 #ifdef _ENABLE_FP_KEY_SENSITIVITY_IMPROVEMENT
1832 static void *_AsyncPowerTransition(
void *)
1837 pthread_mutex_lock(&powerStateMutex);
1838 if (pSettings->powerState != targetState) {
1842 _SetPowerState(¶m);
1846 pthread_cond_wait(&powerStateCond, &powerStateMutex);
1848 pthread_mutex_unlock(&powerStateMutex);
1853 static void _SetPowerStateAsync(IARM_Bus_PWRMgr_PowerState_t curState, IARM_Bus_PWRMgr_PowerState_t newState)
1857 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1859 if (asyncPowerThreadId == NULL)
1861 int err = pthread_create(&asyncPowerThreadId, NULL, _AsyncPowerTransition, NULL);
1863 LOG(
"_AsyncPowerTransition thread create failed \r\n");
1865 err = pthread_detach(asyncPowerThreadId);
1867 LOG(
"_AsyncPowerTransition thread detach failed \r\n");
1874 if (curState != newState) {
1876 LOG(
"PowerState Fast transitioning from %d to %d, while still in [%d]\r\n", curState, newState, pSettings->powerState);
1878 IARM_Result_t result = IARM_RESULT_SUCCESS;
1880 param.ledState = (int) newState;
1881 result =
IARM_Bus_Call(IARM_BUS_DSMGR_NAME, IARM_BUS_DSMGR_API_SetLEDStatus, ¶m,
sizeof(param));
1882 if (IARM_RESULT_SUCCESS != result)
1884 LOG(
"Set LED failed");
1887 transitionState = newState;
1888 pthread_mutex_lock(&powerStateMutex);
1889 if (targetState != newState) {
1890 targetState = newState;
1891 pthread_cond_signal(&powerStateCond);
1893 pthread_mutex_unlock(&powerStateMutex);
1896 LOG(
"Warning:PowerState is same as requested\r\n");
1904 #ifdef USE_UNIFIED_CONTROL_MGR_API_1
1905 static void _ctrlmMessageHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len)
1907 if (eventId == CTRLM_RCU_IARM_EVENT_KEY_GHOST)
1909 ctrlm_rcu_iarm_event_key_ghost_t* ghostEvent = (ctrlm_rcu_iarm_event_key_ghost_t*)data;
1910 if (ghostEvent != NULL)
1912 if (ghostEvent->api_revision != CTRLM_RCU_IARM_BUS_API_REVISION)
1914 LOG(
"CTRLM ghost key event: ERROR - Wrong CTRLM API revision - expected %d, event is %d!!",
1915 CTRLM_RCU_IARM_BUS_API_REVISION, ghostEvent->api_revision);
1918 LOG(
"CTRLM ghost code event: network_id: %d, network_type: %d, controller_id: %d, ghost_code: %d.\n",
1919 ghostEvent->network_id, ghostEvent->network_type, ghostEvent->controller_id, ghostEvent->ghost_code);
1921 if ((ghostEvent->ghost_code == CTRLM_RCU_GHOST_CODE_POWER_OFF) ||
1922 (ghostEvent->ghost_code == CTRLM_RCU_GHOST_CODE_POWER_ON))
1925 param.
newState = IARM_BUS_PWRMGR_POWERSTATE_ON;
1926 LOG(
"CTRLM Setting Powerstate to ON.\n");
1927 _SetPowerState((
void *)¶m);
1932 LOG(
"CTRLM ghost code event: ERROR: NULL event data!!\n");
1937 LOG(
"CTRLM event handler: ERROR: bad event type %d!!\n", eventId);
1941 #ifdef RF4CE_GENMSO_API
1942 static void _rfMessageHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len)
1945 MSOBusAPI_Packet_t* busMsg;
1949 busMsg = (MSOBusAPI_Packet_t*)data;
1951 if(len != (busMsg->length +
sizeof(MSOBusAPI_Packet_t) -
sizeof(MSOBusAPI_Msg_t)))
1953 LOG(
"BusTestApplication: %i MsgIndication with wrong length rec:%d exp:%d\n",eventId,
1954 len, (busMsg->length +
sizeof(MSOBusAPI_Packet_t) -
sizeof(MSOBusAPI_Msg_t)));
1958 switch(busMsg->msgId)
1960 case MSOBusAPI_MsgId_GhostCommand:
1962 LOG(
"BusTestApplication: command code : id:%d\n", busMsg->msg.UserCommand.commandCode);
1963 if (busMsg->msg.UserCommand.commandCode == 1 || busMsg->msg.UserCommand.commandCode == 2)
1965 param.
newState = IARM_BUS_PWRMGR_POWERSTATE_ON;
1967 _SetPowerState((
void *)¶m);
1979 #elif defined(RF4CE_API)
1980 static void _rf4ceMessageHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len)
1983 rf4ce_Packet_t* busMsg;
1987 busMsg = (rf4ce_Packet_t*)data;
1990 LOG(
"pwrMgr: RF4CE Msg indication event handler, msgId: 0x%X\n", (
unsigned)busMsg->msgId);
1991 if (busMsg->msgId == rf4ce_MsgId_GhostCommand) {
1993 LOG(
"pwrMgr: RF4CE Ghost Command, msgId: 0x%X\n", (
unsigned)busMsg->msg.UserCommand.commandCode);
1996 if(len != (busMsg->length +
sizeof(rf4ce_Packet_t) -
sizeof(rf4ce_Msg_t)))
1998 LOG(
"BusTestApplication: %i MsgIndication with wrong length rec:%d exp:%d\n",eventId,
1999 len, (busMsg->length +
sizeof(rf4ce_Packet_t) -
sizeof(rf4ce_Msg_t)));
2003 switch(busMsg->msgId)
2005 case rf4ce_MsgId_GhostCommand:
2007 LOG(
"BusTestApplication: command code : id:%d\n", busMsg->msg.UserCommand.commandCode);
2008 if (busMsg->msg.UserCommand.commandCode == 1 || busMsg->msg.UserCommand.commandCode == 2)
2010 param.
newState = IARM_BUS_PWRMGR_POWERSTATE_ON;
2012 _SetPowerState((
void *)¶m);
2023 #elif defined(RF4CE_GPMSO_API)
2024 static void _gpMessageHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len)
2027 gpMSOBusAPI_Packet_t* busMsg;
2031 busMsg = (gpMSOBusAPI_Packet_t*)data;
2033 if(len != (busMsg->length +
sizeof(gpMSOBusAPI_Packet_t) -
sizeof(gpMSOBusAPI_Msg_t)))
2035 LOG(
"BusTestApplication: %i MsgIndication with wrong length rec:%d exp:%d\n",eventId,
2036 len, (busMsg->length +
sizeof(gpMSOBusAPI_Packet_t) -
sizeof(gpMSOBusAPI_Msg_t)));
2040 switch(busMsg->msgId)
2042 case gpMSOBusAPI_MsgId_GhostCommand:
2044 LOG(
"BusTestApplication: command code : id:%d\n", busMsg->msg.UserCommand.commandCode);
2045 if (busMsg->msg.UserCommand.commandCode == 1 || busMsg->msg.UserCommand.commandCode == 2)
2047 param.
newState = IARM_BUS_PWRMGR_POWERSTATE_ON;
2049 _SetPowerState((
void *)¶m);
2061 #warning "No RF4CE API defined"
2066 static void _controlEventHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len)
2073 LOG(
"pwrMgr: Control event handler, key: 0x%X, src: 0x%X\n",
2074 (
unsigned)irEventData->data.irkey.keyCode, (
unsigned)irEventData->data.irkey.keySrc);
2076 _GetPowerState((
void *)&powerState);
2077 if (powerState.
curState != IARM_BUS_PWRMGR_POWERSTATE_ON) {
2078 int keySrc = irEventData->data.irkey.keySrc;
2079 switch(irEventData->data.irkey.keyCode) {
2081 case KED_VOLUMEDOWN:
2091 case KED_PUSH_TO_TALK:
2092 case KED_VOLUME_OPTIMIZE:
2099 irEventData->data.irkey.keyCode = KED_POWER;
2100 irEventData->data.irkey.keyType = KET_KEYUP;
2101 _irEventHandler(owner,eventId,(
void*)irEventData,len);
2107 static void _speechEventHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len)
2110 _GetPowerState((
void *)&powerState);
2112 LOG(
"pwrMgr: Voice event handler, eventId: %d.\n", (
int)eventId);
2113 #ifdef USE_UNIFIED_CONTROL_MGR_API_1
2114 if(powerState.
curState != IARM_BUS_PWRMGR_POWERSTATE_ON &&
2115 (eventId == CTRLM_VOICE_IARM_EVENT_SESSION_BEGIN ||
2116 eventId == CTRLM_VOICE_IARM_EVENT_SESSION_ABORT ||
2117 eventId == CTRLM_VOICE_IARM_EVENT_SESSION_SHORT) )
2119 #ifdef USE_UNIFIED_RF4CE_MGR_API_4
2120 if(powerState.
curState != IARM_BUS_PWRMGR_POWERSTATE_ON &&
2121 (eventId == VREX_MGR_IARM_EVENT_VOICE_BEGIN ||
2122 eventId == VREX_MGR_IARM_EVENT_VOICE_SESSION_ABORT ||
2123 eventId == VREX_MGR_IARM_EVENT_VOICE_SESSION_SHORT) )
2128 if(eventId == IARM_BUS_VREXMGR_EVENT_SPEECH && sEvent->type == IARM_BUS_VREXMGR_SPEECH_BEGIN && powerState.
curState != IARM_BUS_PWRMGR_POWERSTATE_ON)
2133 irEventData.data.irkey.keyCode = KED_POWER;
2134 irEventData.data.irkey.keyType = KET_KEYUP;
2135 _irEventHandler(owner,eventId,(
void*)&irEventData,len);
2140 #ifdef ENABLE_DEEP_SLEEP
2141 static IARM_Result_t _SetDeepSleepTimeOut(
void *arg)
2148 LOG(
"Deep sleep timeout set to : %d\r\n", param->
timeout);
2149 deep_sleep_wakeup_timeout_sec = param->
timeout;
2150 m_settings.deep_sleep_timeout = param->
timeout;
2151 IsWakeupTimerSet = 1;
2152 _WriteSettings(m_settingsFile);
2153 return IARM_RESULT_SUCCESS;
2155 return IARM_RESULT_IPCCORE_FAIL;
2158 void handleDeepsleepTimeoutWakeup ()
2161 LOG(
"Entering %s \r\n", __FUNCTION__);
2163 param.
timeout = deep_sleep_wakeup_timeout_sec;
2166 PwrMgrDeepSleepTimeout();
2167 #if !defined (_DISABLE_SCHD_REBOOT_AT_DEEPSLEEP)
2169 LOG(
"Reboot the box due to Deep Sleep Timer Expiry : %d \r\n", param.timeout);
2175 LOG(
"deep_sleep_wakeup_fn: Set Device to light sleep on Deep Sleep timer expiry..\r\n");
2176 pSettings->powerState = IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP;
2177 paramSetPwr.
newState = IARM_BUS_PWRMGR_POWERSTATE_STANDBY_LIGHT_SLEEP;
2178 _SetPowerState((
void *)¶mSetPwr);
2181 static void* deepsleepTimeoutWakeupThread (
void * arg)
2184 LOG(
"Entering %s \r\n", __FUNCTION__);
2185 handleDeepsleepTimeoutWakeup();
2189 void _handleDeepsleepTimeoutWakeup ()
2191 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
2193 pthread_t asyncDeepsleepTimeoutThreadId = 0;
2194 int err = pthread_create(&asyncDeepsleepTimeoutThreadId, NULL, deepsleepTimeoutWakeupThread, NULL);
2197 LOG(
"handleDeepsleepTimeoutWakeup thread create failed \r\n");
2199 err = pthread_detach(asyncDeepsleepTimeoutThreadId);
2202 LOG(
"handleDeepsleepTimeoutWakeup thread detach failed \r\n");
2210 static gboolean deep_sleep_wakeup_fn(gpointer data)
2212 uint32_t timeout = (uint32_t) difftime(time(NULL),timeAtDeepSleep);
2215 LOG(
"Sec Elapsed Since Deep Sleep : %d \r\n",timeout);
2217 IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
2219 rpcRet = GetPwrMgrDeepSleepStatus(&dsStatus);
2223 handleDeepsleepTimeoutWakeup();
2233 static gboolean invoke_deep_sleep_on_bootup_timeout(gpointer data)
2239 LOG(
"deep_sleep_thread : Set Device to Deep Sleep on Bootip Timer Expiry.. \r\n");
2242 pSettings->powerState = IARM_BUS_PWRMGR_POWERSTATE_STANDBY;
2243 param.
newState = IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP;
2244 _SetPowerState((
void *)¶m);
2253 typedef enum _tzValue {
2269 static std::map<std::string, tzValue> _maptzValues;
2270 static void InitializeTimeZone();
2271 static uint32_t getTZDiffInSec()
2273 uint32_t _TZDiffTime = 6*3600;
2274 IARM_Result_t iResult = IARM_RESULT_SUCCESS;
2275 tzValue value=tzCST06;
2278 InitializeTimeZone();
2283 if(iResult == IARM_RESULT_SUCCESS)
2285 if (param.time_zone_available.error)
2288 LOG(
"Failed to get the Time Zone Information from SysMgr \r\n");
2290 else if (param.time_zone_available.state == 2)
2292 if (strlen(param.time_zone_available.payload) > 1)
2295 LOG(
"TZ Payload - %s",param.time_zone_available.payload);
2296 value = _maptzValues[param.time_zone_available.payload];
2297 _TZDiffTime = value * 3600;
2300 LOG(
"TZ value = %d\r\n",value);
2302 LOG(
"Time Zone in Sec = %d \r\n",_TZDiffTime);
2312 static void InitializeTimeZone()
2314 _maptzValues[
"HST11"] = tzHST11;
2315 _maptzValues[
"HST11HDT,M3.2.0,M11.1.0"] = tzHST11HDT;
2316 _maptzValues[
"AKST"] = tzAKST;
2317 _maptzValues[
"AKST09AKDT,M3.2.0,M11.1.0"] = tzAKST09AKDT;
2318 _maptzValues[
"PST08"] = tzPST08;
2319 _maptzValues[
"PST08PDT,M3.2.0,M11.1.0"] = tzPST08PDT;
2320 _maptzValues[
"MST07"] = tzMST07;
2321 _maptzValues[
"MST07MDT,M3.2.0,M11.1.0"] = tzMST07MDT;
2322 _maptzValues[
"CST06"] = tzCST06;
2323 _maptzValues[
"CST06CDT,M3.2.0,M11.1.0"] = tzCST06CDT;
2324 _maptzValues[
"EST05"] = tzEST05;
2325 _maptzValues[
"EST05EDT,M3.2.0,M11.1.0"] = tzEST05EDT;
2333 static uint32_t getWakeupTime()
2336 struct tm wakeupTime;
2337 uint32_t wakeupTimeInSec = 0,getTZDiffTime = 0;
2338 uint32_t wakeupTimeInMin = 5;
2343 fpWT = fopen(
"/tmp/deepSleepWakeupTimer",
"r");
2346 if(0 > fscanf(fpWT,
"%d",&wakeupTimeInMin))
2349 LOG(
"Error: fscanf on wakeupTimeInSec failed");
2353 wakeupTimeInSec = wakeupTimeInMin * 60 ;
2356 LOG(
" /tmp/ override Deep Sleep Wakeup Time is %d \r\n",wakeupTimeInSec);
2357 return wakeupTimeInSec;
2367 wakeupTime = *localtime (&wakeup);
2369 if (wakeupTime.tm_hour >=0 && wakeupTime.tm_hour < 2)
2372 wakeupTime.tm_hour = 2;
2373 wakeupTime.tm_min = 0;
2374 wakeupTime.tm_sec = 0;
2375 wakeupTimeInSec = difftime(mktime(&wakeupTime),now);
2381 wakeupTime.tm_hour = 23;
2382 wakeupTime.tm_min = 59;
2383 wakeupTime.tm_sec = 60;
2384 wakeupTimeInSec = difftime(mktime(&wakeupTime),now);
2385 wakeupTimeInSec = wakeupTimeInSec + 7200;
2392 uint32_t randTimeInSec = (uint32_t)rand()%(3600) + 0;
2393 wakeupTimeInSec = wakeupTimeInSec + randTimeInSec;
2397 LOG(
"Calculated Deep Sleep Wakeup Time Before TZ setting is %d Sec \r\n", wakeupTimeInSec);
2398 getTZDiffTime = getTZDiffInSec();
2399 wakeupTimeInSec = wakeupTimeInSec + getTZDiffTime;
2401 LOG(
"Calculated Deep Sleep Wakeup Time After TZ setting is %d Sec \r\n", wakeupTimeInSec);
2403 return wakeupTimeInSec;
2406 #endif // END OF #ifdef ENABLE_DEEP_SLEEP
2409 static IARM_Result_t _SetNetworkStandbyMode(
void *arg)
2412 uint32_t uiTimeout = 3;
2415 #ifdef ENABLE_LLAMA_PLATCO_SKY_XIONE
2416 LOG(
"Setting network standbyMode: %s \r\n", param->
bStandbyMode?(
"Enabled"):(
"Disabled"));
2419 _WriteSettings(m_settingsFile);
2422 _eventData.data.bNetworkStandbyMode = m_settings.nwStandbyMode;
2426 LOG (
"\nError _SetNetworkStandbyMode not implemented. standbyMode: %s", param->
bStandbyMode?(
"Enabled"):(
"Disabled"));
2428 return IARM_RESULT_SUCCESS;
2430 return IARM_RESULT_IPCCORE_FAIL;
2433 static IARM_Result_t _GetNetworkStandbyMode(
void *arg)
2439 #ifdef ENABLE_LLAMA_PLATCO_SKY_XIONE
2441 LOG(
"Network standbyMode is: %s \r\n", param->
bStandbyMode?(
"Enabled"):(
"Disabled"));
2443 LOG (
"\nError _GetNetworkStandbyMode not implemented.");
2445 return IARM_RESULT_SUCCESS;
2447 return IARM_RESULT_IPCCORE_FAIL;