summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2014-01-17 12:19:17 +0100
committerAlex Deucher <alexander.deucher@amd.com>2014-01-24 17:51:05 -0500
commitce62b8e0596b4805cb7e09a4a4e66de5c7b11cf3 (patch)
tree7ae71f7a6fa896510d09d637a7f2f32a11837447
parent46d451c9a9514df9de01df647a3f397c5b5d7d1a (diff)
modeprint: pretty print connector names
Use same names as the kernel, makes it easier to identify connectors in the common case. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Rob Clark <robdclark@gmail.com>
-rw-r--r--tests/modeprint/modeprint.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/modeprint/modeprint.c b/tests/modeprint/modeprint.c
index 545ff40a..6f0d0390 100644
--- a/tests/modeprint/modeprint.c
+++ b/tests/modeprint/modeprint.c
@@ -41,6 +41,8 @@
#include "xf86drm.h"
#include "xf86drmMode.h"
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+
int connectors;
int full_props;
int edid;
@@ -140,13 +142,37 @@ int printProperty(int fd, drmModeResPtr res, drmModePropertyPtr props, uint64_t
return 0;
}
+static const char * const output_names[] = { "None",
+ "VGA",
+ "DVI-I",
+ "DVI-D",
+ "DVI-A",
+ "Composite",
+ "SVIDEO",
+ "LVDS",
+ "Component",
+ "DIN",
+ "DP",
+ "HDMI-A",
+ "HDMI-B",
+ "TV",
+ "eDP",
+ "Virtual",
+ "DSI",
+};
+
int printConnector(int fd, drmModeResPtr res, drmModeConnectorPtr connector, uint32_t id)
{
int i = 0;
struct drm_mode_modeinfo *mode = NULL;
drmModePropertyPtr props;
- printf("Connector: %d-%d\n", connector->connector_type, connector->connector_type_id);
+ if (connector->connector_type < ARRAY_SIZE(output_names))
+ printf("Connector: %s-%d\n", output_names[connector->connector_type],
+ connector->connector_type_id);
+ else
+ printf("Connector: %d-%d\n", connector->connector_type,
+ connector->connector_type_id);
printf("\tid : %i\n", id);
printf("\tencoder id : %i\n", connector->encoder_id);
printf("\tconn : %s\n", getConnectionText(connector->connection));