Card: support opening specific drm device
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 18 Nov 2015 20:09:11 +0000 (22:09 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 18 Nov 2015 20:21:18 +0000 (22:21 +0200)
libkms++/card.cpp
libkms++/card.h

index 48ab560747993b187e64042ac91c88bf46733316..d5b823fd27be48ae4274d8f7dfe776fd9e8dcd02 100644 (file)
@@ -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;
index 1bc6af74436ef54545b9272564f1798bd9c6d585..6cf0c0277c381c7b0a7df7566bc32940c4e26617 100644 (file)
@@ -14,6 +14,7 @@ class Card
        friend class Framebuffer;
 public:
        Card();
+       Card(const std::string& device);
        ~Card();
 
        Card(const Card& other) = delete;