-
Notifications
You must be signed in to change notification settings - Fork 36
/
odroidc_hdmipass.sh
68 lines (55 loc) · 1.12 KB
/
odroidc_hdmipass.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
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
odroidc1_hdmipass() {
CC=$(whiptail --backtitle "Hardkernel ODROID Utility v$_REV" --menu "ODROID-C1 HDMI Passthrough" 0 0 1 --cancel-button "Exit" --ok-button "Select" \
"1" "Enable Passthrough (Cause issues on USB Audio) (Only enable it if you use it)" \
"2" "Disable Passthrough" \
3>&1 1>&2 2>&3)
ret=$?
if [ $ret -eq 1 ]; then
return 0
elif [ $ret -eq 0 ]; then
case "$CC" in
1)
enable_c1_pass
REBOOT=1
;;
2)
disable_c1_pass
REBOOT=1
;;
*) ;;
esac
fi
}
enable_c1_pass() {
cat > /etc/asound.conf << __EOF__
pcm.!default {
type hw
card 0
device 0
format S16_LE
}
ctl.!default {
type hw
card 0
}
__EOF__
sed -i '20s/.*/export AE_SINK=ALSA/' /usr/local/bin/kodi
msgbox "HDMI Audio Passthrough is now enabled. Please reboot to take effect"
}
disable_c1_pass() {
cat > /etc/asound.conf << __EOF__
pcm.!default {
type plug
slave {
pcm "hw:0,0"
}
}
ctl.!default {
type hw
card 0
}
__EOF__
sed -i '20s/.*//' /usr/local/bin/kodi
msgbox "HDMI Audio Passthrough is now disabled. Please reboot to take effect"
}