-
Notifications
You must be signed in to change notification settings - Fork 9
/
test_cec.py
38 lines (33 loc) · 985 Bytes
/
test_cec.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
import hdmiceccontroller
import logging
# import cec
import time
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger('test')
log.info("starting")
cec = hdmiceccontroller.LibCecController(False,
"",
debug_level=hdmiceccontroller.CecLogging.CEC_LOG_ERROR)
try:
# time.sleep(8)
log.info("activate source")
cec.activate_source()
time.sleep(10)
log.info("check is on")
is_on = cec.is_on()
log.info('is on %s', 'yes' if is_on else 'no')
log.info('activating standby')
cec.standby()
time.sleep(10)
log.info("check is on")
is_on = cec.is_on()
log.info('is on %s', 'yes' if is_on else 'no')
log.info('power on')
cec.power_on()
time.sleep(10)
log.info("check is on")
is_on = cec.is_on()
log.info('is on %s', 'yes' if is_on else 'no')
except Exception as e:
log.exception('cec test failed: %s', e)
cec.__del__()