tests: use drmModeGetConnectorTypeName

Drop util_lookup_connector_type_name and use
drmModeGetConnectorTypeName instead.

Signed-off-by: Simon Ser <contact@emersion.fr>
main
Simon Ser 2022-02-01 14:36:52 +01:00
parent 50f8d51773
commit 0427c1f669
5 changed files with 3 additions and 31 deletions

View File

@ -135,7 +135,7 @@ static int printConnector(int fd, drmModeResPtr res, drmModeConnectorPtr connect
drmModePropertyPtr props; drmModePropertyPtr props;
const char *connector_type_name = NULL; const char *connector_type_name = NULL;
connector_type_name = util_lookup_connector_type_name(connector->connector_type); connector_type_name = drmModeGetConnectorTypeName(connector->connector_type);
if (connector_type_name) if (connector_type_name)
printf("Connector: %s-%d\n", connector_type_name, printf("Connector: %s-%d\n", connector_type_name,

View File

@ -656,7 +656,7 @@ static struct resources *get_resources(struct device *dev)
int num; int num;
num = asprintf(&connector->name, "%s-%u", num = asprintf(&connector->name, "%s-%u",
util_lookup_connector_type_name(conn->connector_type), drmModeGetConnectorTypeName(conn->connector_type),
conn->connector_type_id); conn->connector_type_id);
if (num < 0) if (num < 0)
goto error; goto error;

View File

@ -192,7 +192,7 @@ static void listConnectorProperties(void)
} }
printf("Connector %u (%s-%u)\n", c->connector_id, printf("Connector %u (%s-%u)\n", c->connector_id,
util_lookup_connector_type_name(c->connector_type), drmModeGetConnectorTypeName(c->connector_type),
c->connector_type_id); c->connector_type_id);
listObjectProperties(c->connector_id, listObjectProperties(c->connector_id,

View File

@ -96,33 +96,6 @@ const char *util_lookup_connector_status_name(unsigned int status)
ARRAY_SIZE(connector_status_names)); ARRAY_SIZE(connector_status_names));
} }
static const struct type_name connector_type_names[] = {
{ DRM_MODE_CONNECTOR_Unknown, "unknown" },
{ DRM_MODE_CONNECTOR_VGA, "VGA" },
{ DRM_MODE_CONNECTOR_DVII, "DVI-I" },
{ DRM_MODE_CONNECTOR_DVID, "DVI-D" },
{ DRM_MODE_CONNECTOR_DVIA, "DVI-A" },
{ DRM_MODE_CONNECTOR_Composite, "composite" },
{ DRM_MODE_CONNECTOR_SVIDEO, "s-video" },
{ DRM_MODE_CONNECTOR_LVDS, "LVDS" },
{ DRM_MODE_CONNECTOR_Component, "component" },
{ DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN" },
{ DRM_MODE_CONNECTOR_DisplayPort, "DP" },
{ DRM_MODE_CONNECTOR_HDMIA, "HDMI-A" },
{ DRM_MODE_CONNECTOR_HDMIB, "HDMI-B" },
{ DRM_MODE_CONNECTOR_TV, "TV" },
{ DRM_MODE_CONNECTOR_eDP, "eDP" },
{ DRM_MODE_CONNECTOR_VIRTUAL, "Virtual" },
{ DRM_MODE_CONNECTOR_DSI, "DSI" },
{ DRM_MODE_CONNECTOR_DPI, "DPI" },
};
const char *util_lookup_connector_type_name(unsigned int type)
{
return util_lookup_type_name(type, connector_type_names,
ARRAY_SIZE(connector_type_names));
}
static const char * const modules[] = { static const char * const modules[] = {
"i915", "i915",
"amdgpu", "amdgpu",

View File

@ -28,7 +28,6 @@
const char *util_lookup_encoder_type_name(unsigned int type); const char *util_lookup_encoder_type_name(unsigned int type);
const char *util_lookup_connector_status_name(unsigned int type); const char *util_lookup_connector_status_name(unsigned int type);
const char *util_lookup_connector_type_name(unsigned int type);
int util_open(const char *device, const char *module); int util_open(const char *device, const char *module);