summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kms++/inc/kms++/card.h9
-rw-r--r--kms++/src/card.cpp9
-rw-r--r--py/pykms/pykmsbase.cpp2
3 files changed, 20 insertions, 0 deletions
diff --git a/kms++/inc/kms++/card.h b/kms++/inc/kms++/card.h
index a3479d1..77f97a3 100644
--- a/kms++/inc/kms++/card.h
+++ b/kms++/inc/kms++/card.h
@@ -51,6 +51,8 @@ public:
int disable_all();
+ const std::string& version_name() const { return m_version_name; }
+
private:
void restore_modes();
@@ -68,5 +70,12 @@ private:
bool m_has_atomic;
bool m_has_universal_planes;
+
+ int m_version_major;
+ int m_version_minor;
+ int m_version_patchlevel;
+ std::string m_version_name;
+ std::string m_version_date;
+ std::string m_version_desc;
};
}
diff --git a/kms++/src/card.cpp b/kms++/src/card.cpp
index ea0d6a7..a5c6d53 100644
--- a/kms++/src/card.cpp
+++ b/kms++/src/card.cpp
@@ -30,6 +30,15 @@ Card::Card(const std::string& device)
throw invalid_argument(string(strerror(errno)) + " opening " + device);
m_fd = fd;
+ drmVersionPtr ver = drmGetVersion(m_fd);
+ m_version_major = ver->version_major;
+ m_version_minor = ver->version_minor;
+ m_version_patchlevel = ver->version_patchlevel;
+ m_version_name = string(ver->name, ver->name_len);
+ m_version_date = string(ver->date, ver->date_len);
+ m_version_desc = string(ver->desc, ver->desc_len);
+ drmFreeVersion(ver);
+
int r;
r = drmSetMaster(m_fd);
diff --git a/py/pykms/pykmsbase.cpp b/py/pykms/pykmsbase.cpp
index c86e76c..7a2ce75 100644
--- a/py/pykms/pykmsbase.cpp
+++ b/py/pykms/pykmsbase.cpp
@@ -46,6 +46,8 @@ void init_pykmsbase(py::module &m)
.def_property_readonly("has_atomic", &Card::has_atomic)
.def("get_prop", (Property* (Card::*)(uint32_t) const)&Card::get_prop)
+
+ .def_property_readonly("version_name", &Card::version_name);
;
py::class_<DrmObject, unique_ptr<DrmObject, py::nodelete>>(m, "DrmObject")