Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[solved] BSNL 3G Teracom 7.2Mbps USB datacard with SIM

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
bkpsusmitaa
Posts: 485
Joined: 2009-07-04 06:32
Location: Home: Barrackpore and Mysore
Has thanked: 5 times

[solved] BSNL 3G Teracom 7.2Mbps USB datacard with SIM

#1 Post by bkpsusmitaa »

There is an amazing post on configuring BSNL 3G Teracom 7.2Mbps datacard with 2G/3G SIM at http://amit-mendapara.blogspot.com/2010 ... nl-3g.html . This does however not work with Debian Lenny because there is no modeswitch package in lenny, but it works with Ubuntu. It works like a dream in Squeeze.
I was also helped by this post. The inbuilt Linux drivers available with the system does not work. However, the modeswitch command is no longer required in Debian Squeeze. The updated Modeswitch package seems to differentiate between the USB datacard and ordinary USB Pen Drives.
The summary is as follows (courtesy Amit Mendapara):
First install usb_modeswith package if it is not installed.

Code: Select all

apt-get install usb_modeswitch
Using lsusb I found that the device has three configurations. The default one is to mount the device as a cddrive so that you can install the provided application and next two configurations are to mount the device as modem. So first I tried switching the device mode from cdrom to modem with following command:

usb_modeswitch -v 230d -p 0001 -u 3

Here 230d is vendor id and 0001 is the product id of the device and as we are switching to modem mode with configuration number 3 is given. After issuing this command the device was switched to modem mode and then I was able to configure the NetworkManager with APN as bsnlnet to connect to the internet.

In order to make this process automatic we need to create a udev rule and a device specific configuration for the usb_modeswith. Here's how I did this:

1. Create udev rule.

Open the /lib/udev/rules.d/40-usb_modeswitch.rules and search for a line with:
LABEL="modeswitch_rules_begin"

Right after that line, add a new line with following contents:
ATTRS{idVendor}=="230d", ATTRS{idProduct}=="0001", RUN+="usb_modeswitch '%b/%k'"


2. Create usb_modeswitch configuration
Create a new configuration /etc/usb_modeswitch.d/230d:0001 and put the following contents in that file.

########################################################

Code: Select all

# BSNL Teracom

DefaultVendor= 0x230d
DefaultProduct=0x0001
Configuration=3
That's it. Just remove the device and replug it. Now you should see the device is being mounted as modem instead of cdrom.

Have a fun with BSNL 3g!
A customised wvdial.conf file would look like:

Code: Select all

[Dialer Defaults]
Modem Type = USB Modem
Phone = *99#
Username = " "
Password = " "
Init1 = ATE0V1
Init2 = AT+CFUN=6
Modem = /dev/ttyACM0
Baud = 460800
Stupid Mode = 1

[Dialer bsnl]
Init3 = AT+CGDCONT=1,"IP","bsnlnet"

[Dialer vodafone]
Init3 = AT+CGDCONT=1,"IP","www"

[Dialer ciev]
Init3 = AT+CIND?
Modem = /dev/ttyACM1
Dial Command = AT+CMER=
Phone = 3,0,0,1
Dial Attempts = 0

[Dialer cind]
Init3 = AT+CIND?
Modem = /dev/ttyACM1
Dial Command =
Phone =
Dial Attempts = 1
Place a copy of a script file "run" at the home folder, with the following lines:

Code: Select all

cd /home/user/wv/
sudo ./start.sh
The start.sh file with appropriate permissions would look like:

Code: Select all

#!/bin/bash
test "$1" && connection="$1" || connection="bsnl"
while true
do
    if [ -c /dev/ttyACM0 ] ; then
        wvdial -C ./wvdial.conf $connection
        sleep 1
    else
        echo "Waiting for device..."
        sleep 3
    fi
done
The connection can also be started by running the script file wv-connect.sh, without the start.sh and wvdial.conf script files. wv-connect.sh contains the following codes:

Code: Select all

#!/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
[Dialer Defaults]
Modem Type = USB Modem
Modem = $DEVICE
Baud = 460800
Stupid Mode = 1
Phone = *99#
Username = " "
Password = " "
Init1 = AT
Init2 = AT&F
Init3 = AT+CFUN=$FUN
Init4 = AT+CGDCONT=1,"IP","$APN"
EOT

$WVDIAL -C /tmp/wvdial-gsm.conf
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home

Post Reply