lib: allow the edid to be reset

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
Thomas Wood 2014-07-09 10:38:05 +01:00
parent eef768f283
commit b81020526f
2 changed files with 13 additions and 1 deletions

View File

@ -476,6 +476,8 @@ void kmstest_force_connector(int drm_fd, drmModeConnector *connector, enum
* *
* Set the EDID data on @connector to @edid. See #generic_edid and * Set the EDID data on @connector to @edid. See #generic_edid and
* #kmstest_generic_edid for a set of generic EDID data blocks. * #kmstest_generic_edid for a set of generic EDID data blocks.
*
* If @length is zero, the forced EDID will be removed.
*/ */
void kmstest_force_edid(int drm_fd, drmModeConnector *connector, void kmstest_force_edid(int drm_fd, drmModeConnector *connector,
const unsigned char *edid, size_t length) const unsigned char *edid, size_t length)
@ -491,7 +493,10 @@ void kmstest_force_edid(int drm_fd, drmModeConnector *connector,
igt_assert(debugfs_fd != -1); igt_assert(debugfs_fd != -1);
ret = write(debugfs_fd, edid, length); if (length == 0)
ret = write(debugfs_fd, "reset", 5);
else
ret = write(debugfs_fd, edid, length);
close(debugfs_fd); close(debugfs_fd);
igt_assert(ret != -1); igt_assert(ret != -1);

View File

@ -93,6 +93,13 @@ main (int argc, char **argv)
drmModeFreeConnector(temp); drmModeFreeConnector(temp);
/* remove edid */
kmstest_force_edid(drm_fd, connector, NULL, 0);
temp = drmModeGetConnector(drm_fd, connector->connector_id);
/* the connector should now have the 5 default modes */
igt_assert(temp->count_modes == 5);
drmModeFreeConnector(temp);
/* force the connector off */ /* force the connector off */
kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_OFF); kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_OFF);
temp = drmModeGetConnector(drm_fd, connector->connector_id); temp = drmModeGetConnector(drm_fd, connector->connector_id);