Thursday, June 25, 2009

Howto connect to the Internet using ZTE AC 8710 USB EVDO modem and Reliance Netconnect Plus service in Ubuntu

-------------Update on 26 Dec 09 ----------------------------------
Ive upgraded to Ubuntu Karmic Koala (9.10) and found to my pleasant surprise that I dont have to do the modeswitch as explained below... The kernel parameters are required to be passed at boot time but once you insert the modem, the switch happens automatically! Upon insertion, my dmesg shows this:
1781.557336] usb 4-1: new full speed USB device using uhci_hcd and address 7
[ 1781.728425] usb 4-1: configuration #1 chosen from 1 choice
[ 1781.733527] usbserial_generic 4-1:1.0: GSM modem (1-port) converter detected
[ 1781.733858] usb 4-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 1781.737839] usbserial_generic 4-1:1.1: GSM modem (1-port) converter detected
[ 1781.738124] usb 4-1: GSM modem (1-port) converter now attached to ttyUSB1
[ 1781.739791] usbserial_generic 4-1:1.2: GSM modem (1-port) converter detected
[ 1781.740855] usb 4-1: GSM modem (1-port) converter now attached to ttyUSB2
[ 1781.744782] usbserial_generic 4-1:1.3: GSM modem (1-port) converter detected
[ 1781.745112] usb 4-1: GSM modem (1-port) converter now attached to ttyUSB3
[ 1781.747243] usbserial_generic 4-1:1.4: GSM modem (1-port) converter detected
[ 1781.747527] usb 4-1: GSM modem (1-port) converter now attached to ttyUSB4

So I directly run wvdial cdma and connect.
Ps. I am still not able to use Network Manager which now includes an entry for Reliance in the Mobile Broadband section.

-----------------------------------------End of Update------------------------------------------------


The prerequisites to achieve the above are:


1. An activated Reliance Netconnect Plus EVDO service with the ZTE AC8710 EVDO modem.

2. A laptop/desktop with Ubuntu Jaunty Jackalope (9.04); It could/should work with other flavors/versions too with minor tweaks.

3. The usb_modeswitch utility from here --> http://www.draisberghof.de/usb_modeswitch/

4. The wvdial package.

The steps:

1. First download the usb_modeswitch utility and either compile it or use the binary (this worked in my case).

2. This utility is required to switch the ZTE modem from mass storage mode to modem mode. This is because ZTE cleverly added a usb storage mode which could allow them to bundle the windows driver and utility along with the dongle thus ensuring that people using netbooks etc (those without CD-Rom drives) could install and work with the modem. Unfortunately in Linux (Ubuntu Jaunty in my case), this does not happen and the device shows up as a mass storage device always thus leading to an impasse.

3. The next interesting point to note is that with Jaunty, the usbserial module has got built into the kernel instead of being a loadable module (This is the primary difference when working with earlier flavors like Intrepid- 8.10 where this module has to be loaded with the modprobe command).

4. Hence the parameters to the usbserial module have to be passed at boot time. One needs to add the following two values (usbserial.vendor and usbserial.product) to the end of the kernel line in the /boot/grub/menu.lst for the default kernel. In my case it looks like this after modification ( I am making the assumption that people know how to edit files in Linux):-

kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=61f8e10e-6e9f-44c9-8e41-43deb8589139 ro quiet splash usbserial.vendor=0x19d2 usbserial.product=0xfff1

5. The next step is to unzip (optionally compile ) and install the usb_modeswitch tool. This puts a binary called usb_modeswitch in /usr/sbin/usb_modeswitch and the configuration file in /etc/usb_modeswitch.conf

6. Edit the /etc/usb_modeswitch.conf file to reflect the modem type and other settings. In my case the relevant line numbers (582 to 591) look so: -

   582 DefaultVendor=  0x19d2
583 DefaultProduct= 0xfff6
584
585 TargetVendor= 0x19d2
586 TargetProduct= 0xfff1
587
588 # only for reference
589 # MessageEndpoint=0x05
590
591 MessageContent="5553424312345678c00000008000069f030000000000000000000000000000"

7. The next step is to reboot after saving all changes to ensure that the usbserial module gets the required values.

