mirror of
https://github.com/sixfab/Sixfab_PPP_Installer
synced 2024-11-22 02:54:53 +00:00
Added BG9X modules to configure_modem.sh
Added rpi max power settings for base hat
This commit is contained in:
parent
76fe40bdc7
commit
3d96698901
@ -136,7 +136,7 @@ if ! (grep -q 'sudo route' /etc/ppp/ip-up ); then
|
|||||||
echo "sudo route add default ppp0" >> /etc/ppp/ip-up
|
echo "sudo route add default ppp0" >> /etc/ppp/ip-up
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $shield_hat -eq 2 ]; then
|
if [[ $shield_hat -eq 2 ]] || [[ $shield_hat -eq 6 ]]; then
|
||||||
if ! (grep -q 'max_usb_current' /boot/config.txt ); then
|
if ! (grep -q 'max_usb_current' /boot/config.txt ); then
|
||||||
echo "max_usb_current=1" >> /boot/config.txt
|
echo "max_usb_current=1" >> /boot/config.txt
|
||||||
fi
|
fi
|
||||||
|
@ -2,22 +2,105 @@
|
|||||||
|
|
||||||
source functions.sh
|
source functions.sh
|
||||||
|
|
||||||
|
# Check the vendor
|
||||||
|
lsusb | grep Quectel >> /dev/null
|
||||||
|
IS_QUECTEL=$?
|
||||||
|
|
||||||
|
lsusb | grep Telit >> /dev/null
|
||||||
|
IS_TELIT=$?
|
||||||
|
|
||||||
|
|
||||||
### Modem configuration for RMNET/PPP mode ##################################
|
### Modem configuration for RMNET/PPP mode ##################################
|
||||||
debug "Checking APN and Modem Mode..."
|
debug "Checking APN and Modem Mode..."
|
||||||
|
|
||||||
# APN
|
# APN Configuration
|
||||||
|
# -----------------
|
||||||
atcom "AT+CGDCONT?" | grep super >> /dev/null
|
atcom "AT+CGDCONT?" | grep super >> /dev/null
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
atcom "AT+CGDCONT=1,\"IP\",\"super\""
|
atcom "AT+CGDCONT=1,\"IPV4V6\",\"super\""
|
||||||
debug "APN is updated."
|
debug "APN is updated."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
atcom "AT#USBCFG?" | grep 0 >> /dev/null
|
# Modem Mode Configuration
|
||||||
|
# ------------------------
|
||||||
|
# For Quectel
|
||||||
|
if [[ $IS_QUECTEL -eq 0 ]]; then
|
||||||
|
|
||||||
|
lsusb | grep BG9 > /dev/null
|
||||||
|
MODEL_BG9X=$?
|
||||||
|
|
||||||
|
if [[ $MODEL_BG9X -eq 0 ]]; then
|
||||||
|
# BG95 and BG96
|
||||||
|
|
||||||
|
# RAT Searching Sequence
|
||||||
|
atcom "AT+QCFG=\"nwscanseq\"" | grep 000201 >> /dev/null
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
atcom "AT#USBCFG=0"
|
atcom "AT+QCFG=\"nwscanseq\",00"
|
||||||
debug "RMNET/PPP mode is activated."
|
debug "Configure RAT Searching Sequence is updated."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# RAT(s) to be Searched
|
||||||
|
atcom "AT+QCFG=\"nwscanmode\"" | grep 0 >> /dev/null
|
||||||
|
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
atcom "AT+QCFG=\"nwscanmode\",0"
|
||||||
|
debug "RAT(s) to be Searched is updated."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Network Category to be Searched under LTE RAT
|
||||||
|
atcom "AT+QCFG=\"iotopmode\"" | grep 0 >> /dev/null
|
||||||
|
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
atcom "AT+QCFG=\"iotopmode\",0"
|
||||||
|
debug "Network Category to be Searched under LTE RAT is updated."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# end of configuraiton for BG95/6
|
||||||
|
else
|
||||||
|
# EC25 or derives.
|
||||||
|
atcom "AT+QCFG=\"usbnet\"" | grep 0 >> /dev/null
|
||||||
|
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
atcom "AT+QCFG=\"usbnet\",0"
|
||||||
|
debug "PPP mode is activated."
|
||||||
|
debug "Modem restarting..."
|
||||||
|
|
||||||
|
sleep 20
|
||||||
|
|
||||||
|
# Check modem is started
|
||||||
|
route -n | grep wwan0 >> /dev/null
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
# If modem don't reboot automatically, reset manually
|
||||||
|
atcom "AT+CFUN=1,1" # rebooting modem
|
||||||
|
sleep 20
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check modem is started!
|
||||||
|
for i in {1..120}; do
|
||||||
|
route -n | grep wwan0 >> /dev/null
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
echo
|
||||||
|
debug "Modem is restarted."
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
printf "*"
|
||||||
|
done
|
||||||
|
sleep 5 # wait until modem is ready
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Telit
|
||||||
|
elif [[ $IS_TELIT -eq 0 ]]; then
|
||||||
|
atcom "AT#USBCFG?" | grep 4 >> /dev/null
|
||||||
|
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
atcom "AT#USBCFG=4"
|
||||||
|
debug "ECM mode is activated."
|
||||||
debug "Modem restarting..."
|
debug "Modem restarting..."
|
||||||
|
|
||||||
sleep 20
|
sleep 20
|
||||||
@ -35,4 +118,16 @@ if [[ $? -ne 0 ]]; then
|
|||||||
done
|
done
|
||||||
sleep 5 # wait until modem is ready
|
sleep 5 # wait until modem is ready
|
||||||
fi
|
fi
|
||||||
### End of Modem configuration for RMNET/PPP mode ############################
|
|
||||||
|
# Unknown
|
||||||
|
else
|
||||||
|
debug "The cellular module couldn't be detected!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
### End of Modem configuration for ECM mode ############################
|
||||||
|
|
||||||
|
|
||||||
|
# Check the network is ready
|
||||||
|
# --------------------------
|
||||||
|
if check_network -eq 0; then exit 0; else debug "Network registeration is failed!"; exit 1; fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user