TATA Indicom datacard (Huawei cdma) on Linux/Ubuntu!!

TATA Indicom datacard (Huawei cdma) on Linux/Ubuntu!!

Introduction –  Two days back I brought TATA Indicom datacard! As I am Ubuntu user. I wanted to use this datacard on Ubuntu Linux!  PPP is the Point to Point protocol used for establishing internet links over dial-up modems, DSL connections, and many other types of point-to-point links. The pppd daemon works together with the kernel PPP driver to establish and maintain a PPP link with another system (called the peer) and to  negotiate Internet Protocol (IP) addresses for each end of the link. pppd daemon can also authenticate the peer and/or supply authentication information to the peer.

What you need to use Tataindicom datacard on Ubuntu Linux ?

make sure that two kernel module ie ‘usbserial‘ and ‘usbcore‘ are loaded!

root@arun:~# modinfo usbserial
filename:       /lib/modules/2.6.24-16-generic/kernel/drivers/usb/serial/usbserial.ko
license:        GPL
description:    USB Serial Driver core
author:         Greg Kroah-Hartman, greg@kroah.com, http://www.kroah.com/linux/
srcversion:     FE4A4FC2C18B17DDD77E8C6
depends:        usbcore
vermagic:       2.6.24-16-generic SMP mod_unload 586
parm:           vendor:User specified USB idVendor (ushort)
parm:           product:User specified USB idProduct (ushort)
parm:           debug:Debug enabled or not (bool)
root@arun:~#

root@arun:~# modinfo usbcore
filename:       /lib/modules/2.6.24-16-generic/kernel/drivers/usb/core/usbcore.ko
license:        GPL
srcversion:     E8DACA0029626C336D1A513
alias:          usb:v*p*d*dc*dsc*dp*ic09isc*ip*
alias:          usb:v*p*d*dc09dsc*dp*ic*isc*ip*
depends:
vermagic:       2.6.24-16-generic SMP mod_unload 586
parm:           usbfs_snoop:true to log all usbfs traffic (bool)
parm:           blinkenlights:true to cycle leds on hubs (bool)
parm:           old_scheme_first:start with the old device initialization scheme (bool)
parm:           use_both_schemes:try the other device initialization scheme if the first one fails (bool)
parm:           autosuspend:default autosuspend delay (int)
root@arun:~#

* To use datacard (which is ppp link) you need to install two packages ie ppp daemon and wvdial as dialer!

root@arun:~# dpkg -l | grep  wvdial
ii  wvdial                                     1.60.1                             PPP dialer with built-in intelligence
root@arun:~# dpkg -l | grep  ppp
ii  ppp                                        2.4.4rel-9ubuntu2                  Point-to-Point Protocol (PPP) daemon
ii  pppconfig                                  2.3.17ubuntu1                      A text menu based utility for configuring pp
ii  pppoeconf                                  1.17ubuntu1                        configures PPPoE/ADSL connections
root@arun:~#

on Ubuntu you need to install above packages

How to configure ? –

” wvdialconf ” command is available on Ubuntu, which will  detect you modem and it’s related stuff  and  this command will generate or updates the configuration file “/etc/wvdial.conf

root@arun:~# wvdialconf
root@arun:~#

* After running above command just update user name and password in “/etc/wvdial.conf” configuration file

root@arun:~# cat /etc/wvdial.conf

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
Phone = Phone_number like (#xxx)
ISDN = 0
Username = USERNAME
Password = PASSWORD
New PPPD = yes
Modem = /dev/ttyUSB0
Baud = 9600
root@arun:~#

** you can also edit this file manually just refer the man pages for more details!

root@arun:~# man wvdialconf
root@arun:~# man wvdial.conf

arun@arun:~$ man wvdial

root@arun:~# cat /etc/wvdial.conf

[Dialer TataIndicom]
Stupid Mode = 1
Inherits = Modem0
New PPPD = yes
Phone = Phone_number like (#xxx)
Username = USERNAME
Password = PASSWORD

[Modem0]
Init1 = ATZ
SetVolume = 0
Modem Type = Analog Modem
Modem = /dev/ttyUSB0
Dial Command = ATDT
Baud = 115200 or 9600 (depends on support)
FlowControl = Hardware (CRTSCTS)

root@arun:~#

** How to use it or dial!!

1) Now it’s time to check your luck! If you are using default conf file created by ” wvdialconf ” command just use below command…

root@arun:~#  wvdial > /var/log/tataindicom.log  2>&1  &

OR
root@arun:~# wvdial

…..
root@arun:~#

root@arun:~# tail -f /var/log/tataindicom.log
OK
–> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
–> Modem initialized.
–> Sending: ATDT#***
–> Waiting for carrier.
ATDT#777
CONNECT 230400
–> Carrier detected.  Waiting for prompt.

–> Don’t know what to do!  Starting pppd and hoping for the best.
–> Starting pppd at Sat Jun 20 21:56:51 2008
–> Pid of pppd: 7152
–> Using interface ppp0
–> pppd: X�[06][08]��[06][08]
–> local  IP address 219.80.X.X
–> pppd: X�[06][08]��[06][08]
–> remote IP address 173.B.C.D
….
…..
root@arun:~#

2) If you have manually edited your conf file as shown above then use below command

