From: Chris Michael Date: Tue, 12 May 2015 15:56:52 +0000 (-0400) Subject: ecore-drm: Fix ecore_drm_output_edid_get to return a hex string X-Git-Tag: v1.15.0-alpha1~602 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df28c380d301e805ece38f54310d4b2992eedfbd;p=platform%2Fupstream%2Fefl.git ecore-drm: Fix ecore_drm_output_edid_get to return a hex string Summary: As we will use the edid string inside RandR code to store unique information about an output, we should be returning this edid in a "readable" form. @fix Signed-off-by: Chris Michael --- diff --git a/src/lib/ecore_drm/ecore_drm_output.c b/src/lib/ecore_drm/ecore_drm_output.c index 0d4ace3..9b571d0 100644 --- a/src/lib/ecore_drm/ecore_drm_output.c +++ b/src/lib/ecore_drm/ecore_drm_output.c @@ -165,7 +165,7 @@ _ecore_drm_output_edid_find(Ecore_Drm_Output *output, drmModeConnector *conn) if (!blob) return; - output->edid_blob = (char *)eina_memdup(blob->data, blob->length, 1); + output->edid_blob = eina_memdup(blob->data, blob->length, 1); ret = _ecore_drm_output_edid_parse(output, blob->data, blob->length); if (!ret) @@ -1235,10 +1235,27 @@ ecore_drm_output_backlight_get(Ecore_Drm_Output *output) EAPI char * ecore_drm_output_edid_get(Ecore_Drm_Output *output) { + char *edid_str = NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(output, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(output->edid_blob, NULL); - return strdup(output->edid_blob); + edid_str = malloc((128 * 2) + 1); + if (edid_str) + { + unsigned int k, kk; + const char *hexch = "0123456789abcdef"; + + for (kk = 0, k = 0; k < 128; k++) + { + edid_str[kk] = hexch[(output->edid_blob[k] >> 4) & 0xf]; + edid_str[kk + 1] = hexch[output->edid_blob[k] & 0xf]; + kk += 2; + } + edid_str[kk] = 0; + } + + return edid_str; } EAPI Eina_List * diff --git a/src/lib/ecore_drm/ecore_drm_private.h b/src/lib/ecore_drm/ecore_drm_private.h index 063ac06..fc32801 100644 --- a/src/lib/ecore_drm/ecore_drm_private.h +++ b/src/lib/ecore_drm/ecore_drm_private.h @@ -123,7 +123,7 @@ struct _Ecore_Drm_Output Ecore_Drm_Output_Mode *current_mode; Eina_List *modes; - char *edid_blob; + unsigned char *edid_blob; struct {