Skip to content
Open
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
107 changes: 107 additions & 0 deletions source/scripts/init/src/apply_system_defaults_helper.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* If not stated otherwise in this file or this component's Licenses.txt file the

Check failure on line 2 in source/scripts/init/src/apply_system_defaults_helper.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'BSD-Intel' license found in local file 'source/scripts/init/src/apply_system_defaults_helper.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/1, 3321 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/Utopia/+archive/RDKB-TEST-RELEASE-1.tar.gz, file: source/scripts/init/src/apply_system_defaults/apply_system_defaults.c)

Check failure on line 2 in source/scripts/init/src/apply_system_defaults_helper.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'BSD-Intel' license found in local file 'source/scripts/init/src/apply_system_defaults_helper.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/1, 3321 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/Utopia/+archive/RDKB-RELEASE-TEST-DUNFELL-1.tar.gz, file: source/scripts/init/src/apply_system_defaults/apply_system_defaults.c)

Check failure on line 2 in source/scripts/init/src/apply_system_defaults_helper.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'BSD-Intel' license found in local file 'source/scripts/init/src/apply_system_defaults_helper.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/2, 3321 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/Utopia/+archive/RDKB-RELEASE-TEST-DUNFELL-2.tar.gz, file: source/scripts/init/src/apply_system_defaults/apply_system_defaults.c)
* following copyright and licenses apply:
*
* Copyright 2015 RDK Management
Expand Down Expand Up @@ -1285,6 +1285,7 @@
}

/** ApplyPartnersObjectItemsIntoSysevents() */
__attribute__((unused))
static int ApplyPartnersObjectItemsIntoSysevents( char *pcPartnerID )
{
if( NULL == pcPartnerID )
Expand Down Expand Up @@ -1925,6 +1926,54 @@
addInSysCfgdDB(key, value);
param = param->next;
}

/* Process override-only parameters (parameters that exist only in override, not in main partner defaults)
This allows model-specific parameters like dmsb.* to be added through override section */
if (overrideObj)
{
APPLY_PRINT("%s - Processing override-only parameters for model %s\n", __FUNCTION__, devModel);
cJSON *overrideParam = overrideObj->child;
while (overrideParam)
{
char *override_key = overrideParam->string;

// Check if this key was already processed from subitem_etc
if (!cJSON_HasObjectItem(newPartnerObj, override_key))
{
char *override_value = overrideParam->valuestring;
if (override_value != NULL)
{
APPLY_PRINT("%s - Adding override-only parameter: %s = %s\n", __FUNCTION__, override_key, override_value);

cJSON *newOverrideParamObj = cJSON_CreateObject();
cJSON_AddStringToObject(newOverrideParamObj, "DefaultValue", override_value);
cJSON_AddStringToObject(newOverrideParamObj, "BuildTime", getBuildTime());
cJSON_AddStringToObject(newOverrideParamObj, "ActiveValue", override_value);
cJSON_AddStringToObject(newOverrideParamObj, "UpdateTime", "-");
cJSON_AddStringToObject(newOverrideParamObj, "UpdateSource", "-");

cJSON_AddItemToObject(newPartnerObj, override_key, newOverrideParamObj);

// Handle dmsb.* parameters - store in PSM database
if (0 != strstr(override_key, "dmsb.") || 0 != strstr(override_key, "X_AIRTIES_Obj"))
{
if (psm_supported == 1)
{
APPLY_PRINT("Add override PSM value %s for param %s\n", override_value, override_key);
set_psm_record(override_key, override_value);
}
}
else
{
// Handle other parameters - store in syscfg database or through addInSysCfgdDB
addInSysCfgdDB(override_key, override_value);
}
}
}
overrideParam = overrideParam->next;
}
}

cJSON_AddItemToObject(root_nvram_bs_json, PartnerID, newPartnerObj);

char *out = cJSON_Print(root_nvram_bs_json);
Expand Down Expand Up @@ -2249,6 +2298,62 @@
param = param->next;
}

/* Process override-only parameters (parameters that exist only in override, not in main partner defaults)
This allows model-specific parameters like dmsb.* to be added through override section */
if (overrideObj)
{
APPLY_PRINT("%s - Processing override-only parameters for model %s\n", __FUNCTION__, devModel);
cJSON *overrideParam = overrideObj->child;
while (overrideParam)
{
char *override_key = overrideParam->string;

// Check if this key was already processed from subitem_etc
if (!cJSON_HasObjectItem(subitem_etc, override_key))
{
char *override_value = overrideParam->valuestring;
if (override_value != NULL)
{
APPLY_PRINT("%s - Adding override-only parameter: %s = %s\n", __FUNCTION__, override_key, override_value);

cJSON *bs_obj = cJSON_GetObjectItem(subitem_nvram_bs, override_key);
if (bs_obj == NULL)
{
cJSON *newParamObj = cJSON_CreateObject();
cJSON_AddStringToObject(newParamObj, "DefaultValue", override_value);
cJSON_AddStringToObject(newParamObj, "BuildTime", getBuildTime());
cJSON_AddStringToObject(newParamObj, "ActiveValue", override_value);
cJSON_AddStringToObject(newParamObj, "UpdateTime", "-");
cJSON_AddStringToObject(newParamObj, "UpdateSource", "-");

cJSON_AddItemToObject(subitem_nvram_bs, override_key, newParamObj);

// Handle dmsb.* parameters - store in PSM database
if (0 != strstr(override_key, "dmsb.") || 0 != strstr(override_key, "X_AIRTIES_Obj"))
{
if (psm_supported == 1)
{
APPLY_PRINT("Add override PSM value %s for param %s\n", override_value, override_key);
addParamInPartnersFile(override_key, PartnerID, override_value);
set_psm_record(override_key, override_value);
}
}
else
{
if (syscfg_supported == 1)
{
APPLY_PRINT("Add override syscfg value %s for param %s\n", override_value, override_key);
addParamInPartnersFile(override_key, PartnerID, override_value);
set_syscfg_partner_values(override_value, override_key);
}
}
}
}
}
overrideParam = overrideParam->next;
}
}

/* Check if nvram file has same count as etc file
if nvram has more entries, we may need to check what was
removed from etc in current release.
Expand Down Expand Up @@ -2403,6 +2508,7 @@
cJSON *param = partnerObj->child;
char *key = NULL;
char *value = NULL;

while( param )
{
key = param->string;
Expand All @@ -2417,6 +2523,7 @@
{
//Its PSM entry
APPLY_PRINT("Update psm value %s for param %s\n", value, key);

set_psm_record(key, value);
}
}
Expand Down
7 changes: 7 additions & 0 deletions source/scripts/init/system/utopia_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,13 @@ fi

echo_t "[utopia][init] Setting any unset system values to default"
apply_system_defaults

PARTNER_ID=`syscfg get PartnerID`
if [ "$PARTNER_ID" = "sky-uk" ] && [ "$MODEL_NUM" = "SCER11BEL" ]; then
echo_t "[utopia][init] Partner ID is sky-uk and device is XER10, applying partner defaults for psm"
apply_system_defaults_psm
fi

changeFilePermissions $SYSCFG_BKUP_FILE 400
if [ "$ENCRYPT_SYSCFG" = false ] ; then
echo "[utopia][init] SEC: Syscfg stored in $SYSCFG_BKUP_FILE"
Expand Down
Loading