diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-05-26 14:12:15 +0300 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-05-26 14:12:15 +0300 |
commit | cc46d8d920dfd2c37ae87721f0309a17891cb6a1 (patch) | |
tree | 521f2a147de04c46a8c93258f3f0f8a502679f1f /py | |
parent | 8d50744ceb140019b805ed1b246194300e41a5f1 (diff) |
py: add set_prop()
Diffstat (limited to 'py')
-rw-r--r-- | py/gamma.py | 8 | ||||
-rw-r--r-- | py/helpers.py | 10 |
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) |