Skip to content
Open
Changes from 3 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1374c07
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Oct 30, 2025
6b95abb
fix build issue
santoshcomcast Oct 30, 2025
2f17837
fix build issue
santoshcomcast Oct 30, 2025
2e068a5
addressed review comments
santoshcomcast Nov 5, 2025
6fd6b4f
fix build issue
santoshcomcast Nov 5, 2025
9932c3c
fix build issue
santoshcomcast Nov 5, 2025
cc2121a
fix build issue
santoshcomcast Nov 5, 2025
0d13c48
fix build issue
santoshcomcast Nov 5, 2025
397cf75
fix build issue
santoshcomcast Nov 5, 2025
8433557
fix coverity issue and removed unwanted code.
santoshcomcast Nov 5, 2025
51c8af5
Fix build issue.
santoshcomcast Nov 5, 2025
020d7fc
Addressed review comments.
santoshcomcast Nov 6, 2025
7e8a9f4
Addressed review comments.
santoshcomcast Nov 6, 2025
b1e9412
addressed review comments.
santoshcomcast Nov 10, 2025
661e8ec
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 11, 2025
bbe42f2
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 12, 2025
299bf52
fix build issue
santoshcomcast Nov 12, 2025
5f5a634
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 13, 2025
6553c8f
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 14, 2025
12f0193
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 17, 2025
565dbde
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 17, 2025
17faa45
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 17, 2025
8f60d7e
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 20, 2025
7455db3
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 20, 2025
8e51e51
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 20, 2025
329c312
Merge pull request #179 from rdkcentral/develop
santoshcomcast Nov 26, 2025
1928496
debug. disable dumpconfig and add logs
santoshcomcast Dec 9, 2025
05aa70f
enable debugconfig
santoshcomcast Dec 10, 2025
64a4609
move the debug prints within if condtion for all config dumpconfig
santoshcomcast Dec 10, 2025
9789231
added few more logs, lock_guard in searchconfig
santoshcomcast Dec 10, 2025
dde8258
add delay while every load
santoshcomcast Dec 10, 2025
edb8f55
add count variable for close the opened hal file
santoshcomcast Dec 11, 2025
2864e49
fix build issue.
santoshcomcast Dec 11, 2025
e287d3a
add condition wait for 4 loads complete.
santoshcomcast Dec 11, 2025
bccfc77
disable the dlclose.
santoshcomcast Dec 12, 2025
103ec2a
Force to use FP old config to check crash.
santoshcomcast Dec 12, 2025
76d0910
fix fp Update frontPanelConfig.cpp
santoshcomcast Dec 15, 2025
acd9e70
fix build error
santoshcomcast Dec 15, 2025
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
162 changes: 162 additions & 0 deletions ds/audioOutputPortConfig.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in ds/audioOutputPortConfig.cpp

View workflow job for this annotation

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

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'ds/audioOutputPortConfig.cpp' (Match: rdk/components/generic/devicesettings/rdk/components/generic/devicesettings/2.1-20161031, 353 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/devicesettings/+archive/2.1-20161031.tar.gz, file: ds/audioOutputPortConfig.cpp)
*
* Copyright 2016 RDK Management
*
Expand Down Expand Up @@ -34,6 +34,15 @@
#include "dsUtl.h"
#include "stdlib.h"
#include "dslogger.h"
#include <dlfcn.h>

#define DEBUG 1

static dsAudioTypeConfig_t *kConfigs1 = NULL;
static dsAudioPortConfig_t *kPorts1 = NULL;
int *pKConSize, *pKPortSize;
Copy link
Contributor

Choose a reason for hiding this comment

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

use consistency in names pKConSize -> pKConfigSize as most of the places you have use config. Also there is not significance of 1 as suffix, use better names

Copy link
Author

@santoshcomcast santoshcomcast Nov 5, 2025

Choose a reason for hiding this comment

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

Updated the code