8. After rebooting, we need to now switch mode. To do this, insert the USB modem, wait for it to get recognized as a mass storage device and then run the command (as root) usb_modeswitch. If one tails the messages file (tail -f /var/log/messages), one can see that new devices such as /dev/ttyUSB0 get created.

Before switch the log looks so: -

usb-storage: device scan complete

[ 2326.587996] scsi 6:0:0:0: CD-ROM ZTE USB Storage FFF1 2.31 PQ: 0 ANSI: 2

[ 2326.656896] sr0: scsi-1 drive

[ 2326.657023] sr 6:0:0:0: Attached scsi CD-ROM sr0

[ 2326.657121] sr 6:0:0:0: Attached scsi generic sg2 type 5


After switch it is:-

usb 2-2: new full speed USB device using uhci_hcd and address 10

[ 2328.646405] usb 2-2: configuration #1 chosen from 1 choice

[ 2328.649209] usbserial_generic 2-2:1.0: generic converter detected

[ 2328.649622] usb 2-2: generic converter now attached to ttyUSB0

[ 2328.652650] usbserial_generic 2-2:1.1: generic converter detected

[ 2328.653049] usb 2-2: generic converter now attached to ttyUSB1

[ 2328.655786] usbserial_generic 2-2:1.2: generic converter detected

[ 2328.656234] usb 2-2: generic converter now attached to ttyUSB2

[ 2328.658435] usbserial_generic 2-2:1.3: generic converter detected

[ 2328.658781] usb 2-2: generic converter now attached to ttyUSB3

[ 2328.661470] usbserial_generic 2-2:1.4: generic converter detected

[ 2328.661814] usb 2-2: generic converter now attached to ttyUSB4


9. Once this is done, we now need to run the wvdialconf tool to create the wvdial.conf file. In my case, it could detect the ZTE modem and detected a 9600 baud capable modem.

10. We can now edit the /etc/wvdial.conf file to add other values including the username and password (the reliance number associated with the EVDO service is both in this case). After it is done, my wvdial.conf looks so: -

     2 [Dialer cdma]
3 Stupid Mode = 1
4 Inherits = Modem0
5 Password = 93xxxxxxxx
6 Username = 93xxxxxxxx
7 Phone = #777
8
9 [Modem0]
10 Init1 = ATZ
11 Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
12 SetVolume = 0
13 Modem = /dev/ttyUSB0
14 Modem Type = Analog Modem
15 ;Baud = 9600
16 Baud = 115200
17 FlowControl = Hardware (CRTSCTS)
18 Dial Command = ATDT
19 ISDN = 0


Pl note that I added the [Dialer cdma] part and also changed line 15 from 9600 to 115200 and it works just fine!

11. Once this is done, just run the command wvdial cdma and if all goes well, you should be connected. my final output, once connected looks so:


--> WvDial: Internet dialer version 1.60

--> Cannot get information for serial port.

--> Initializing modem.

--> Sending: ATZ

ATZ

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#777

--> Waiting for carrier.

ATDT#777

CONNECT

--> Carrier detected. Starting PPP immediately.

--> Starting pppd at Thu Jun 25 09:52:01 2009

--> Pid of pppd: 11296

--> Using interface ppp0

--> pppd: ��[06][08]0�[06][08]

--> pppd: ��[06][08]0�[06][08]

--> pppd: ��[06][08]0�[06][08]

--> pppd: ��[06][08]0�[06][08]

--> pppd: ��[06][08]0�[06][08]

--> local IP address 115.240.46.196

--> pppd: ��[06][08]0�[06][08]

--> remote IP address 220.224.141.129

--> pppd: ��[06][08]0�[06][08]

--> primary DNS address 202.138.97.193

--> pppd: ��[06][08]0�[06][08]

--> secondary DNS address 202.138.96.2

--> pppd: ��[06][08]0�[06][08]

--> pppd: ��[06][08]0�[06][08]

--> pppd: ��[06][08]0�[06][08]



12. Thats it!! Fire up your browser, email client etc etc and happy surfing. I am getting 500 Kbps in Chennai and Hyderabad.

ps. i found out that i hadnt had pppd installed so had to install that as well.

I know that there might be a more elegant GUI way of doing this but this is the best I could do after reading a lot of stuff that other people had done.