Skip to content
Open
1 change: 1 addition & 0 deletions c_sourcecode/common/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ typedef enum {
DEVICE_TYPE_VIDEO,
DEVICE_TYPE_EXTENDER,
DEVICE_TYPE_MEDIACLIENT,
DEVICE_TYPE_RDKC,
DEVICE_TYPE_UNKNOWN
} device_type_t;

Expand Down
33 changes: 33 additions & 0 deletions c_sourcecode/src/archive/archive.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,39 @@ int archive_create_smart(const dump_file_t *dump, const config_t *config,
CRASHUPLOAD_INFO("core log file=%s\n", arch_files_list[2]);
tar_status = create_tarball(true, target_file_name, arch_files_list, no_of_files);
}
else if (config->device_type == DEVICE_TYPE_RDKC)
{
/* RDKC Camera minidump archive:
* Matches script uploadDumps.sh line 917 for DEVICE_TYPE=RDKC
* Archive: dumpName + version.txt + core_log.txt
* Non-prod: also receiver.log and thread.log if present
*/
snprintf(arch_files_list[0], 256, "%s", new_dump_name);
snprintf(arch_files_list[1], 256, "%s", "/version.txt");
snprintf(arch_files_list[2], 256, "%s", config->core_log_file);

if (config->build_type != BUILD_TYPE_PROD)
{
char receiver_log[PATH_MAX] = {0};
char thread_log[PATH_MAX] = {0};
snprintf(receiver_log, sizeof(receiver_log), "%s/receiver.log", config->log_path);
snprintf(thread_log, sizeof(thread_log), "%s/thread.log", config->log_path);
if (0 == (filePresentCheck(receiver_log)))
{
snprintf(arch_files_list[no_of_files], 256, "%s", receiver_log);
CRASHUPLOAD_INFO("RDKC adding receiver.log=%s\n", arch_files_list[no_of_files]);
no_of_files++;
}
if (0 == (filePresentCheck(thread_log)))
{
snprintf(arch_files_list[no_of_files], 256, "%s", thread_log);
CRASHUPLOAD_INFO("RDKC adding thread.log=%s\n", arch_files_list[no_of_files]);
no_of_files++;
}
}
CRASHUPLOAD_INFO("RDKC tar file:%s files=%d\n", target_file_name, no_of_files);
tar_status = create_tarball(true, target_file_name, arch_files_list, no_of_files);
}
Comment on lines +399 to +431
}
if (!tar_status)
{
Expand Down
21 changes: 21 additions & 0 deletions c_sourcecode/src/config/config_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ int config_init_load(config_t *config, int argc, char *argv[])
config->device_type = DEVICE_TYPE_EXTENDER;
strcpy(config->core_log_file, "/var/log/messages");
}
else if (0 == (strncmp(device_prop_data, "XHC1", 4)))
{
config->device_type = DEVICE_TYPE_RDKC;
CRASHUPLOAD_INFO("device type RDKC=%d\n", config->device_type);
snprintf(config->core_log_file, sizeof(config->core_log_file), "%s/%s", log_path, "core_log.txt");
CRASHUPLOAD_INFO("core log=%s\n", config->core_log_file);
}
else
{
config->device_type = DEVICE_TYPE_UNKNOWN;
Expand All @@ -147,6 +154,20 @@ int config_init_load(config_t *config, int argc, char *argv[])
strcpy(config->core_path, "/var/lib/systemd/coredump");
strcpy(config->minidump_path, "/opt/minidumps");
}
/* Override paths for non-systemd RDKC camera */
if (config->upload_mode == UPLOAD_MODE_NORMAL &&
config->device_type == DEVICE_TYPE_RDKC)
{
strcpy(config->core_path, "/opt/corefiles");
/* minidump_path remains /opt/minidumps - already correct for RDKC */
}
/* BOX_TYPE fallback for RDKC camera (no BOX_TYPE in device.properties) */
if (strcmp(config->box_type, "UNKNOWN") == 0 &&
config->device_type == DEVICE_TYPE_RDKC)
{
strcpy(config->box_type, "xcam");

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.

same here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed !!

CRASHUPLOAD_INFO("BOX_TYPE defaulted to xcam for RDKC\n");
}
Comment on lines 126 to +170
if (argc >= 3)
{
if (0 == atoi(argv[2]))
Expand Down
58 changes: 57 additions & 1 deletion c_sourcecode/src/rfcInterface/rfcinterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,60 @@
#endif

#if defined(RFC_API_ENABLED)

#if defined(RDKC)
/* RDKC uses 2-param getRFCParameter that reads from ini files.
* Returns int: SUCCESS(0) or FAILURE(1). No setRFCParameter available. */
int read_RFCProperty(const char *type, const char *key, char *out_value, size_t datasize)

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.

Why you need same duplicate function?

{
RFC_ParamData_t param;
int data_len;
Comment on lines +31 to +34

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added (void)type; in read_RFCProperty (only unused param there) and (void)type; (void)key; (void)value; (void)datatype; in write_RFCProperty (all params unused).

int ret = READ_RFC_FAILURE;
(void)type;

if (key == NULL || out_value == NULL || datasize == 0)
{
CRASHUPLOAD_ERROR("read_RFCProperty() one or more input values are invalid\n");
return ret;
}
int status = getRFCParameter(key, &param);
if (status == SUCCESS)
{
data_len = strlen(param.value);
if (data_len >= 2 && (param.value[0] == '"') && (param.value[data_len - 1] == '"'))
{
// remove quotes around data
snprintf(out_value, datasize, "%s", &param.value[1]);
size_t term_idx = (size_t)(data_len - 2) < (datasize - 1) ? (size_t)(data_len - 2) : (datasize - 1);
out_value[term_idx] = '\0';
}
Comment on lines +46 to +53

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The terminator index is now clamped: min(data_len - 2, datasize - 1) — so if snprintf truncated the output, the null-terminator write stays within the out_value buffer bounds.

else
{
snprintf(out_value, datasize, "%s", param.value);
}
CRASHUPLOAD_INFO("read_RFCProperty() name=%s,value=%s\n", param.name, param.value);
ret = READ_RFC_SUCCESS;
}
else
{
CRASHUPLOAD_ERROR("error:read_RFCProperty(): status=%d key=%s\n", status, key);
*out_value = 0;
}
return ret;
}

int write_RFCProperty(const char *type, const char *key, const char *value, RFCVALDATATYPE datatype)
{
(void)type;
(void)key;
(void)value;
(void)datatype;
/* RDKC rfcapi does not support setRFCParameter */
CRASHUPLOAD_INFO("%s: Not supported on RDKC\n", __FUNCTION__);
return WRITE_RFC_NOTAPPLICABLE;
}

#else /* !RDKC — Standard STB path (3-param version with WDMP_STATUS) */
/* Description: Reading rfc data
* @param type : rfc type
* @param key: rfc key
Expand Down Expand Up @@ -106,7 +160,9 @@ int write_RFCProperty(char *type, const char *key, const char *value, RFCVALDATA
}
return ret;
}
#else
#endif /* RDKC */

#else /* !RFC_API_ENABLED */
/* Description: Below function should be implement Reading rfc data for RDK-M
* @param type : rfc type
* @param key: rfc key
Expand Down
5 changes: 5 additions & 0 deletions c_sourcecode/src/rfcInterface/rfcinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,13 @@ typedef enum
#define RFC_CRASH_PORTAL_ENDPOINT_URL "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.CrashportalEndpoint.URL"

#if defined(RFC_API_ENABLED)
#if defined(RDKC)

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.

Why you need. Already these functions are declared and defined

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

the RDKC rfcapi.h would need 2-param getRFCParameter signature as not like the STB version 3-param — that's a difference there in the rfc library itself which forces us to make to do change in crashupload.

int read_RFCProperty(const char *type, const char *key, char *data, size_t datasize);
int write_RFCProperty(const char *type, const char *key, const char *data, RFCVALDATATYPE datatype);
#else
int read_RFCProperty(char *type, const char *key, char *data, size_t datasize);
int write_RFCProperty(char *type, const char *key, const char *data, RFCVALDATATYPE datatype);
#endif
#else
int read_RFCProperty(const char *type, const char *key, char *data, size_t datasize);
int write_RFCProperty(const char *type, const char *key, const char *data, RFCVALDATATYPE datatype);
Expand Down
43 changes: 41 additions & 2 deletions c_sourcecode/src/upload/upload.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
#define RETRY_DELAY_SECONDS 5
#define SIZE_POSTFIELD_BUF 2048

#ifdef RDKC
#define RDKC_PARTNER_ID_FILE "/opt/usr_config/partnerid.txt"
#endif

#if 0
/* FULL IMPLEMENTATION - Progress callback for upload monitoring */
static int upload_progress_callback(void *clientp, curl_off_t dltotal, curl_off_t dlnow,
Expand All @@ -61,7 +65,7 @@ int get_crashupload_s3signed_url(char *url, size_t size_buf)
ret = read_RFCProperty("S3SignedUrl", RFC_CRASHUPLOAD_S3URL, url, size_buf);
if ((ret == READ_RFC_FAILURE) || (url[0] == '\0'))
{
CRASHUPLOAD_WARN("Read rfc failed For S3SignedUrl. Reading From device.properies file\n");
CRASHUPLOAD_WARN("Read rfc failed For S3SignedUrl. Reading From device.properties file\n");
ret = getDevicePropertyData("S3_AMAZON_SIGNING_URL", url, size_buf);
if (ret == UTILS_SUCCESS)
{
Expand Down Expand Up @@ -369,8 +373,24 @@ int upload_process(archive_info_t *archive, const config_t *config, const platfo
char md5sum[128] = {0};
char dump_name[16] = {0};
char crash_fw_version[128] = {0};
// size_t GetPartnerId( char *pPartnerId, size_t szBufSize );
#ifdef RDKC
{
FILE *fp = fopen(RDKC_PARTNER_ID_FILE, "r");
if (fp)
{
if (fgets(pPartnerId, sizeof(pPartnerId), fp))
{
size_t plen = strlen(pPartnerId);
if (plen > 0 && pPartnerId[plen - 1] == '\n')
pPartnerId[plen - 1] = '\0';
}
fclose(fp);
}
ret = (pPartnerId[0] != '\0') ? 1 : 0;
}
#else
ret = GetPartnerId(pPartnerId, sizeof(pPartnerId));
#endif
if (ret == 0)
{
strcpy(pPartnerId, "comcast");
Expand Down Expand Up @@ -422,6 +442,25 @@ int upload_process(archive_info_t *archive, const config_t *config, const platfo
CRASHUPLOAD_INFO("Read rfc Success crashportalEndpointUrl:\n Overriding the S3 Amazon Signing URL:%s\n", crashportalEndpointUrl);
}
}
else if (config->device_type == DEVICE_TYPE_RDKC)
{
/* RDKC Camera upload flow:
* Matches script uploadDumps.sh - encryptionEnable=false (no /etc/os-release)
* S3 URL from device.properties S3_AMAZON_SIGNING_URL
* Portal URL: crashportal.stb.r53.xcal.tv
*/
Comment on lines +447 to +451
strcpy(encryptionEnable, "false");
strcpy(portal_url, "crashportal.stb.r53.xcal.tv");
request_type = 17;
CRASHUPLOAD_INFO("RDKC: request_type=%d\n", request_type);
ret = get_crashupload_s3signed_url(crashportalEndpointUrl, sizeof(crashportalEndpointUrl));
if (ret < 0)
{
CRASHUPLOAD_ERROR("RDKC: Unable to get the S3 server url. So exit\n");
return ret;
}
CRASHUPLOAD_INFO("RDKC: S3 signing URL=%s\n", crashportalEndpointUrl);
}
Comment on lines 376 to +463
else if (config->device_type == DEVICE_TYPE_BROADBAND)
{
ret = -1;
Expand Down
2 changes: 1 addition & 1 deletion c_sourcecode/src/utils/prerequisites.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void defer_upload_if_needed(device_type_t device_type)
{
int ret = -1;

if (device_type == DEVICE_TYPE_MEDIACLIENT)
if (device_type == DEVICE_TYPE_MEDIACLIENT || device_type == DEVICE_TYPE_RDKC)
{
FILE *fp = fopen(UPTIME_FILE, "r");
if (!fp)
Expand Down
Loading
Loading