static int kConfig_size_local = -1, kPort_size_local = -1;
static pthread_mutex_t dsLock = PTHREAD_MUTEX_INITIALIZER;

namespace device {

Expand Down Expand Up @@ -108,6 +117,117 @@
return supportedTypes;
}

bool searchConfigs()
{
pthread_mutex_lock(&dsLock);

void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
if (dllib) {
kConfigs1 = (dsAudioTypeConfig_t *) dlsym(dllib, "kAudioConfigs");
if (kConfigs1) {
INT_INFO("kAudioConfigs is defined and loaded kConfigs1 = %p\r\n", kConfigs1);
printf("%d:%s: kAudioConfigs is defined and loaded kConfigs1 = %p\n", __LINE__, __func__, kConfigs1);
}
else {
INT_ERROR("kAudioConfigs is not defined\r\n");
Copy link
Contributor

Choose a reason for hiding this comment

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

why two seprate error line? combined to 1

Copy link
Author

Choose a reason for hiding this comment

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

Done

INT_ERROR("%d:%s: kAudioConfigs is not defined\n", __LINE__, __func__);
}

pKConSize = (int *) dlsym(dllib, "kAudioConfigs_size");
if(pKConSize)
{
kConfig_size_local = *pKConSize;
INT_INFO("%d:%s: kAudioConfigs_size is defined and loaded kConfig_size_local = %d\n", __LINE__, __func__, kConfig_size_local);
}
else
{
INT_ERROR("%d:%s: kAudioConfigs_size is not defined\n", __LINE__, __func__);
kConfig_size_local = -1;
}

kPorts1 = (dsAudioPortConfig_t *) dlsym(dllib, "kAudioPorts");
if (kPorts1) {
INT_INFO("kAudioPorts is defined and loaded kPorts1 = %p\r\n", kPorts1);
INT_INFO("%d:%s: kAudioPorts is defined and loaded kPorts1 = %p\n", __LINE__, __func__, kPorts1);
}
else {
INT_ERROR("kAudioPorts is not defined\r\n");
INT_ERROR("%d:%s: kAudioPorts is not defined\n", __LINE__, __func__);
}

pKPortSize = (int *) dlsym(dllib, "kAudioPorts_size");
if(pKPortSize)
{
kPort_size_local = *pKPortSize;
INT_INFO("%d:%s: kAudioPorts_size is defined and loaded kPort_size_local = %d\n", __LINE__, __func__, kPort_size_local);
}
else
{
INT_ERROR("%d:%s: kAudioPorts_size is not defined\n", __LINE__, __func__);
kPort_size_local = -1;
}
dlclose(dllib);
}
else {
INT_ERROR("Opening libdshalsrv.so failed\r\n");
INT_ERROR("%d:%s: Opening libdshalsrv.so failed\n", __LINE__, __func__);
}
pthread_mutex_unlock(&dsLock);
#if DEBUG
INT_INFO("\n\n=========================================================================================================================\n\n");
Copy link
Contributor

Choose a reason for hiding this comment

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

i see many comment from yova regardig null check so go thought all the changes and make sure pointer has null check

Copy link
Author

Choose a reason for hiding this comment

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

Taken care.

INT_INFO("\n%d:%s print configs using extern\n", __LINE__, __func__);
//printf("%d:%s: size of(kConfig_audio) = %d size of(kPort_audio) = %d\n", __LINE__, __func__, kConfig_size, kPort_size);
//kConfig_size_local = kConfig_size;
//kPort_size_local = kPort_size;

if(kConfigs1 != NULL && kConfig_size_local != -1)
{
for (size_t i = 0; i < kConfig_size_local; i++) {
const dsAudioTypeConfig_t *typeCfg = &kConfigs1[i];
//AudioOutputPortType &aPortType = AudioOutputPortType::getInstance(typeCfg->typeId);
//aPortType.enable();
INT_INFO("%d:%s: typeCfg->typeId = %d\n", __LINE__, __func__, typeCfg->typeId);
INT_INFO("%d:%s: typeCfg->name = %s\n", __LINE__, __func__, typeCfg->name);
INT_INFO("%d:%s: typeCfg->numSupportedEncodings = %zu\n", __LINE__, __func__, typeCfg->numSupportedEncodings);
INT_INFO("%d:%s: typeCfg->numSupportedCompressions = %zu\n", __LINE__, __func__, typeCfg->numSupportedCompressions);
INT_INFO("%d:%s: typeCfg->numSupportedStereoModes = %zu\n", __LINE__, __func__, typeCfg->numSupportedStereoModes);
}
}
else
{
INT_ERROR("%d:%s: kAudioConfigs is NULL and kConfig_size_local is -1\n", __LINE__, __func__);
}
if(kPorts1 != NULL && kPort_size_local != -1)
{
/*
* set up ports based on kPorts[]
*/
for (size_t i = 0; i < kPort_size_local; i++) {
const dsAudioPortConfig_t *port = &kPorts1[i];
INT_INFO("%d:%s: port->id.type = %d\n", __LINE__, __func__, port->id.type);
INT_INFO("%d:%s: port->id.index = %d\n", __LINE__, __func__, port->id.index);
}
}
else
{
INT_ERROR("%d:%s: kAudioPorts is NULL and kPort_size_local is -1\n", __LINE__, __func__);
}
INT_INFO("\n\n=========================================================================================================================\n\n");
#endif
if(kConfigs1 == NULL || kConfig_size_local == -1 || kPorts1 == NULL || kPort_size_local == -1)
{
printf("Either kAudioConfigs or kAudioPorts is NULL and kConfig_size_local is -1, kPort_size_local is -1\n");
return false;
}
else
{
printf("Both kAudioConfigs and kAudioPorts, kConfig_size_local, kPort_size_local are valid\n");
return true;
}
//return (kConfigs1 && kPorts1);
}


