-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrpi-hdmi.sh
executable file
·49 lines (45 loc) · 1.28 KB
/
rpi-hdmi.sh
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
46
47
48
49
#!/bin/sh
# Enable and disable HDMI output on the Raspberry Pi
# sudo apt install cec-utils
is_off ()
{
#tvservice -s | grep "TV is off" >/dev/null
echo "pow 0" | cec-client -s -d 1 | grep "power status: standby" >/dev/null
}
case $1 in
off)
#tvservice -o
echo "as" | cec-client -s -d 1
echo "standby 0" | cec-client -s -d 1 >/dev/null
;;
on)
if is_off
then
#tvservice -p
#curr_vt=`fgconsole`
#if [ "$curr_vt" = "1" ]
#then
# chvt 2
# chvt 1
#else
# chvt 1
# chvt "$curr_vt"
#fi
echo "on 0" | cec-client -s -d 1 >/dev/null
echo "as" | cec-client -s -d 1
fi
;;
status)
if is_off
then
echo off
else
echo on
fi
;;
*)
echo "Usage: $0 on|off|status" >&2
exit 2
;;
esac
exit 0