Merge pull request #12 from sixfab/dev

Dev
This commit is contained in:
saeedjohar 2019-10-16 18:52:27 +03:00 committed by GitHub
commit d9c2dcd8a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 4 deletions

View File

@ -13,6 +13,8 @@ Sixfab offers Shields/HATs for Raspberry Pi which provides cellular Internet con
* [Raspberry Pi Tracker HAT ](https://sixfab.com/product/raspberry-pi-gprs-gps-tracker-hat/) * [Raspberry Pi Tracker HAT ](https://sixfab.com/product/raspberry-pi-gprs-gps-tracker-hat/)
* [Raspberry Pi 3G/4G&LTE Base HAT](https://sixfab.com/product/raspberry-pi-base-hat-3g-4g-lte-minipcie-cards/)
Each of these shield can be connected to Internet via PPP(Point to Point Protocol). For this tutorial we have written an script to install and perform required steps. Each of these shield can be connected to Internet via PPP(Point to Point Protocol). For this tutorial we have written an script to install and perform required steps.
Without further ado let us jump into the installation process: Without further ado let us jump into the installation process:
@ -36,9 +38,8 @@ It will ask several questions, just answer them accordingly to complete the inst
`Please choose your Sixfab Shield/HAT` `Please choose your Sixfab Shield/HAT`
You will be offered to choose among the mentioned four shields/HAT. Then it will fetch required scripts for you. You will be offered to choose among the mentioned four shields/HAT. Then it will fetch required scripts for you.
`Do you have updated kernel`
It asks if your kernel is up-to-date. If no[n] it updates the kernel else it skips the update. Then it installs ppp.  Then it installs ppp. 
`What is your carrier APN?` `What is your carrier APN?`

View File

@ -11,6 +11,8 @@ echo "${YELLOW}2: 3G, 4G/LTE Base Shield${SET}"
echo "${YELLOW}3: Cellular IoT App Shield${SET}" echo "${YELLOW}3: Cellular IoT App Shield${SET}"
echo "${YELLOW}4: Cellular IoT HAT${SET}" echo "${YELLOW}4: Cellular IoT HAT${SET}"
echo "${YELLOW}5: Tracker HAT${SET}" echo "${YELLOW}5: Tracker HAT${SET}"
echo "${YELLOW}6: 3G/4G Base HAT${SET}"
read shield_hat read shield_hat
case $shield_hat in case $shield_hat in
@ -19,6 +21,7 @@ case $shield_hat in
3) echo "${YELLOW}You chose CellularIoT Shield${SET}";; 3) echo "${YELLOW}You chose CellularIoT Shield${SET}";;
4) echo "${YELLOW}You chose CellularIoT HAT${SET}";; 4) echo "${YELLOW}You chose CellularIoT HAT${SET}";;
5) echo "${YELLOW}You chose Tracker HAT${SET}";; 5) echo "${YELLOW}You chose Tracker HAT${SET}";;
6) echo "${YELLOW}You chose 3G/4G Base HAT${SET}";;
*) echo "${RED}Wrong Selection, exiting${SET}"; exit 1; *) echo "${RED}Wrong Selection, exiting${SET}"; exit 1;
esac esac
@ -167,12 +170,15 @@ do
wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_tracker -O reconnect.sh wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_tracker -O reconnect.sh
elif [ $shield_hat -eq 6 ]; then
wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_basehat -O reconnect.sh
fi fi
mv reconnect.sh /usr/src/ mv reconnect.sh /usr/src/
mv reconnect.service /etc/systemd/system/ mv reconnect.service /etc/systemd/system/
systemctl daemon-reload systemctl daemon-reload
systemctl enable reconnect.service systemctl enable reconnect.service

View File

@ -0,0 +1,21 @@
#!/bin/sh
# /usr/src/reconnect
# for Base HAT
gpio -g mode 26 out #HAT_POWER_OFF
gpio -g mode 19 out #W_DISABLE
gpio -g write 26 0
gpio -g write 19 0
while true; do
ping -q -I ppp0 -c 1 8.8.8.8 -s 0 >/dev/null
if [ $? -ne 0 ]; then
echo "Connection down, reconnecting..."
sudo pon
fi
sleep 10
done