mirror of https://github.com/OpenIPC/firmware.git
wireless-scripts: improve code efficiency
increase code efficiency, as suggested by @viktorxda. Thank You!pull/962/head
parent
d27fd6e1eb
commit
a89f9845ef
|
@ -8,6 +8,14 @@ set_gpio() {
|
||||||
sleep 1
|
sleep 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
set_mmc() {
|
||||||
|
mmc=/sys/devices/platform/jzmmc_v1.2.$1/present
|
||||||
|
if [ "$(cat $mmc)" = "N" ]; then
|
||||||
|
echo "INSERT" > $mmc
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# T31 ATBM603X mmc0
|
# T31 ATBM603X mmc0
|
||||||
if [ "$1" = "atbm603x-t31-mmc0" ]; then
|
if [ "$1" = "atbm603x-t31-mmc0" ]; then
|
||||||
# PB10 in wifi mmc1 is in the pull-down state by default, it needs to be set to a high-impedance state
|
# PB10 in wifi mmc1 is in the pull-down state by default, it needs to be set to a high-impedance state
|
||||||
|
@ -15,11 +23,7 @@ if [ "$1" = "atbm603x-t31-mmc0" ]; then
|
||||||
# set wifi mmc1 clk drive capability to 8mA
|
# set wifi mmc1 clk drive capability to 8mA
|
||||||
devmem 0x10011134 32 0x20000
|
devmem 0x10011134 32 0x20000
|
||||||
|
|
||||||
# "insert" the bus mmc0 device
|
set_mmc 0
|
||||||
if [ "$(cat /sys/devices/platform/jzmmc_v1.2.0/present)" = "N" ]; then
|
|
||||||
echo "INSERT" > /sys/devices/platform/jzmmc_v1.2.0/present
|
|
||||||
sleep 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp /usr/share/atbm603x_conf/atbm_txpwer_dcxo_cfg.txt /tmp
|
cp /usr/share/atbm603x_conf/atbm_txpwer_dcxo_cfg.txt /tmp
|
||||||
cp /usr/share/atbm603x_conf/set_rate_power.txt /tmp
|
cp /usr/share/atbm603x_conf/set_rate_power.txt /tmp
|
||||||
|
@ -33,11 +37,7 @@ if [ "$1" = "atbm603x-t31-mmc1" ]; then
|
||||||
# not sure what this does, but it's copied from the stock fw
|
# not sure what this does, but it's copied from the stock fw
|
||||||
devmem 0x10011110 32 0x6e094800
|
devmem 0x10011110 32 0x6e094800
|
||||||
|
|
||||||
# "insert" the bus mmc1 device
|
set_mmc 1
|
||||||
if [ "$(cat /sys/devices/platform/jzmmc_v1.2.1/present)" = "N" ]; then
|
|
||||||
echo "INSERT" > /sys/devices/platform/jzmmc_v1.2.1/present
|
|
||||||
sleep 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp /usr/share/atbm603x_conf/atbm_txpwer_dcxo_cfg.txt /tmp
|
cp /usr/share/atbm603x_conf/atbm_txpwer_dcxo_cfg.txt /tmp
|
||||||
cp /usr/share/atbm603x_conf/set_rate_power.txt /tmp
|
cp /usr/share/atbm603x_conf/set_rate_power.txt /tmp
|
||||||
|
@ -46,14 +46,11 @@ if [ "$1" = "atbm603x-t31-mmc1" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# T31 Wyze V3 / AtomCam 2 ATBM6031
|
# T31 Wyze V3 / AtomCam 2 ATBM603x
|
||||||
if [ "$1" = "atbm603x-t31-wyze-v3" ]; then
|
if [ "$1" = "atbm603x-t31-wyze-v3" ]; then
|
||||||
set_gpio 57 1
|
set_gpio 57 1
|
||||||
|
|
||||||
if [ "$(cat /sys/devices/platform/jzmmc_v1.2.1/present)" = "N" ]; then
|
set_mmc 1
|
||||||
echo "INSERT" > /sys/devices/platform/jzmmc_v1.2.1/present
|
|
||||||
sleep 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp /usr/share/atbm603x_conf/atbm_txpwer_dcxo_cfg.txt /tmp
|
cp /usr/share/atbm603x_conf/atbm_txpwer_dcxo_cfg.txt /tmp
|
||||||
cp /usr/share/atbm603x_conf/set_rate_power.txt /tmp
|
cp /usr/share/atbm603x_conf/set_rate_power.txt /tmp
|
||||||
|
@ -67,10 +64,7 @@ fi
|
||||||
if [ "$1" = "rtl8189ftv-t31-wyze-v3" ]; then
|
if [ "$1" = "rtl8189ftv-t31-wyze-v3" ]; then
|
||||||
set_gpio 57 1
|
set_gpio 57 1
|
||||||
|
|
||||||
if [ "$(cat /sys/devices/platform/jzmmc_v1.2.1/present)" = "N" ]; then
|
set_mmc 1
|
||||||
echo "INSERT" > /sys/devices/platform/jzmmc_v1.2.1/present
|
|
||||||
sleep 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
modprobe 8189fs rtw_power_mgnt=0 rtw_enusbss=0
|
modprobe 8189fs rtw_power_mgnt=0 rtw_enusbss=0
|
||||||
sleep 1
|
sleep 1
|
||||||
|
@ -79,10 +73,7 @@ fi
|
||||||
|
|
||||||
# T31 Wyze DB3 RTL8189FTV
|
# T31 Wyze DB3 RTL8189FTV
|
||||||
if [ "$1" = "rtl8189ftv-t31-wyze-db3" ]; then
|
if [ "$1" = "rtl8189ftv-t31-wyze-db3" ]; then
|
||||||
if [ "$(cat /sys/devices/platform/jzmmc_v1.2.1/present)" = "N" ]; then
|
set_mmc 1
|
||||||
echo "INSERT" > /sys/devices/platform/jzmmc_v1.2.1/present
|
|
||||||
sleep 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
modprobe 8189fs rtw_power_mgnt=0 rtw_enusbss=0
|
modprobe 8189fs rtw_power_mgnt=0 rtw_enusbss=0
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
Loading…
Reference in New Issue