summaryrefslogtreecommitdiff
path: root/py/helpers.py
blob: 15f6cfa7868db45c23e2cf5b91abfbc83e787ce7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import pykms

def add_props(areq, ob, map):
    for key, value in map.items():
        areq.add(ob, key, value)


def props(o):
    o.refresh_props()
    map = o.get_prop_map()
    for propid in map:
        prop = o.card().get_prop(propid)
        print("%-15s %d (%#x)" % (prop.name(), map[propid], map[propid]))

def set_props(ob, map):
    areq = pykms.AtomicReq(ob.card())

    for key, value in map.items():
        areq.add(ob, key, value)

    if areq.commit() != 0:
        print("commit failed")

red = pykms.RGB(255, 0, 0)
green = pykms.RGB(0, 255, 0)
blue = pykms.RGB(0, 0, 255)
yellow = pykms.RGB(255, 255, 0)
purple = pykms.RGB(255, 0, 255)
white = pykms.RGB(255, 255, 255)
cyan = pykms.RGB(0, 255, 255)

def disable_planes(card):
    areq = pykms.AtomicReq(card)

    for p in card.get_planes():
        areq.add(p, "FB_ID", 0)
        areq.add(p, "CRTC_ID", 0)

    if areq.commit() != 0:
        print("disabling planes failed")