Skip to content

Commit

Permalink
Merge pull request #8 from rdkcentral/develop
Browse files Browse the repository at this point in the history
Picking ds fix from develop to main
  • Loading branch information
arun-madhavan-013 authored Oct 8, 2024
2 parents 7419888 + 12fd958 commit 54b197a
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions dsDisplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,25 +426,33 @@ TV_SUPPORTED_MODE_T dsVideoPortgetVideoFormatFromInfo(dsVideoResolution_t res, u
}

/**
* @brief To get the EDID buffer and length of the connected display
* @brief Gets the EDID buffer and EDID length of connected display device.
*
* This function is used to get the EDID buffer and EDID size of the connected display corresponding to
* the specified display device handle.
*
* This function is used to get the EDID information of the connected display
* @param[in] handle - Handle of the display device
* @param[out] edid - Pointer to raw EDID buffer
* @param[out] length - length of the EDID buffer data. Min value is 0
*
* @param [in] handle Handle for the video display. This must be HDMI output
* handle.
* @param [out] **edid The EDID raw buffer of the display. The HAL implementation should
* malloc() the buffer and return it to the application. The
* application is required to free() the buffer after using it;
* If HDMI is not connected no data should be returned,
* and the API returns dsERR_INVALID_STATE.
* @length [out] *length The length of EDID buffer data
* @return dsError_t Error code.
* @note Caller is responsible for allocating memory for edid( please refer ::MAX_EDID_BYTES_LEN ) and freeing the EDID buffer
*
* @return dsError_t - Status
* @retval dsERR_NONE - Success
* @retval dsERR_INVALID_PARAM - Parameter passed to this function is invalid
* @retval dsERR_NOT_INITIALIZED - Module is not initialised
* @retval dsERR_OPERATION_NOT_SUPPORTED - The attempted operation is not supported
* @retval dsERR_GENERAL - Underlying undefined platform error
*
* @pre dsDisplayInit() and dsGetDisplay() must be called before calling this API
*
* @warning This API is Not thread safe
*
*/
dsError_t dsGetEDIDBytes(intptr_t handle, unsigned char *edid, int *length)
{
dsError_t ret = dsERR_NONE;
uint8_t buffer[128];
unsigned char *edidBuf = NULL;
size_t offset = 0;
int i, extensions = 0;
VDISPHandle_t *vDispHandle = (VDISPHandle_t *) handle;
Expand All @@ -462,18 +470,12 @@ dsError_t dsGetEDIDBytes(intptr_t handle, unsigned char *edid, int *length)
int siz = vc_tv_hdmi_ddc_read(offset, sizeof (buffer), buffer);
offset += sizeof( buffer);
extensions = buffer[0x7e]; /* This tells you how many more blocks to read */
edidBuf = (unsigned char *)malloc((extensions+1)*sizeof(buffer));
if (!edidBuf) {
printf("Failed to allocate memory");
return ret;
}
memcpy(edidBuf, (unsigned char *)buffer, sizeof(buffer));
memcpy(edid, (unsigned char *)buffer, sizeof(buffer));
/* First block always exist */
for(i = 0; i < extensions; i++, offset += sizeof( buffer)) {
siz = vc_tv_hdmi_ddc_read(offset, sizeof( buffer), buffer);
memcpy(edidBuf+offset, (unsigned char *)buffer, sizeof(buffer));
memcpy(edid+offset, (unsigned char *)buffer, sizeof(buffer));
}
edid = edidBuf;
*length = offset;
return ret;
}
Expand Down

0 comments on commit 54b197a

Please sign in to comment.