Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDK-53879 : Added DeviceInfo.socname property #5812

Open
wants to merge 6 commits into
base: sprint/24Q4
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions .github/workflows/L1-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ jobs:
&&
git apply "${{github.workspace}}/rdkservices/Tests/L1Tests/patches/0001-Add-IAnalytics-interface-R2.patch"
&&
git apply "${{github.workspace}}/rdkservices/Tests/L1Tests/patches/0002-RDK-53879-Add-socname.patch"
&&
cd ..

- name: Build ThunderInterfaces
Expand Down
1 change: 1 addition & 0 deletions DeviceInfo/DeviceInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ namespace Plugin {
uint32_t get_make(JsonData::DeviceInfo::MakeData& response) const;
uint32_t get_modelname(JsonData::DeviceInfo::ModelnameData& response) const;
uint32_t get_devicetype(JsonData::DeviceInfo::DevicetypeData& response) const;
uint32_t get_socname(JsonData::DeviceInfo::SocnameData& response) const;
uint32_t get_distributorid(JsonData::DeviceInfo::DistributoridData& response) const;
uint32_t get_supportedaudioports(JsonData::DeviceInfo::SupportedaudioportsData& response) const;
uint32_t get_supportedvideodisplays(JsonData::DeviceInfo::SupportedvideodisplaysData& response) const;
Expand Down
31 changes: 31 additions & 0 deletions DeviceInfo/DeviceInfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,16 @@
"description": "Device type",
"example": "IpStb"
},
"socname": {
"type": "string",
"enum": [
"Amlogic",
"Realtek",
"Broadcom"
],
"description": "SOC Name",
"example": "Realtek"
},
"make": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -573,6 +583,27 @@
}
]
},
"socname": {
"summary": "SOC Name",
"readonly": true,
"params": {
"type": "object",
"properties": {
"socname": {
"$ref": "#/definitions/socname"
}
},
"required": [
"socname"
]
},
"errors": [
{
"description": "General error",
"$ref": "#/common/errors/general"
}
]
},
"distributorid": {
"summary": "Partner ID or distributor ID for device",
"readonly": true,
Expand Down
25 changes: 25 additions & 0 deletions DeviceInfo/DeviceInfoJsonRpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ namespace Plugin {
Property<MakeData>(_T("make"), &DeviceInfo::get_make, nullptr, this);
Property<ModelnameData>(_T("modelname"), &DeviceInfo::get_modelname, nullptr, this);
Property<DevicetypeData>(_T("devicetype"), &DeviceInfo::get_devicetype, nullptr, this);
Property<SocnameData>(_T("socname"), &DeviceInfo::get_socname, nullptr, this);
Property<DistributoridData>(_T("distributorid"), &DeviceInfo::get_distributorid, nullptr, this);
Property<SupportedaudioportsData>(_T("supportedaudioports"), &DeviceInfo::get_supportedaudioports, nullptr, this);
Property<SupportedvideodisplaysData>(_T("supportedvideodisplays"), &DeviceInfo::get_supportedvideodisplays, nullptr, this);
Expand All @@ -63,6 +64,7 @@ namespace Plugin {
Unregister(_T("make"));
Unregister(_T("modelname"));
Unregister(_T("devicetype"));
Unregister(_T("socname"));
Unregister(_T("distributorid"));
Unregister(_T("supportedaudioports"));
Unregister(_T("supportedvideodisplays"));
Expand Down Expand Up @@ -243,6 +245,29 @@ namespace Plugin {
return result;
}

// Property: socname - SOC Name
// Return codes:
// - ERROR_NONE: Success
// - ERROR_GENERAL: General error
uint32_t DeviceInfo::get_socname(SocnameData& response) const
{
string socType;

auto result = _deviceInfo->SocName(socType);

if (result == Core::ERROR_NONE) {
Core::EnumerateType<JsonData::DeviceInfo::SocnameData::SocnameType> value(socType.c_str(), false);
if (value.IsSet()) {
response.Socname = value.Value();
} else {
TRACE(Trace::Fatal, (_T("Unknown value %s"), socType.c_str()));
result = Core::ERROR_GENERAL;
}
}

return result;
}

// Property: distributorid - Partner ID or distributor ID for device
// Return codes:
// - ERROR_NONE: Success
Expand Down
47 changes: 47 additions & 0 deletions DeviceInfo/Implementation/DeviceInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,37 @@
namespace WPEFramework {
namespace Plugin {
namespace {

static const char *Sku2Soc[][2] = {
{ "PLTL11AEI" , "Amlogic" },
{ "ZWCN11MWI" , "Amlogic" },
{ "SKTL11AEI" , "Amlogic" },
//{ "LS301" , "" }, // ?
{ "HSTP11MWR" , "Amlogic" },
{ "HSTP11MWRFX50", "Amlogic" },
{ "ELTE11MWR" , "Amlogic" },
{ "SKXI11ADS" , "Realtek" },
{ "SKXI11AIS" , "Realtek" },
{ "SKXI11ANS" , "Realtek" },
{ "SCXI11AIC" , "Realtek" },
{ "SCXI11BEI" , "Broadcom" },
//{ "CMXI11BEI" , "" }, // ?
{ "AX013AN" , "Broadcom" },
{ "AX014AN" , "Broadcom" },
{ "AX061AEI" , "Broadcom" },
{ "MX011AN" , "Broadcom" },
{ "CS011AN" , "Broadcom" },
{ "CXD01ANI" , "Broadcom" },
//{ "PX001AN" , "Intel" },
{ "PX013AN" , "Broadcom" },
{ "PX022AN" , "Broadcom" },
{ "PX032ANI" , "Broadcom" },
{ "PX051AEI" , "Broadcom" },
{ "PXD01ANI" , "Broadcom" },
{ "SX022AN" , "Broadcom" },
{ "TX061AEI" , "Broadcom" }
};

uint32_t GetFileRegex(const char* filename, const std::regex& regex, string& response)
{
uint32_t result = Core::ERROR_GENERAL;
Expand Down Expand Up @@ -133,6 +164,22 @@ namespace Plugin {
#endif
}

uint32_t DeviceInfoImplementation::SocName(string& socName) const
{
string sku;

auto result = Sku(sku);
if (result == Core::ERROR_NONE) {
for (int n = sizeof(Sku2Soc) / sizeof(*Sku2Soc) - 1; n >= 0; n--) {
if (strcmp(Sku2Soc[n][0], sku.c_str()) == 0) {
socName = Sku2Soc[n][1];
return result;
}
}
}
return Core::ERROR_GENERAL;
}

uint32_t DeviceInfoImplementation::DistributorId(string& distributorId) const
{
return (GetFileRegex(_T("/opt/www/authService/partnerId3.dat"),
Expand Down
1 change: 1 addition & 0 deletions DeviceInfo/Implementation/DeviceInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace Plugin {
uint32_t Make(string& make) const override;
uint32_t Model(string& model) const override;
uint32_t DeviceType(string& deviceType) const override;
uint32_t SocName(string& socName) const override;
uint32_t DistributorId(string& distributorId) const override;
};
}
Expand Down
61 changes: 61 additions & 0 deletions Tests/L1Tests/patches/0002-RDK-53879-Add-socname.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
diff --git a/interfaces/IDeviceInfo2.h b/interfaces/IDeviceInfo2.h
index f87914d..10397a9 100644
--- a/interfaces/IDeviceInfo2.h
+++ b/interfaces/IDeviceInfo2.h
@@ -17,6 +17,7 @@ namespace Exchange {
virtual uint32_t Make(string& make /* @out */) const = 0;
virtual uint32_t Model(string& model /* @out */) const = 0;
virtual uint32_t DeviceType(string& deviceType /* @out */) const = 0;
+ virtual uint32_t SocName(string& socName /* @out */) const = 0;
virtual uint32_t DistributorId(string& distributorId /* @out */) const = 0;
};

diff --git a/jsonrpc/DeviceInfo.json b/jsonrpc/DeviceInfo.json
index ed32927..9823b86 100644
--- a/jsonrpc/DeviceInfo.json
+++ b/jsonrpc/DeviceInfo.json
@@ -196,6 +196,16 @@
"description": "Device model number or SKU",
"example": "PX051AEI"
},
+ "socname": {
+ "type": "string",
+ "enum": [
+ "Amlogic",
+ "Realtek",
+ "Broadcom"
+ ],
+ "description": "SOC Name",
+ "example": "Realtek"
+ },
"yocto": {
"type": "string",
"enum": [
@@ -609,6 +619,27 @@
}
]
},
+ "socname": {
+ "summary": "Device type",
+ "readonly": true,
+ "params": {
+ "type": "object",
+ "properties": {
+ "socname": {
+ "$ref": "#/definitions/socname"
+ }
+ },
+ "required": [
+ "socname"
+ ]
+ },
+ "errors": [
+ {
+ "description": "General error",
+ "$ref": "#/common/errors/general"
+ }
+ ]
+ },
"supportedaudioports": {
"summary": "Audio ports supported on the device (all ports that are physically present)",
"readonly": true,
Loading
Loading