root@arun:~#  wvdial TataIndicom
..
….
root@arun:~#

** Now check ppp0 interface is available

root@arun:~# ifconfig
eth0      Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX
UP BROADCAST MULTICAST  MTU:1500  Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:256 (256.0 B)  TX bytes:492 (492.0 B)
Base address:0x4020 Memory:e4600000-e4620000

ppp0      Link encap:Point-to-Point Protocol
inet addr:219.80.X.X  P-t-P:173.B.C.D  Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1400  Metric:1
RX packets:1574 errors:1 dropped:0 overruns:0 frame:0
TX packets:1644 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:556116 (543.0 KB)  TX bytes:179325 (175.1 KB)

lo        Link encap:Local Loopback
inet addr:127.0.0.1  Mask:255.0.0.0

…..

root@arun:~#

root@arun:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
173.B.C.D       *               255.255.255.255 UH    0      0        0 ppp0
default         *               0.0.0.0         U     0      0        0 ppp0
root@arun:~#

** Check pppd daemon and how to start/stop/status the connection ?

root@arun:~# /etc/init.d/tataindicom 
Usage: /etc/init.d/tataindicom {start|stop|status}
root@arun:~#

root@arun:~# /etc/init.d/tataindicom   start
Starting the TATA Indicom datacard service..
log file is /var/log/tataindicom.log

Done.
root@arun:~#

root@arun:~# /etc/init.d/tataindicom   status
TATA Indicom datacard –
Dailer :: 7144    /usr/bin/wvdial
pppd daemon :: 7152   /usr/sbin/pppd  9600 modem crtscts defaultroute usehostname -detach user internet noipdefault call wvdial usepeerdns idle 0 logfd 6
root@arun:~#

root@arun:~# /etc/init.d/tataindicom  stop
killing pppd daemon and dailer…

Done.
root@arun:~#

command(1) pppd  – point to point daemon

Frequently used options –
ttyname
Use the serial port called ttyname to communicate with the peer.  If ttyname does not begin  with  a  slash  (/),  the  string  “/dev/”  is
prepended  to  ttyname to form the name of the device to open.  If no device name is given, or if the name of the terminal connected to the
standard input is given, pppd will use that terminal, and will not fork to put itself in the background.

speed  An  option  that  is  a  decimal number is taken as the desired baud rate for the serial device.

crtscts
Specifies that pppd should set the serial port to use hardware flow control using the RTS and CTS signals in the RS-232 interface.  If nei‐
ther  the  crtscts,  the nocrtscts, the cdtrcts nor the nocdtrcts option is given, the hardware flow control setting for the serial port is
left unchanged.  Some serial ports (such as Macintosh serial ports) lack a true RTS output. Such serial ports use this  mode  to  implement
unidirectional  flow control. The serial port will suspend transmission when requested by the modem (via CTS) but will be unable to request
the modem to stop sending to the computer. This mode retains the ability to use DTR as a modem control line.

defaultroute
Add a default route to the system routing tables, using the peer as the gateway, when IPCP negotiation  is  successfully  completed.   This
entry is removed when the PPP connection is broken.  This option is privileged if the nodefaultroute option has been specified.

usehostname
Enforce  the  use  of the hostname (with domain name appended, if given) as the name of the local system for authentication purposes (over‐
rides the name option).

call name
Read additional options from the file /etc/ppp/peers/name.  This file may contain privileged options, such as noauth, even if pppd  is  not
being  run  by  root.   The  name  string  may  not  begin with / or include .. as a pathname component

noipdefault
Disables the default behaviour when no local IP address is specified, which is to determine (if possible) the local  IP  address  from  the
hostname.   With  this option, the peer will have to supply the local IP address during IPCP negotiation (unless it specified explicitly on
the command line or in an options file).

nodetach
Don’t detach from the controlling terminal.  Without this option, if a serial device other than the terminal on the standard input is spec‐
ified, pppd will fork to become a background process.

usepeerdns
Ask the peer for up to 2 DNS server addresses.  The addresses supplied by the peer (if any) are passed to the /etc/ppp/ip-up script in  the
environment  variables  DNS1  and  DNS2,  and  the  environment  variable  USEPEERDNS  will  be set to 1.  In addition, pppd will create an
/etc/ppp/resolv.conf file containing one or two nameserver lines with the address(es) supplied by the peer.

