-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathtest.py
executable file
·45 lines (33 loc) · 916 Bytes
/
test.py
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
41
42
43
44
45
#!/usr/bin/env python
import time
import cec
adapters = cec.list_adapters()
test_power = False
print adapters
if len(adapters) > 0:
adapter = adapters[0]
print "Using Adapter %s"%(adapter)
cec.init(adapter)
print "Devices:", cec.list_devices()
d = cec.Device(0)
# print fields
print "Address:", d.address
print "Physical Address:", d.physical_address
print "Vendor ID:", d.vendor
print "OSD:", d.osd_string
print "CEC Version:", d.cec_version
print "Language:", d.language
# call functions
print "ON:", d.is_on()
if test_power:
print "Powering device on"
print d.power_on()
print "Sleeping to allow device to power on"
time.sleep(30)
print d.is_on()
print "Powering device off"
print d.standby()
print "Sleeping to allow device to power off"
time.sleep(30)
print d.is_on()
print "Success!"