139 lines
4.2 KiB
Bash
Executable File
139 lines
4.2 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
|
|
;;
|
|
ailf,gs2410|\
|
|
huasifei,ws3006)
|
|
#m2 usb3.0
|
|
#(slot 2)
|
|
add_usb_slot_cfg "5g1" "2-1.2" "5g1" "green:5g2" "green:sim2" "m2_reset_2" "1" "0" "5"
|
|
#(slot 1)
|
|
add_usb_slot_cfg "5g0" "2-1.4" "5g0" "green:5g1" "green:sim1" "m2_reset_1" "1" "0" "6"
|
|
#m2 usb2.0
|
|
#(slot 2)
|
|
add_usb_slot_cfg "4g3" "1-1.1" "4g3" "green:5g2" "green:sim2" "m2_reset_2" "1" "0" "20"
|
|
#(slot 1)
|
|
add_usb_slot_cfg "4g2" "1-1.4" "4g2" "green:5g1" "green:5g1" "m2_reset_1" "1" "0" "21"
|
|
#mini pci slot
|
|
#(slot 2)
|
|
add_usb_slot_cfg "4g1" "1-1.2" "4g1" "green:5g2" "green:sim2" "" "" "" "22"
|
|
#(slot 1)
|
|
add_usb_slot_cfg "4g0" "1-1.3" "4g0" "green:5g1" "green:sim1" "" "" "" "23"
|
|
uci commit qmodem
|
|
;;
|
|
sagemcom,5866t)
|
|
add_usb_slot_cfg "5g_usb" "1-1" "5g_usb" "LED5_G" "LED4_G" "" "" "" "10"
|
|
add_pcie_slot_cfg "5g_pcie" "0000:01:00.0" "5g_pcie" "LED5_G" "LED4_G" "1-1" "" "" "" "10"
|
|
uci commit qmodem
|
|
;;
|
|
cyber,cyber3588-aib)
|
|
add_usb_slot_cfg "5g_usb0" "8-1" "5g_usb0" "blue:status" "green:status" "" "" "" "10"
|
|
add_pcie_slot_cfg "5g_pcie0" "0001:11:00.0" "5g_pcie0" "blue:status" "green:status" "8-1" "" "" "" "10"
|
|
uci commit qmodem
|
|
;;
|
|
mt7981,stx1170-gsw)
|
|
add_usb_slot_cfg "5g_usb0" "2-1" "5g_usb0" "" "" "" "" "" "10"
|
|
uci commit qmodem
|
|
;;
|
|
esac
|
|
}
|
|
|
|
add_usb_slot_cfg()
|
|
{
|
|
cfg=$1
|
|
cfg_slot=$2
|
|
alias=$3
|
|
net_led=$4
|
|
sim_led=$5
|
|
gpio=$6
|
|
gpio_up=$7
|
|
gpio_down=$8
|
|
default_metric=$9
|
|
uci set qmodem.${cfg}=modem-slot
|
|
uci set qmodem.${cfg}.type=usb
|
|
[ -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}
|
|
}
|
|
|
|
|
|
add_pcie_slot_cfg()
|
|
{
|
|
cfg=$1
|
|
cfg_slot=$2
|
|
alias=$3
|
|
net_led=$4
|
|
sim_led=$5
|
|
associated_usb=$6
|
|
gpio=$7
|
|
gpio_up=$8
|
|
gpio_down=${9}
|
|
default_metric=${10}
|
|
uci set qmodem.${cfg}=modem-slot
|
|
uci set qmodem.${cfg}.type=pcie
|
|
[ -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
|