summaryrefslogtreecommitdiff
path: root/kms++/src
diff options
context:
space:
mode:
Diffstat (limited to 'kms++/src')
-rw-r--r--kms++/src/atomicreq.cpp2
-rw-r--r--kms++/src/card.cpp10
-rw-r--r--kms++/src/drmpropobject.cpp14
3 files changed, 14 insertions, 12 deletions
diff --git a/kms++/src/atomicreq.cpp b/kms++/src/atomicreq.cpp
index c8dd862..f2809af 100644
--- a/kms++/src/atomicreq.cpp
+++ b/kms++/src/atomicreq.cpp
@@ -51,7 +51,7 @@ void AtomicReq::add(DrmPropObject* ob, Property *prop, uint64_t value)
void AtomicReq::add(kms::DrmPropObject* ob, const string& prop, uint64_t value)
{
- add(ob, m_card.get_prop(prop), value);
+ add(ob, ob->get_prop(prop), value);
}
void AtomicReq::add(kms::DrmPropObject* ob, const map<string, uint64_t>& values)
diff --git a/kms++/src/card.cpp b/kms++/src/card.cpp
index 0a34d14..12bdef6 100644
--- a/kms++/src/card.cpp
+++ b/kms++/src/card.cpp
@@ -143,16 +143,6 @@ void Card::restore_modes()
conn->restore_mode();
}
-Property* Card::get_prop(const string& name) const
-{
- for (auto prop : m_properties) {
- if (name == prop->name())
- return prop;
- }
-
- throw invalid_argument(string("Card property ") + name + " not found");
-}
-
Connector* Card::get_first_connected_connector() const
{
for(auto c : m_connectors) {
diff --git a/kms++/src/drmpropobject.cpp b/kms++/src/drmpropobject.cpp
index f2edf8b..f5a3c97 100644
--- a/kms++/src/drmpropobject.cpp
+++ b/kms++/src/drmpropobject.cpp
@@ -45,6 +45,18 @@ void DrmPropObject::refresh_props()
drmModeFreeObjectProperties(props);
}
+Property* DrmPropObject::get_prop(const string& name) const
+{
+ for (auto pair : m_prop_values) {
+ auto prop = card().get_prop(pair.first);
+
+ if (name == prop->name())
+ return prop;
+ }
+
+ throw invalid_argument(string("property ") + name + " not found");
+}
+
uint64_t DrmPropObject::get_prop_value(uint32_t id) const
{
return m_prop_values.at(id);
@@ -75,7 +87,7 @@ int DrmPropObject::set_prop_value(uint32_t id, uint64_t value)
int DrmPropObject::set_prop_value(const string &name, uint64_t value)
{
- Property* prop = card().get_prop(name);
+ Property* prop = get_prop(name);
if (prop == nullptr)
throw invalid_argument("property not found: " + name);