109 lines
3.1 KiB
Bash
Executable File
109 lines
3.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
. /lib/functions.sh
|
|
. /lib/functions/uci-defaults.sh
|
|
. /lib/functions/system.sh
|
|
|
|
modem_settings()
|
|
{
|
|
local board="$1"
|
|
|
|
case $board in
|
|
arcadyan,aw1000)
|
|
#usb slot
|
|
uci set qmodem.usb0="modem-slot"
|
|
uci set qmodem.usb0.slot="4-1"
|
|
uci set qmodem.usb0.type="usb"
|
|
uci set qmodem.usb0.net_led="ipq::led9"
|
|
uci set qmodem.usb0.sim_led="ipq::led2"
|
|
uci set qmodem.usb0.alias="wwan0"
|
|
#pcie slot
|
|
uci set qmodem.pcie0="modem-slot"
|
|
uci set qmodem.pcie0.slot="0000:01:00.0"
|
|
uci set qmodem.pcie0.type="pcie"
|
|
uci set qmodem.pcie0.net_led="ipq::led9"
|
|
uci set qmodem.pcie0.sim_led="ipq::led2"
|
|
uci set qmodem.pcie0.associated_usb='4-1'
|
|
uci set qmodem.pcie0.alias="wwan1"
|
|
uci commit qmodem
|
|
;;
|
|
HC,HC-G80)
|
|
#mini pci slot
|
|
uci set qmodem.mini_pci="modem-slot"
|
|
uci set qmodem.mini_pci.slot="1-1.4"
|
|
uci set qmodem.mini_pci.type="usb"
|
|
uci set qmodem.mini_pci.net_led="wwan"
|
|
#m.2 slot (usb2.0)
|
|
uci set qmodem.m2_u2="modem-slot"
|
|
uci set qmodem.m2_u2.slot="1-1.1"
|
|
uci set qmodem.m2_u2.type="usb"
|
|
uci set qmodem.m2_u2.net_led="wwan"
|
|
uci set qmodem.m2_u2.ethernet_5g="cpewan0"
|
|
#m.2 slot (usb3.0)
|
|
uci set qmodem.m2_u3="modem-slot"
|
|
uci set qmodem.m2_u3.slot="2-1"
|
|
uci set qmodem.m2_u3.type="usb"
|
|
uci set qmodem.m2_u3.net_led="wwan"
|
|
uci set qmodem.m2_u3.ethernet_5g="cpewan0"
|
|
uci commit qmodem
|
|
;;
|
|
huasifei,ws3006)
|
|
#m2 usb3.0
|
|
#(slot 2)
|
|
add_slot_cfg "5g1" "2-1.2" "usb" "5g1" "green:5g2" "green:sim2" "" "m2_reset_2" "1" "0" "5"
|
|
#(slot 1)
|
|
add_slot_cfg "5g0" "2-1.4" "usb" "5g0" "green:5g1" "green:sim1" "" "m2_reset_1" "1" "0" "6"
|
|
#m2 usb2.0
|
|
#(slot 2)
|
|
add_slot_cfg "4g3" "1-1.1" "usb" "4g3" "green:5g2" "green:sim2" "" "m2_reset_2" "1" "0" "20"
|
|
#(slot 1)
|
|
add_slot_cfg "4g2" "1-1.4" "usb" "4g2" "green:5g1" "green:5g1" "" "m2_reset_1" "1" "0" "21"
|
|
#mini pci slot
|
|
#(slot 2)
|
|
add_slot_cfg "4g1" "1-1.2" "usb" "4g1" "green:5g2" "green:5g2" "" "m2_reset_2" "1" "0" "22"
|
|
#(slot 1)
|
|
add_slot_cfg "4g0" "1-1.3" "usb" "4g0" "green:5g1" "green:5g1" "" "m2_reset_1" "1" "0" "23"
|
|
uci commit qmodem
|
|
;;
|
|
cyber,cyber3588-aib)
|
|
uci batch << EOF
|
|
set qmodem.m2_0=modem-slot
|
|
set qmodem.m2_0.type='pcie'
|
|
set qmodem.m2_0.slot='0001:11:00.0'
|
|
set qmodem.m2_0.net_led='blue:status'
|
|
set qmodem.m2_0.associated_usb='8-1'
|
|
set qmodem.m2_0.sim_led='green:status'
|
|
commit qmodem
|
|
EOF
|
|
esac
|
|
}
|
|
|
|
add_slot_cfg()
|
|
{
|
|
cfg=$1
|
|
cfg_slot=$2
|
|
cfg_type=$3
|
|
alias=$4
|
|
net_led=$5
|
|
sim_led=$6
|
|
associated_usb=$7
|
|
gpio=$8
|
|
gpio_up=$9
|
|
gpio_down=${10}
|
|
default_metric=${11}
|
|
[ -n "$cfg_type" ] && uci set qmodem.${cfg}.type=${cfg_type}
|
|
[ -n "$cfg_slot" ] && uci set qmodem.${cfg}.slot=${cfg_slot}
|
|
[ -n "$net_led" ] && uci set qmodem.${cfg}.net_led=${net_led}
|
|
[ -n "$alias" ] && uci set qmodem.${cfg}.alias=${alias}
|
|
[ -n "$sim_led" ] && uci set qmodem.${cfg}.sim_led=${sim_led}
|
|
[ -n "$associated_usb" ] && uci set qmodem.${cfg}.associated_usb=${associated_usb}
|
|
[ -n "$gpio" ] && uci set qmodem.${cfg}.gpio=${gpio}
|
|
[ -n "$gpio_up" ] && uci set qmodem.${cfg}.gpio_up=${gpio_up}
|
|
[ -n "$gpio_down" ] && uci set qmodem.${cfg}.gpio_down=${gpio_down}
|
|
[ -n "$default_metric" ] && uci set qmodem.${cfg}.default_metric=${default_metric}
|
|
}
|
|
|
|
board=$(board_name)
|
|
modem_settings $board
|
|
exit 0
|