user USERNAME
Sets the name used for authenticating the local system to the peer to name.

idle N Specifies that pppd should disconnect if the link is idle for N seconds.  The link is idle when no data packets (i.e. IP packets) are being
sent or received.  Note: it is not advisable to use this option with the persist option without the demand option.

logfd N
Send log messages to file descriptor N.  Pppd will send log messages to at most one file or file descriptor (as well  as  sending  the  log
messages  to syslog), so this option and the logfile option are mutually exclusive.  The default is for pppd to send log messages to stdout
(file descriptor 1), unless the serial port is already open on stdout.

root@arun:~# cat  /etc/ppp/peers/wvdial
noauth
name wvdial
usepeerdns
root@arun:~#

** Want to see the code  of “/etc/init.d/tataindicom” ?

root@arun:~# cat /etc/init.d/tataindicom
#!/bin/bash

case “$1” in

start)
echo “Starting the TATA Indicom datacard service..”
/usr/bin/wvdial > /var/log/tataindicom.log 2>&1  &
echo “log file is /var/log/tataindicom.log”
echo “…”
echo “Done.”
;;

stop)
echo “killing pppd daemon and dailer…”
kill -9 $(ps auxwww  |  grep “$(which wvdial)”  | grep -v grep | awk  ‘{print $2}’)
kill -9 $(ps auxwww  |  grep “$(which pppd)”  | grep -v grep | awk  ‘{print $2}’)
echo “…”
echo “Done.”
;;
status)
echo “TATA Indicom datacard -”
pid_of_dailer=$( ps auxwww  |  grep “$(which wvdial)”  | grep -v grep | awk  ‘{print $2}’)
pid_of_pppd=$(ps auxwww  |  grep “$(which pppd)”  | grep -v grep | awk  ‘{print $2}’)
pppd_details=”$(ps auxwww | grep “$(which pppd)” | grep -v grep   | awk -F’pppd’  ‘{print $2}’)”
echo -e “Dailer :: $pid_of_dailer    $(which wvdial)”
echo -e “pppd daemon :: $pid_of_pppd   $(which pppd) $pppd_details”
;;
*)
echo “Usage: /etc/init.d/tataindicom {start|stop|status}”
exit 1
esac
exit 0
root@arun:~#

Thank you,
Arun Bagul

Similar Posts:

