-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathupdate_wifi_bt.sh
executable file
·55 lines (49 loc) · 1.21 KB
/
update_wifi_bt.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
#!/bin/bash
function pt_error()
{
echo -e "\033[1;31mERROR: $*\033[0m"
}
function pt_warn()
{
echo -e "\033[1;31mWARN: $*\033[0m"
}
function pt_info()
{
echo -e "\033[1;32mINFO: $*\033[0m"
}
function pt_ok()
{
echo -e "\033[1;33mOK: $*\033[0m"
}
if [ $UID -ne 0 ]
then
pt_error "Please run as root."
exit
fi
set -e
pt_info "Updating Wifi, please wait..."
dest="/lib/firmware/ap6212/"
bt_fw="/lib/firmware/ap6212/fw_bcm43438a1.bin"
if [ ! -f "$bt_fw" ]
then
pt_warn "Downloading fw wifi file..."
wget -q -O ${bt_fw} https://github.com/BPI-SINOVOIP/BPI_WiFi_Firmware/raw/master/ap6212/fw_bcm43438a1.bin
fi
bt_hcd="/lib/firmware/ap6212/bcm43438a1.hcd"
if [ ! -f "$bt_hcd" ]
then
pt_warn "Donwloading hcd wifi file..."
wget -q -O ${bt_hcd} https://github.com/BPI-SINOVOIP/BPI_WiFi_Firmware/raw/master/ap6212/bcm43438a1.hcd
fi
pt_info "Updating Wifi services..."
sed -i -e 's/bcm43438a0/bcm43438a1/g' /usr/local/bin/bpi-bt-patch
sync
sed -i -e 's/bcm43438a0/bcm43438a1/g' /usr/local/bin/bpi-bt-on
sync
if [ ! -f "$bt_hcd" ]
then
pt_error "Could not download files, you have to do this manually!"
else
pt_ok "Wifi is now updated for the A1 chip!"
pt_ok "Now you should reboot, type: sudo reboot"
fi