Skip to content

Instantly share code, notes, and snippets.

@j3tm0t0
Last active May 16, 2016 06:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j3tm0t0/2a126ba2592202ba5de4498d8a56cfb2 to your computer and use it in GitHub Desktop.
Save j3tm0t0/2a126ba2592202ba5de4498d8a56cfb2 to your computer and use it in GitHub Desktop.
run as root to configure your raspbian to use AK-020 with SORACOM Air SIM
#!/bin/bash
# install required packages
apt-get install -y eject wvdial
# add wvdial config
cat << EOF > /etc/wvdial.conf
[Dialer Defaults]
Init1 = ATZ
Init2 = AT+CFUN=1
Init3 = AT+CGDCONT=1,"IP","soracom.io"
Dial Attempts = 3
Modem Type = Analog Modem
Dial Command = ATD
Stupid Mode = yes
Baud = 460800
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
APN = soracom.io
Phone = *99***1#
Username = sora
Password = sora
Carrier Check = no
Auto DNS = 1
Check Def Route = 1
EOF
# add replacedefaultroute option to ppp config
cat << EOF > /etc/ppp/peers/wvdial
noauth
name wvdial
usepeerdns
replacedefaultroute
EOF
# add config to auto connect on start
cat <<EOF > /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
eject sr0
modprobe usbserial vendor=0x15eb product=0x7d0e
echo waiting for modem device
for i in {1..30}
do
[ -e /dev/ttyUSB0 ] && break
echo -n .
sleep 1
done
[ $i = 30 ] && ( echo modem not found ; exit 1 )
wvdial &
exit 0
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment