/
.divera_commands.sh
56 lines (49 loc) · 2.04 KB
/
.divera_commands.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
50
51
52
53
54
55
56
#!/bin/bash
# This file is an extension for the bash which contains the commands for
# turning the screen ond and off and also starts and stops the monitor.
# Source this file in your bash.rc to have the commands in your terminal.
# The url of your monitor (with Acesskey for autologin).
# This is the monitor account and not the alarm accesskey
# Also replace the braces
MONITOR="{YOUR MONITOR URL}"
# This function starts or stops the divera monitor.
function monitor(){
if [ $1 = on ]; then
# starts chromium in in kiosk mode
chromium-browser --noerrdialogs --kiosk --incognito $MONITOR &>/dev/null &
elif [ $1 = off ]; then
# just kill every chromium process
pkill chromium >/dev/null
else
echo Unknown parameter
fi
}
# Turns the screen on and off. Every screen is diffrent and many are bad programmed
# for that here are two diffrent ways for turning it on and off.
function screen(){
if [ $1 = on ]; then
# Version 1: enables hdmi port after the screen was in standby
vcgencmd display_power 1 >/dev/null
# Version 2: send cec-signal to the screen that he should wake up
#echo on 0 | cec-client -s -d 1
# Version 2b: if the screen turns on but at wrong input (e.g. AV1) force it to
# switch to HDMI1 port. This works only if the screen is on already
# therefore send it a few times in a row. 4F:82:10:00 is HDMI1, 4F:82:20:00
# is HDMI2, 4F:82:30:00 is HDMI3 and so on. Attention this is an unoffical
# cec-signal which may not work with your screen.
#echo tx 4F:82:10:00 | cec-client -s -d 1
#echo tx 4F:82:10:00 | cec-client -s -d 1
#echo tx 4F:82:10:00 | cec-client -s -d 1
#echo tx 4F:82:10:00 | cec-client -s -d 1
#echo tx 4F:82:10:00 | cec-client -s -d 1
#echo tx 4F:82:10:00 | cec-client -s -d 1
#echo tx 4F:82:10:00 | cec-client -s -d 1
elif [ $1 = off ]; then
# Version 1: disable hdmi port that the screen goes in standby
vcgencmd display_power 0 >/dev/null
# Version 2: send cec-signal to the screen that he should go in standby
#echo standby 0 | cec-client -s -d 1
else
echo Unknown parameter
fi
}