Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions source/LedManager/led_manager_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,27 @@ cpe_event_t ledmgr_get_event_from_str (char * event_str)
}
return i;
}

bool is_remote_lte_up() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LED manager is a generic code . Try to use HAL LED configuration file for interface specific LED settings

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wan interface state change should be detected by respective component and set a sysevent for wan. From LED manager point of view, it should be just a "wan sysevent" irrespective of primary/backup interfaces. So check which component is subscribing for Device.X_RDK_WanManager.InterfaceActiveStatus. That component should check LTE status and set wan event

FILE *fp;
char buffer[512];
CcspTraceError((" is_remote_lte_up called \n"));
fp = popen("dmcli eRT getv Device.X_RDK_WanManager.InterfaceActiveStatus", "r");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use rbus API

if (!fp) return 0;

while (fgets(buffer, sizeof(buffer), fp)) {
if (strstr(buffer, "REMOTE_LTE,1")) {
pclose(fp);
CcspTraceError((" is_remote_lte_up returned true \n"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use TraceInfo

return true;
}
}

pclose(fp);
CcspTraceError((" is_remote_lte_up returned false \n"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use TraceInfo

return false;
}

#ifdef WAN_STATUS_LED_EVENT
static int parse_wan_event(char * event_str, char * wan_event)
{
Expand Down Expand Up @@ -153,9 +174,26 @@ static int parse_wan_event(char * event_str, char * wan_event)
(strcmp(led_wan_events[i].ipv6_event_value, led_wan_data->ipv6_event_value) == 0) &&
(strcmp(led_wan_events[i].mapt_event_value, led_wan_data->mapt_event_value) == 0))
{
strncpy(wan_event, led_wan_events[i].wan_event, BUFLEN_64-1);
if(strcmp(led_wan_events[i].wan_event,"rdkb_ipv4_only") == 0)
{
CcspTraceError((" wan_event is rdkb_ipv4_only \n"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use TraceInfo

/*rdkb_ipv4_only - then it could be because of remote LTE completes WAN path*/
if(is_remote_lte_up()){
CcspTraceError(("Setting rdkb_wan_link_down as wan_event as is_remote_lte_up is true\n"));
/*if REMOTE_LTE_CHECK is true then local device is in WAN FAIL OVER MODE*/
strncpy(wan_event,"rdkb_wan_link_down", BUFLEN_64-1);
}
else{
strncpy(wan_event, led_wan_events[i].wan_event, BUFLEN_64-1);
}
}
else
{
strncpy(wan_event, led_wan_events[i].wan_event, BUFLEN_64-1);
}

CcspTraceError(("Final Wan Status Event: %s\n", led_wan_events[i].wan_event));
free(led_wan_data);
free(led_wan_data);
return SUCCESS;
}
}
Expand Down
1 change: 1 addition & 0 deletions source/LedManager/led_manager_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ char * ledmgr_read_config_file (FILE * fp);
int ledmgr_parse_config_file (char * buffer);
int ledmgr_print_data_to_logfile();
void ledmgr_free_data();
bool is_remote_lte_up();
#ifdef WAN_STATUS_LED_EVENT
BOOL check_captive_portal_mode();
#endif
Expand Down
Loading