diff options
Diffstat (limited to 'kms++util/src')
-rw-r--r-- | kms++util/src/helpers.cpp | 43 | ||||
-rw-r--r-- | kms++util/src/resourcemanager.cpp | 9 |
2 files changed, 9 insertions, 43 deletions
diff --git a/kms++util/src/helpers.cpp b/kms++util/src/helpers.cpp deleted file mode 100644 index 2bf3a4f..0000000 --- a/kms++util/src/helpers.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include <kms++util/kms++util.h> - -using namespace std; - -namespace kms { - -Connector* resolve_connector(Card& card, const string& str) -{ - if (str.length() == 0) - return nullptr; - - auto connectors = card.get_connectors(); - - if (str[0] == '@') { - char* endptr; - unsigned id = strtoul(str.c_str() + 1, &endptr, 10); - if (*endptr == 0) { - Connector* c = card.get_connector(id); - if (!c) - return nullptr; - else - return c; - } - } else { - char* endptr; - unsigned idx = strtoul(str.c_str(), &endptr, 10); - if (*endptr == 0) { - if (idx >= connectors.size()) - return nullptr; - else - return connectors[idx]; - } - } - - for (Connector* conn : connectors) { - if (to_lower(conn->fullname()).find(to_lower(str)) != string::npos) - return conn; - } - - return nullptr; -} - -} diff --git a/kms++util/src/resourcemanager.cpp b/kms++util/src/resourcemanager.cpp index cdd3e40..5c83ad7 100644 --- a/kms++util/src/resourcemanager.cpp +++ b/kms++util/src/resourcemanager.cpp @@ -99,6 +99,15 @@ Connector* ResourceManager::reserve_connector(const string& name) return conn; } +Connector* ResourceManager::reserve_connector(Connector* conn) +{ + if (contains(m_reserved_connectors, conn)) + return nullptr; + + m_reserved_connectors.push_back(conn); + return conn; +} + Crtc* ResourceManager::reserve_crtc(Connector* conn) { if (Crtc* crtc = conn->get_current_crtc()) { |