summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
Diffstat (limited to 'py')
-rw-r--r--py/gamma.py8
-rw-r--r--py/helpers.py10
2 files changed, 12 insertions, 6 deletions
diff --git a/py/gamma.py b/py/gamma.py
index c8da18f..7ecd19d 100644
--- a/py/gamma.py
+++ b/py/gamma.py
@@ -32,14 +32,10 @@ for i in range(256):
gamma = pykms.Blob(card, arr);
-set_props(crtc, {
- "GAMMA_LUT": gamma.id,
-})
+set_prop(crtc, "GAMMA_LUT", gamma.id)
input("press enter to remove gamma\n")
-set_props(crtc, {
- "GAMMA_LUT": 0,
-})
+set_prop(crtc, "GAMMA_LUT", 0)
input("press enter to exit\n")
diff --git a/py/helpers.py b/py/helpers.py
index 456efcd..fd67d41 100644
--- a/py/helpers.py
+++ b/py/helpers.py
@@ -11,6 +11,16 @@ def props(o):
prop = o.card.get_prop(propid)
print("%-15s %d (%#x)" % (prop.name, propval, propval))
+def set_prop(ob, prop, value):
+ if ob.card.has_atomic:
+ areq = pykms.AtomicReq(ob.card)
+ areq.add(ob, prop, value)
+ if areq.commit_sync() != 0:
+ print("commit failed")
+ else:
+ if ob.set_prop_value(prop, value) != 0:
+ print("setting property failed")
+
def set_props(ob, map):
if ob.card.has_atomic:
areq = pykms.AtomicReq(ob.card)