|
@@ -5,7 +5,7 @@ import subprocess
|
5
|
5
|
def ddc_detect():
|
6
|
6
|
r = subprocess.run(["ddcutil", "detect", "-t"], capture_output=True)
|
7
|
7
|
if r.returncode != 0:
|
8
|
|
- raise ValueError("ddcutil returned {}".format(r.returncode))
|
|
8
|
+ raise ValueError("ddcutil returned {} \"{}\"".format(r.returncode))
|
9
|
9
|
|
10
|
10
|
out = []
|
11
|
11
|
|
|
@@ -38,11 +38,11 @@ def ddc_detect():
|
38
|
38
|
def ddc_get(dev):
|
39
|
39
|
r = subprocess.run(["ddcutil", "-d", str(dev), "-t", "getvcp", "10"], capture_output=True)
|
40
|
40
|
if r.returncode != 0:
|
41
|
|
- raise ValueError("ddcutil returned {}".format(r.returncode))
|
|
41
|
+ raise ValueError("ddcutil returned {} \"{}\"".format(r.returncode, r.stderr.decode("utf-8")))
|
42
|
42
|
|
43
|
43
|
s = r.stdout.decode("utf-8").split()
|
44
|
44
|
if (s[0] != "VCP") or (s[1] != "10") or (s[2] != "C") or (s[4] != "100"):
|
45
|
|
- raise ValueError("unexpected identifier")
|
|
45
|
+ raise ValueError("unexpected identifier \"{}\"".format(r.stdout.decode("utf-8")))
|
46
|
46
|
|
47
|
47
|
return int(s[3])
|
48
|
48
|
|
|
@@ -53,7 +53,7 @@ def ddc_set(dev, val):
|
53
|
53
|
|
54
|
54
|
r = subprocess.run(["ddcutil", "-d", str(dev), "-t", "setvcp", "10", str(val)], capture_output=True)
|
55
|
55
|
if r.returncode != 0:
|
56
|
|
- raise ValueError("ddcutil returned {}".format(r.returncode))
|
|
56
|
+ raise ValueError("ddcutil returned {} \"{}\"".format(r.returncode, r.stderr.decode("utf-8")))
|
57
|
57
|
|
58
|
58
|
if __name__ == "__main__":
|
59
|
59
|
devs = ddc_detect()
|