diff options
Diffstat (limited to 'libkms++/drmobject.cpp')
-rw-r--r-- | libkms++/drmobject.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libkms++/drmobject.cpp b/libkms++/drmobject.cpp index 063ae32..ed7a71d 100644 --- a/libkms++/drmobject.cpp +++ b/libkms++/drmobject.cpp @@ -58,7 +58,22 @@ uint64_t DrmObject::get_prop_value(const string& name) const return m_prop_values.at(prop->id()); } - throw invalid_argument(string(name) + ": property not found"); + throw invalid_argument("property not found: " + name); +} + +int DrmObject::set_prop_value(uint32_t id, uint64_t value) +{ + return drmModeObjectSetProperty(card().fd(), this->id(), this->object_type(), id, value); +} + +int DrmObject::set_prop_value(const string &name, uint64_t value) +{ + Property* prop = card().get_prop(name); + + if (prop == nullptr) + throw invalid_argument("property not found: " + name); + + return set_prop_value(prop->id(), value); } void DrmObject::set_id(uint32_t id) |