From ed580c05bfc0e018f51ba02ac140896c22cfe495 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Tue, 20 Jan 2026 16:10:35 +0000 Subject: [PATCH] RDKB-63166 : Update device.properties file during runtime Reason for change : Modify device.properties file based on partner ID Test Procedure : Check that /etc/device.properties contains "IS_BCI=yes" Risks : Low Priority: Medium Signed-off-by: abhishek_kumaracee2@comcast.com --- .../apply_system_defaults.c | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/source/scripts/init/src/apply_system_defaults/apply_system_defaults.c b/source/scripts/init/src/apply_system_defaults/apply_system_defaults.c index 0a589550..4bfb1b89 100644 --- a/source/scripts/init/src/apply_system_defaults/apply_system_defaults.c +++ b/source/scripts/init/src/apply_system_defaults/apply_system_defaults.c @@ -3317,6 +3317,50 @@ static void getPartnerIdWithRetry(char* buf, char* PartnerID) } #endif +#if defined (ONESTACK_PRODUCT_REQ) + +#define DEV_PROP_FILE "/etc/device.properties" +static const char *g_dev_prop_params[] = { + "IS_BCI=yes", + NULL +}; + +static int addPartnerDefaultsToDevPropFile() +{ + FILE *fp = NULL; + //check file for existence + if (access(DEV_PROP_FILE, F_OK) != 0) + { + APPLY_PRINT("[Utopia - %s]File %s does not exists\n",__FUNCTION__,DEV_PROP_FILE); + return 1; + } + + //open for writing + fp = fopen(DEV_PROP_FILE, "a"); + if (fp == NULL) + { + APPLY_PRINT("[Utopia - %s]File %s could not open for writing\n",__FUNCTION__,DEV_PROP_FILE); + return 1; + } + + int i = 0; + for (i = 0; g_dev_prop_params[i] != NULL; i++) + { + if (fprintf(fp, "%s\n", g_dev_prop_params[i]) < 0) + { + APPLY_PRINT("[Utopia - %s]File %s write failed\n",__FUNCTION__,DEV_PROP_FILE); + fclose(fp); + return 1; + } + } + + APPLY_PRINT("[Utopia - %s]File %s write successful\n",__FUNCTION__,DEV_PROP_FILE); + + fclose(fp); + + return 0; +} +#endif /* * main() */ @@ -3531,6 +3575,16 @@ static void getPartnerIdWithRetry(char* buf, char* PartnerID) sysevent_close(global_fd, global_id); +#if defined (ONESTACK_PRODUCT_REQ) + if (0 == strcasecmp (PartnerID, "comcast-business")) + { + if ( 1 == addPartnerDefaultsToDevPropFile()) + { + APPLY_PRINT("%s - Failed to write default props to '%s'\n", __FUNCTION__, DEV_PROP_FILE); + } + } +#endif + return(0); }