-
Notifications
You must be signed in to change notification settings - Fork 1
/
touchscreen.sh
53 lines (45 loc) · 2.33 KB
/
touchscreen.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
#!/bin/bash
# Setup Touchscreen
msgbox() { # $1 is the msg
whiptail --backtitle "$TITLE" --msgbox "$1" 0 0 0
}
setup_vu5(){
sed -i 's/^#\ setenv\ m\ \"800x480p60hz\"/setenv\ m\ \"800x480p60hz\"/g' /boot/boot.ini
sed -i "s/#\ setenv\ m_bpp\ \"24\"/setenv\ m_bpp\ \"24\"/" /boot/boot.ini
sed -i 's/^#\ setenv\ vout\ \"dvi\"/setenv\ vout\ \"dvi\"/g' /boot/boot.ini
sed -i "s/setenv\ monitor_onoff\ \"false\" # true or false/setenv\ monitor_onoff\ \"true\"\nsetenv backlight_pwm \"yes\"/" /boot/boot.ini
}
setup_vu7(){
sed -i 's/^#\ setenv\ m\ \"1024x600p60hz\"/setenv\ m\ \"1024x600p60hz\"/g' /boot/boot.ini
sed -i "s/#\ setenv\ m_bpp\ \"24\"/setenv\ m_bpp\ \"24\"/" /boot/boot.ini
sed -i 's/^#\ setenv\ vout\ \"dvi\"/setenv\ vout\ \"dvi\"/g' /boot/boot.ini
sed -i "s/setenv\ monitor_onoff\ \"false\" # true or false/setenv\ monitor_onoff\ \"true\"\nsetenv backlight_pwm \"yes\"/" /boot/boot.ini
}
setup_vu8(){
sed -i 's/^#\ setenv\ m\ \"1024x768p60hz\"/setenv\ m\ \"1024x768p60hz\"/g' /boot/boot.ini
sed -i "s/#\ setenv\ m_bpp\ \"32\"/setenv\ m_bpp\ \"32\"/" /boot/boot.ini
sed -i 's/^#\ setenv\ vout\ \"dvi\"/setenv\ vout\ \"dvi\"/g' /boot/boot.ini
sed -i "s/setenv\ monitor_onoff\ \"false\" # true or false/setenv\ monitor_onoff\ \"true\"\nsetenv backlight_pwm \"invert\"/" /boot/boot.ini
}
setup_default(){
sed -i 's/^#setenv\ m\ \"1920x1080p60hz\"/setenv\ m\ \"1920x1080p60hz\"/g' /boot/boot.ini
sed -i "s/#\ setenv\ m_bpp\ \"32\"/setenv\ m_bpp\ \"32\"/" /boot/boot.ini
sed -i 's/^#\ setenv\ vout\ \"dvi\"/setenv\ vout\ \"hdmi\"/g' /boot/boot.ini
sed -i "s/setenv\ monitor_onoff\ \"false\" # true or false/setenv\ monitor_onoff\ \"true\"\nsetenv backlight_pwm \"invert\"/" /boot/boot.ini
}
sed -i 's/^setenv\ m\ /#\ setenv\ m\ /g' /boot/boot.ini
sed -i "s/^setenv\ m_bpp\ /#\ setenv\ m_bpp\ /g" /boot/boot.ini
sed -i 's/^setenv\ vout\ /#\ setenv\ vout\ /g' /boot/boot.ini
CC=$(whiptail --backtitle "Touchscreen" --menu "Monitor Menu" 0 0 1 --nocancel --ok-button "Select one..." \
"1" "Setup VU5-7" \
"2" "Setup VU7plus" \
"3" "Setup VU8" \
"4" "Setup non-touch 1080p monitor" \
3>&1 1>&2 2>&3)
case "$CC" in
"1") setup_vu5;;
"2") setup_vu7;;
"3") setup_vu8;;
"4") setup_default;;
*) msgbox "Error 001. Please report on the forums" && exit 0 ;;
esac || msgbox "I don't know how you got here! >> $CC << Report on the forums"