From a101c410ba97d9a404efd05c727094e3f319563e Mon Sep 17 00:00:00 2001 From: Paulo Zanoni Date: Fri, 24 Jan 2014 18:47:40 -0200 Subject: [PATCH] tests/pm_pc8: add debug info to i2c subtest Signed-off-by: Paulo Zanoni --- tests/pm_pc8.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/tests/pm_pc8.c b/tests/pm_pc8.c index f34a113..9dbab95 100644 --- a/tests/pm_pc8.c +++ b/tests/pm_pc8.c @@ -558,10 +558,16 @@ static void assert_drm_infos_equal(struct compare_data *d1, /* We could check the checksum too, but just the header is probably enough. */ static bool edid_is_valid(const unsigned char *edid) { + int i; + char edid_header[] = { 0x0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0, }; + printf("edid: "); + for (i = 0; i < 8; i++) + printf("%02x", edid[i]); + printf("\n"); return (memcmp(edid, edid_header, sizeof(edid_header)) == 0); } @@ -569,9 +575,17 @@ static int count_drm_valid_edids(struct mode_set_data *data) { int i, ret = 0; - for (i = 0; i < data->res->count_connectors; i++) - if (data->edids[i] && edid_is_valid(data->edids[i]->data)) - ret++; + for (i = 0; i < data->res->count_connectors; i++) { + printf("Connector %d ", data->connectors[i]->connector_id); + printf("edids:%p ", data->edids[i]); + if (data->edids[i]) { + bool valid = edid_is_valid(data->edids[i]->data); + if (valid) + ret++; + printf("valid:%d", valid); + } + printf("\n"); + } return ret; } @@ -605,6 +619,7 @@ static int count_i2c_valid_edids(void) { int fd, ret = 0; DIR *dir; + bool valid; struct dirent *dirent; char full_name[32]; @@ -617,8 +632,13 @@ static int count_i2c_valid_edids(void) snprintf(full_name, 32, "/dev/%s", dirent->d_name); fd = open(full_name, O_RDWR); igt_assert(fd != -1); - if (i2c_edid_is_valid(fd)) + valid = i2c_edid_is_valid(fd); + + if (valid) ret++; + + printf("file:%s valid:%d\n", full_name, valid); + close(fd); } } @@ -633,7 +653,9 @@ static void test_i2c(struct mode_set_data *data) int i2c_edids = count_i2c_valid_edids(); int drm_edids = count_drm_valid_edids(data); - igt_assert(i2c_edids == drm_edids); + printf("i2c:%d drm:%d\n", i2c_edids, drm_edids); + igt_assert_f(i2c_edids == drm_edids, "i2c:%d drm:%d\n", + i2c_edids, drm_edids); } static void setup_runtime_pm(void) -- 1.8.4.2