20 Replies to “TATA Indicom datacard (Huawei cdma) on Linux/Ubuntu!!”

  1. Hi Arun,

    great script. I am getting below error with your steps. Can u suggest something?

    root@ameya-laptop:/home/ameya# /etc/init.d/tataindicom start
    stop: missing job name
    Try `stop –help’ for more information.
    /etc/init.d/tataindicom: line 29: status}”: command not found
    root@ameya-laptop:/home/ameya# /etc/init.d/tataindicom stop
    stop: missing job name
    Try `stop –help’ for more information.
    /etc/init.d/tataindicom: line 29: status}”: command not found
    root@ameya-laptop:/home/ameya# /etc/init.d/tataindicom status
    stop: missing job name
    Try `stop –help’ for more information.
    /etc/init.d/tataindicom: line 29: status}”: command not found
    root@ameya-laptop:/home/ameya# /etc/init.d/tataindicom
    stop: missing job name
    Try `stop –help’ for more information.
    /etc/init.d/tataindicom: line 29: status}”: command not found
    ———————

    and my file is like this..
    root@ameya-laptop:/home/ameya# cat /etc/init.d/tataindicom
    #!/bin/bash

    case “$1″ in

    start)
    echo “Starting the TATA Indicom datacard service..”
    /usr/bin/wvdial > /var/log/tataindicom.log 2>&1 &
    echo “log file is /var/log/tataindicom.log”
    echo “…”
    echo “Done.”
    ;;

    stop)
    echo “killing pppd daemon and dailer…”
    kill -9 $(ps auxwww | grep “$(which wvdial)” | grep -v grep | awk ‘{print $2}’)
    kill -9 $(ps auxwww | grep “$(which pppd)” | grep -v grep | awk ‘{print $2}’)
    echo “…”
    echo “Done.”
    ;;
    status)
    echo “TATA Indicom datacard -”
    pid_of_dailer=$( ps auxwww | grep “$(which wvdial)” | grep -v grep | awk ‘{print $2}’)
    pid_of_pppd=$(ps auxwww | grep “$(which pppd)” | grep -v grep | awk ‘{print $2}’)
    pppd_details=”$(ps auxwww | grep “$(which pppd)” | grep -v grep | awk -F’pppd’ ‘{print $2}’)”
    echo -e “Dailer :: $pid_of_dailer $(which wvdial)”
    echo -e “pppd daemon :: $pid_of_pppd $(which pppd) $pppd_details”
    ;;
    *)
    echo “Usage: /etc/init.d/tataindicom {start|stop|status}”
    exit 1
    esac
    exit 0
    ——————————

  2. Hi,
    Dialer is working properly but self is not able to browse any website is there any more configuration required.

    Thanks & Regards,
    Neil

  3. Hi,
    I am trying to work with CDMA mobile modem, but I am not getting the modem configured properly, would you please help me figured it out.

  4. Hello Abhinandan,
    when you plugin your CDMA mobile (if it’s connect with USB)
    run command
    $ sudo lsusb
    Bus 001 Device 004: ID 0421:0443 CDMA Mobile Phones
    Here 0421 is the vendor ID and 0443 is the product ID of the Nokia phone. Your values could be different based on the phone you are connecting. But more often than not the descriptions should help you find the right line corresponding to your code. You will have other lines of output corresponding to other USB devices
    Now run the command
    sudo /sbin/modprobe usbserial vendor=0x0421 product=0x0443
    Create your wvdial.conf by running the following
    sudo wvdialconf /etc/wvdial.conf
    now it shows modem in /etc/wvdial.conf

  5. I congratulate you for creating such a well laid and easy way to configure.. It is a great asset for novices as I..
    I am struck at the dialling step here is what I get.. Can you help me here

    dr-smit@dr-smit-laptop:~$ wvdial >

    /var/log/tataindicom.log 2>&1 &
    bash: /var/log/tataindicom.log: Permission denied
    [1] 6712
    [1]+ Exit 1 wvdial > /var/log/tataindicom.log 2>&1

  6. Hi! Dr Smit Shrivastava,

    you are running this script as normal user. Only root user has permission to create files/directories in “/var/log” directory … please change the path or run script as “root” user…

  7. Hi Arun,

    Can you suggest for following error

    root@mastermind:~# /etc/init.d/tataindicom start
    stop: missing job name
    Try `stop –help’ for more information.
    /etc/init.d/tataindicom: line 29: status}”: command not found

    and my file like this :

    #!/bin/bash

    case “$1″ in

    start)
    echo “Starting the TATA Indicom datacard service..”
    /usr/bin/wvdial > /var/log/tataindicom.log 2>&1 &
    echo “log file is /var/log/tataindicom.log”
    echo “…”
    echo “Done.”
    ;;

    stop)
    echo “killing pppd daemon and dailer…”
    kill -9 $(ps auxwww | grep “$(which wvdial)” | grep -v grep | awk ‘{print $2}’)
    kill -9 $(ps auxwww | grep “$(which pppd)” | grep -v grep | awk ‘{print $2}’)
    echo “…”
    echo “Done.”
    ;;
    status)
    echo “TATA Indicom datacard -”
    pid_of_dailer=$( ps auxwww | grep “$(which wvdial)” | grep -v grep | awk ‘{print $2}’)
    pid_of_pppd=$(ps auxwww | grep “$(which pppd)” | grep -v grep | awk ‘{print $2}’)
    pppd_details=”$(ps auxwww | grep “$(which pppd)” | grep -v grep | awk -F’pppd’ ‘{print $2}’)”
    echo -e “Dailer :: $pid_of_dailer $(which wvdial)”
    echo -e “pppd daemon :: $pid_of_pppd $(which pppd) $pppd_details”
    ;;
    *)
    echo “Usage: /etc/init.d/tataindicom {start|stop|status}”
    exit 1
    esac
    exit 0

  8. Hi! Dhiraj

    This is char settting problem
    please change few char after coping script from the blog you will notice which char need to change before running script

  9. what is the tata indicom user name and password number plzzzzzzzzzzzzzzz
    send me for free internet

  10. Hello Arun,

    Great script,

    I have one question…i my ubuntu…wvdial is working fine….i am getting connected to the Internet.

    but when i will execute the following command
    root@vishnu-desktop:~# modinfo usbcore
    root@vishnu-desktop:~# modinfo usbserial

    it gives me the following message
    modinfo: could not find module usbserial

    but i am connecting to the internet when execute the wvdial command.

    so my question is that is there any speed diff ? as these two module are not on system

    your help is appreciate.

    Thanks
    Vishnu U

  11. Hi Vishnu,

    Above modules should be there but may not be loadable, I mean there are part of kernel (part of kernel binary) itself (not as separate loadable module)

  12. i have one question… will you please help me…

    i have data card and i want to use for both os like (windows xp and linux) will it works or not

Leave a Reply

Your email address will not be published.