diff options
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; |