From f361efe965a8f764ad1abeabeb3229646e458427 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 6 Dec 2022 18:31:03 +0100 Subject: backend/drm: add drm_connector_status_str() Helper to stringify a connector status. --- backend/drm/util.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'backend/drm/util.c') diff --git a/backend/drm/util.c b/backend/drm/util.c index 03c4b0b4..adb9306e 100644 --- a/backend/drm/util.c +++ b/backend/drm/util.c @@ -119,6 +119,18 @@ void parse_edid(struct wlr_drm_connector *conn, size_t len, const uint8_t *data) } } +const char *drm_connector_status_str(drmModeConnection status) { + switch (status) { + case DRM_MODE_CONNECTED: + return "connected"; + case DRM_MODE_DISCONNECTED: + return "disconnected"; + case DRM_MODE_UNKNOWNCONNECTION: + return "unknown"; + } + return ""; +} + static bool is_taken(size_t n, const uint32_t arr[static n], uint32_t key) { for (size_t i = 0; i < n; ++i) { if (arr[i] == key) { -- cgit v1.2.3