Tuesday, July 21, 2009

Back on the Wireless Web

I'm finally back on the blogosphere after 45 days without internet access at night when my blogging neurons are most active. And this time im on the wireless web. Not WiFi, its so yesteryear. Im connected on Reliance Netconnect EVDO, which is a CDMA wireless broadband technology. Don't be impressed by the tech, true to Reliance the speed and service suck top notch. I dont know why the Ambanis make so much money. Anyway, something is better than nothing.

It looks cool and suave, but its a horrible chinese product. And guess what, it doesn't work out of the box on Linux because the device behaves as both Modem and FlashDrive.

Getting it working on Linux is not for the faint hearted. This is how i got ZTE8710 working on Ubuntu Intrepid after 3 hours (It's supposedly easier in Ubuntu Jaunty):

Make sure you're logged in as root
$ su

Step 1. Make OS recognize it as Modem and not a FlashDrive.

You can do this either by using usb_modeswitch or ZTE8700 drivers.

And the following cmds are helpful for debugging this step:

$ lsusb
Vendor and Product of device. If the device is being recognized as FlashDrive Vendor/Product is 0x19d2/0xfff6. If the device is recognized as Modem, Vendor/Product is 0x19d2/0xfff1

$ dmesg | tail
Tail kernel log to see if USB is being mounted in the proper location. If its mounted on /media its treated as flash drive. If its mounted on /dev/ttyUSB, its treated as Modem

$ tail -f /var/log/messages
This log is also a Kernel log where you can monitor device being connected/disconnected

What to choose?

usb_modeswitch is written exactly for the purpose of switching from Flash drive mode to Modem. But somehow i couldn't get it to work.

As suggested in tuxhat post, this is what i did.
1. Download ZTE drivers for AC8700 from http://www.ztemt.com.cn/ennewzte/service/ziliao.action
2. $ dpkg -i ztemtEVDO-1.1-8-i386-ubuntu804.deb
3. Installation fails saying ztemt.ko not found.
4. Don't give up yet
$ cd /usr/local/bin/ztemtEVDO
$ tar -xvf usb-serial.tar.gz

Go to extracted folder and run make.
It builds ztemt.ko. Copy ztemt.ko to /usr/local/bin/ztemtEVDO

5. Now ztemt comes with 2 utils: ztemtevdo and ztemtvcdromd. ztemtvcdromd is used for swtiching modes

$ ztemtvcdromd
reinsert device
$ lsusb

The device must have switched from Flash mode(0xfff6) to Modem mode(0xfff1)

$ ztemtevdo still errors out. I haven't figured out what it is.

If you have got it going till now, cheers.

Step 2. Mount usbserial kernel module to use the USB modem

usbserial module is not loaded by default in Ubuntu. You can load it in two ways:
1. Add a line to /boot/grub/menu.lst file [works only in Ubuntu Jaunty]
2. Use modprobe
$ modprobe usbserial vendor=$VENDOR_ID product=$PRODUCT_ID

This turned out to be the timesucker for me. The Product ID you use here is the product id corresponsing to Modem mode(0xfff1) not FlashDrive mode(0xfff6). So don't execute this command until you successfully switch to modem mode

Its time for some command line trivia:

loads a kernel module with supplied options

list all loaded kernel modules

lsmod | grep usbserial
check if usbserial is successfully loaded

If you got it mounted successfully, you're just one step away from getting disappointed (ofcourse after using Reliance Netconnect on Ubuntu)

Step 3. Use wvdial to connect

The next step is a breeze. Get wvdial, edit the config file and you're connected.

$ sudo apt-get install wvdial
make install from source (http://freshmeat.net/projects/wvdial/)

$ vi /etc/wvdial.conf

Here's a snapshot of my config file:

[Dialer Defaults]
Init2=ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
Username=########## (Your 10 digit number)
stupid mode=1

Now run
$ wvdial

And you're Netconnected. All this pain for 'some stupid mode = 1' surfing through a dumb AT command modem.

So, what do you have to do for everyday surfing?
$ su
$ ztemtvcdromd
Plugin device
[Optional: $ lsusb to make sure device is in modem mode]
$ modprobe usbserial vendor=$VENDOR_ID product=$PRODUCT_ID
$ wvdial

Or make a convenient shell script and execute it.

Here are some more links which i found helpful:
1. http://www.tuxhat.com/linux/reliance-netconnect-broadband-on-linux/
2. http://outbackwifi.blogspot.com/2009/06/howto-connect-to-internet-using-zte-ac.html
3. http://thejeshgn.com/2008/01/12/reliance-netconnect-usb-card-on-linux-howto/
4. http://mysimpletricks.wordpress.com/2009/04/30/reliance-netconnect-broadband-on-linux-jaunty-jackalope-ubuntu-904/