summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libkms++/card.cpp12
-rw-r--r--libkms++/connector.cpp7
-rw-r--r--libkms++/connector.h2
-rw-r--r--libkms++/drmobject.cpp2
-rw-r--r--lua/luakms.i1
-rw-r--r--py/pykms.i1
6 files changed, 14 insertions, 11 deletions
diff --git a/libkms++/card.cpp b/libkms++/card.cpp
index 626c424..52a0f7a 100644
--- a/libkms++/card.cpp
+++ b/libkms++/card.cpp
@@ -26,8 +26,8 @@ Card::Card()
int fd = open(card, O_RDWR | O_CLOEXEC);
if (fd < 0)
- throw invalid_argument((string(strerror(errno)) +
- " opening " + card).c_str());
+ throw invalid_argument(string(strerror(errno)) + " opening " +
+ card);
m_fd = fd;
int r;
@@ -136,7 +136,7 @@ Property* Card::get_prop(const char *name) const
return prop;
}
- throw invalid_argument("foo");
+ throw invalid_argument(string("Card property ") + name + " not found");
}
Connector* Card::get_first_connected_connector() const
@@ -193,7 +193,7 @@ Crtc* Card::get_crtc_by_index(uint32_t idx) const
if (crtc && crtc->idx() == idx)
return crtc;
}
- throw invalid_argument("fob");
+ throw invalid_argument(string("Crtc #") + to_string(idx) + "not found");
}
Crtc* Card::get_crtc(uint32_t id) const { return dynamic_cast<Crtc*>(get_object(id)); }
@@ -221,7 +221,9 @@ std::vector<kms::Pipeline> Card::get_connected_pipelines()
}
if (!crtc)
- throw invalid_argument("fob");
+ throw invalid_argument(string("Connector #") +
+ to_string(conn->idx()) +
+ " has no possible crtcs");
outputs.push_back(Pipeline { crtc, conn });
}
diff --git a/libkms++/connector.cpp b/libkms++/connector.cpp
index b045b8b..8ff5a5f 100644
--- a/libkms++/connector.cpp
+++ b/libkms++/connector.cpp
@@ -89,16 +89,15 @@ Videomode Connector::get_default_mode() const
return drm_mode_to_video_mode(drmmode);
}
-Videomode Connector::get_mode(const char *mode) const
+Videomode Connector::get_mode(const string& mode) const
{
auto c = m_priv->drm_connector;
- string sMode(mode);
for (int i = 0; i < c->count_modes; i++)
- if (sMode == c->modes[i].name)
+ if (mode == c->modes[i].name)
return drm_mode_to_video_mode(c->modes[i]);
- throw invalid_argument((sMode + ": mode not found").c_str());
+ throw invalid_argument(mode + ": mode not found");
}
bool Connector::connected() const
diff --git a/libkms++/connector.h b/libkms++/connector.h
index 198a6dd..14e6b36 100644
--- a/libkms++/connector.h
+++ b/libkms++/connector.h
@@ -34,7 +34,7 @@ public:
Videomode get_default_mode() const;
- Videomode get_mode(const char *mode) const;
+ Videomode get_mode(const std::string& mode) const;
Crtc* get_current_crtc() const { return m_current_crtc; }
std::vector<Crtc*> get_possible_crtcs() const;
diff --git a/libkms++/drmobject.cpp b/libkms++/drmobject.cpp
index a79370f..f48153a 100644
--- a/libkms++/drmobject.cpp
+++ b/libkms++/drmobject.cpp
@@ -64,6 +64,6 @@ uint64_t DrmObject::get_prop_value(const char *name) const
return m_prop_values.at(prop->id());
}
- throw invalid_argument((string(name) + ": property not found").c_str());
+ throw invalid_argument(string(name) + ": property not found");
}
}
diff --git a/lua/luakms.i b/lua/luakms.i
index 60931f1..2920c46 100644
--- a/lua/luakms.i
+++ b/lua/luakms.i
@@ -5,6 +5,7 @@
using namespace kms;
%}
+%include "std_string.i"
%include "stdint.i"
%include "decls.h"
diff --git a/py/pykms.i b/py/pykms.i
index 6a6ad11..b9d61df 100644
--- a/py/pykms.i
+++ b/py/pykms.i
@@ -5,6 +5,7 @@
using namespace kms;
%}
+%include "std_string.i"
%include "stdint.i"
%include "decls.h"