diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2018-08-28 10:31:41 +0300 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2018-08-28 10:31:41 +0300 |
commit | 252d68dc1610d4576d40b687fabbde69a487b16e (patch) | |
tree | dd4ef830861000f79e5eb0a4927a681703696379 /kms++ | |
parent | 7700684ff6935c462a0797d66127a921e1670e47 (diff) |
connector: add connector_status()
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'kms++')
-rw-r--r-- | kms++/inc/kms++/connector.h | 9 | ||||
-rw-r--r-- | kms++/src/connector.cpp | 12 |
2 files changed, 21 insertions, 0 deletions
diff --git a/kms++/inc/kms++/connector.h b/kms++/inc/kms++/connector.h index 3407730..155f916 100644 --- a/kms++/inc/kms++/connector.h +++ b/kms++/inc/kms++/connector.h @@ -10,6 +10,13 @@ namespace kms struct ConnectorPriv; +enum class ConnectorStatus +{ + Unknown, + Connected, + Disconnected, +}; + class Connector : public DrmPropObject { friend class Card; @@ -24,7 +31,9 @@ public: Crtc* get_current_crtc() const; std::vector<Crtc*> get_possible_crtcs() const; + // true if connected or unknown bool connected() const; + ConnectorStatus connector_status() const; const std::string& fullname() const { return m_fullname; } uint32_t connector_type() const; diff --git a/kms++/src/connector.cpp b/kms++/src/connector.cpp index 47759be..a1807da 100644 --- a/kms++/src/connector.cpp +++ b/kms++/src/connector.cpp @@ -195,6 +195,18 @@ bool Connector::connected() const m_priv->drm_connector->connection == DRM_MODE_UNKNOWNCONNECTION; } +ConnectorStatus Connector::connector_status() const +{ + switch (m_priv->drm_connector->connection) { + case DRM_MODE_CONNECTED: + return ConnectorStatus::Connected; + case DRM_MODE_DISCONNECTED: + return ConnectorStatus::Disconnected; + default: + return ConnectorStatus::Unknown; + } +} + vector<Crtc*> Connector::get_possible_crtcs() const { vector<Crtc*> crtcs; |