diff options
| author | PancakeTAS <pancake@mgnet.work> | 2026-07-03 15:31:57 +0200 |
|---|---|---|
| committer | PancakeTAS <pancake@mgnet.work> | 2026-07-03 15:31:57 +0200 |
| commit | e2b929072e93da9a1b86cd04b31ce535bda7a14f (patch) | |
| tree | 8901e70d331f4406b176fa60f1ac44cb1bd710a0 /src | |
| parent | Generalize device class (diff) | |
Implement version ioctl and expand comments
Diffstat (limited to 'src')
| -rw-r--r-- | src/drm.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/drm.cpp b/src/drm.cpp index 66fe147..77d326d 100644 --- a/src/drm.cpp +++ b/src/drm.cpp @@ -5,9 +5,9 @@ #include "drm++/helper/types.hpp" #include <stdexcept> +#include <string> #include <drm.h> -#include <string> #include <unistd.h> using namespace drm; @@ -16,6 +16,30 @@ Device::Device(int fd) : m_fd(fd) { if (this->m_fd < 0) { throw std::invalid_argument("invalid file descriptor"); } + + drm_version args{ + .version_major = 0, + }; + ioctl::perform(this->m_fd, DRM_IOCTL_VERSION, args); + + this->m_version = { + args.version_major, + args.version_minor, + args.version_patchlevel + }; + this->m_name.resize(args.name_len); + this->m_date.resize(args.date_len); + this->m_description.resize(args.desc_len); + + args = { + .name_len = this->m_name.size(), + .name = this->m_name.data(), + .date_len = this->m_date.size(), + .date = this->m_date.data(), + .desc_len = this->m_description.size(), + .desc = this->m_description.data() + }; + ioctl::perform(this->m_fd, DRM_IOCTL_VERSION, args); } void Device::setClientName(const std::string& name) const { |