void AudioOutputPortConfig::load()
{
try {
Expand All @@ -133,6 +253,47 @@

}

if(searchConfigs() == true)
{
/*
* Initialize Audio portTypes (encodings, compressions etc.)
* and its port instances (db, level etc)
*/
if(kConfigs1 != NULL)
{
for (size_t i = 0; i < kConfig_size_local; i++) {
const dsAudioTypeConfig_t *typeCfg = &kConfigs1[i];
AudioOutputPortType &aPortType = AudioOutputPortType::getInstance(typeCfg->typeId);
aPortType.enable();
for (size_t j = 0; j < typeCfg->numSupportedEncodings; j++) {
aPortType.addEncoding(AudioEncoding::getInstance(typeCfg->encodings[j]));
_aEncodings.at(typeCfg->encodings[j]).enable();
}
for (size_t j = 0; j < typeCfg->numSupportedCompressions; j++) {
aPortType.addCompression(typeCfg->compressions[j]);
_aCompressions.at(typeCfg->compressions[j]).enable();
}
for (size_t j = 0; j < typeCfg->numSupportedStereoModes; j++) {
aPortType.addStereoMode(typeCfg->stereoModes[j]);
_aStereoModes.at(typeCfg->stereoModes[j]).enable();
}
}

/*
* set up ports based on kPorts[]
*/
if(kPorts1 != NULL)
{
for (size_t i = 0; i < kPort_size_local; i++) {
const dsAudioPortConfig_t *port = &kPorts1[i];
_aPorts.push_back(AudioOutputPort((port->id.type), port->id.index, i));
_aPortTypes.at(port->id.type).addPort(_aPorts.at(i));
}
}
}

}
else{
/*
* Initialize Audio portTypes (encodings, compressions etc.)
* and its port instances (db, level etc)
Expand Down Expand Up @@ -165,6 +326,7 @@
_aPorts.push_back(AudioOutputPort((port->id.type), port->id.index, i));
_aPortTypes.at(port->id.type).addPort(_aPorts.at(i));
}
}

}
catch(const Exception &e) {
Expand Down
Loading