summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libkms++/card.cpp11
-rw-r--r--libkms++/card.h1
2 files changed, 8 insertions, 4 deletions
diff --git a/libkms++/card.cpp b/libkms++/card.cpp
index 48ab560..d5b823f 100644
--- a/libkms++/card.cpp
+++ b/libkms++/card.cpp
@@ -17,13 +17,16 @@ namespace kms
{
Card::Card()
+ : Card("/dev/dri/card0")
{
- const char *card = "/dev/dri/card0";
+}
+
- int fd = open(card, O_RDWR | O_CLOEXEC);
+Card::Card(const std::string& device)
+{
+ int fd = open(device.c_str(), O_RDWR | O_CLOEXEC);
if (fd < 0)
- throw invalid_argument(string(strerror(errno)) + " opening " +
- card);
+ throw invalid_argument(string(strerror(errno)) + " opening " + device);
m_fd = fd;
int r;
diff --git a/libkms++/card.h b/libkms++/card.h
index 1bc6af7..6cf0c02 100644
--- a/libkms++/card.h
+++ b/libkms++/card.h
@@ -14,6 +14,7 @@ class Card
friend class Framebuffer;
public:
Card();
+ Card(const std::string& device);
~Card();
Card(const Card& other) = delete;