Softwares |
Main /
Bash-script-to-connect-with-Indian-mobile-networksMain.Bash-script-to-connect-with-Indian-mobile-networks HistoryHide minor edits - Show changes to output Added lines 5-7:
Reference & Credit - http://forums.debian.net/viewtopic.php?f=5&t=74246 Added lines 10-71:
#!/bin/bash # # A bash script to connect with Indian mobile networks. # # This script is tested with Teracom device (Model no. LW273) only, and might # not work with other devices because of the differences in AT commands. # usage() { echo "Usage: wv-connect.sh <APN> [TECH]" echo echo "Where, APN should be:" echo echo " bsnlnet = BSNL" echo " www = Vodafone India" echo " internet = Idea Cellular" echo " TATA.DOCOMO.INTERNET = Tata Docomo" echo echo "check with your mobile provider for the valid APN" echo echo "and, opetionally TECH can be:" echo echo " umts = UMTS mode (3G)" echo " edge = EDGE mode (2G)" echo " auto = Automatic" echo echo "For example, to connect to BSNL 3G network" echo echo " wv-connect.sh bsnlnet umts" echo echo "This script is tested with Teracom (LW273/LW272) devices only." exit } nodev() { echo "ERROR: No device." exit } nowvdial() { echo "ERROR: wvdial is not installed." exit } test "$1" && APN="$1" || usage test "$2" && TECH="$2" || TECH="auto" WVDIAL=`which wvdial` DEVICE="/dev/ttyACM0" case "$TECH" in umts) FUN=6;; edge) FUN=5;; auto) FUN=1;; *) usage;; esac test -c $DEVICE || nodev test -f $WVDIAL || nowvdial cat <<EOT > /tmp/wvdial-gsm.conf Changed line 74 from:
Modem = to:
Modem = $DEVICE Changed lines 82-83 from:
Init3 = AT+CFUN= Init4 = AT+CGDCONT=1,"IP"," to:
Init3 = AT+CFUN=$FUN Init4 = AT+CGDCONT=1,"IP","$APN" EOT $WVDIAL -C /tmp/wvdial-gsm.conf Added lines 1-27:
(:Google1:) (:Googletxt:) ---- !!bash script to connect with Indian mobile networks. (:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:) [@ [Dialer Defaults] Modem Type = USB Modem Modem = /dev/ttyACM0 Baud = 460800 Stupid Mode = 1 Phone = *99# Username = " " Password = " " Init1 = AT Init2 = AT&F Init3 = AT+CFUN=5 Init4 = AT+CGDCONT=1,"IP","bsnlnet" @] (:tableend:) ---- (:Googlemm:) |