[Ilugc] Got Airtel's Beetel 100cx USB modem working under linux!

  • From: girish1729@xxxxxxxxx (Girish Venkatachalam)
  • Date: Fri Aug 18 19:46:14 2006

--- Pushparajan V <vprajan@xxxxxxxxx> wrote:

I heard from ur Ilugc message above that you have
configured USB modem of
Airtel in Linux and going to write a wiki. Thanks
and its really a great
work. Please send me the wiki page link that you
have created. It will be
very helpful for everyone who use Airtel
connection.

I have no idea how many people are using this modem. I
am sorry I really don't have any time for writing a
wiki right now. It is plain text without any
formatting. If any of you can insert the appropriate
SGML tags and wikify it , it will be great. 

I did try speaking to Airtel to sell this solution to
them. But they wouldn't listen. :-(

If you any of you know any top guns in Airtel maybe I
could make a second attempt. 

This solution hardly took me five days but it can save
Airtel a great deal of money and rigmarole if this
modem is popular and also if linux is popular. :-)

Since the current approach seems to be that they ask
you to give you a request in writing, the service
engineer comes home and fits an ethernet modem. This
approach has several problems.

1) You have to wait until the representative comes
2) It is definitely loss of cash for Airtel since they
have to deploy a more expensive ethernet modem
3) The service engineer's visit does entail
inconvenience for Airtel and yourself
4) Many machines don't have ethernet card and you are
forced to purchase one :-(

But I am a hacker and I have no idea how biz works in
the real world. 

I am attaching the article in plain text. A word of
caution for Windoze folks. Due to CR CRLF problem, you
should open it in Wordpad or vim , not Notepad...

Admittedly it is quite difficult to follow and
somewhat quirky to get it working. I am planning to
make a liveCD image soon, it should be ready in about
a week's time. 

If any of you could host the ISO ,it will be great
too!

I have made every attempt to make the procedure simple
for users, but you need a lot of experience to follow
it. Sorry about that. 

Best,
Girish

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com ;
-------------- next part --------------
So do you want to be able to connect to the BSNL broadband network using an 
Airtel's Beetel 100CX USB modem? 

Simple. Just follow this procedure.

First download the latest shiny kernel from 
 ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.17.8.tar.bz2

 You can use any method of course though most of you would use the browser. I 
being a command line jukie prefer wget. 

 If my link is somewhat unstable I would type this.

 $ wget -c  ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.17.8.tar.bz2

 So I really don't have to bother about broken downloads since wget 
automatically resumes the download instead of starting from the beginning.

 Once you have the shiny kernel downloaded, unpack it. 

 # mv linux-2.6.17.8.tar.bz   /usr/src 

 # tar jxf linux-2.6.17.8.tar.bz    

 Now you have to obtain the drivers for the Conexant accessrunner chipset 
called cxacru from 

 http://accessrunner.sourceforge.net/driver.shtml

 And following the instructions there, you have to have the cvs program 
installed. You could also use TortoiseCVS plugin or a graphical cvs client.

 Type this.

 $cvs -z9 -q -d :pserver:anoncvs:anoncvs@xxxxxxxxxxxxxxxxx:/home/cvs co usbatm

 and put the files under drivers/usb/atm in the kernel source tree. Precisely 
this is put under say,

 /usr/src/linux-2.6.17.8/drivers/usb/atm

 Now we are all set to build our kernel driver which is a very critical 
component of the whole affair. 

 Please ensure that you have built a 2.6 kernel before. I don't want you to 
figure out unrelated problems and get discouraged. If you are an experienced 
kernel hacker you may go ahead of course. Whatever it is, you can always email 
me should you have any problems.

# cd /usr/src/linux-2.6.17.8
# make xconfig (or make menuconfig)

 Go to the networking subsystems and choose all the relevant components to be 
included in the kernel.

 Please remember to select the top menu item 

    "Prompt for development and/or incomplete code/drivers (EXPERIMENTAL)"
        ...
        Asynchronous Transfer Mode (ATM) (EXPERIMENTAL) (ATM)
        ...
        Support for Host-side USB (USB)
        ...
        USB DSL modem support (USB_ATM)
        ...
        Conexant AccessRunner USB support (USB_CXACRU)


Of course you need to select several other modules to be included too 
especially the USB subsystem drivers. There are several of them. Doesn't hurt 
to include all of them as modules since you are going to be loading them only 
when required. 


Then if you are on a Debian GNU/Linux system you are in luck bcoz life is goign 
to be very simple now onwards since I am going to deal only with that now 
onwards. Also several distros these days are spinoffs from the Debian project, 
so my instructions might apply to them as well. 

I will however try if I can help give generic instructions that can be followed 
on other linux distros too. 

First the easy Debian way.

#apt-get install kernel-package ( If you don't already have it)

#cd /usr/src/linux-2.6.17.8
#make-kpkg clean && make-kpkg --initrd kernel_image

This will ask you a question to which you answer yes and then the kernel will 
be built over a long time depending upon the speed of your machine. 

In the end, you type, 

# cd ..

#dpkg -i kernel-image--2.6.17.8_0.00.Custom_i386.deb

This will also create entries for this kernel in your boot loader say grub.

Now it is time to reboot into your new kernel and continue our story. But 
before we get there I will try to explain how this can be done on other linux 
systems.

type

# cd /usr/src/linux-2.6.17.8

# make clean

# make dep

# make 

# make modules

# make modules_install

# cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.17.8

# mkinitrd -o /boot/initrd.img-2.6.17.8

Make sure you set initrd to use cramfs and that you have enabled cramfs support 
in the kernel.

Now, copy your .config and System.map by

# cp /usr/src/linux-2.6.17.8/.config /boot/config-2.6.17.8
# cp /usr/src/linux-2.6.17.8/System.map /boot/System.map-2.6.17.8

Now it is time to add the entries for our kernel in /boot/grub/menu.lst

Add the following lines 


 title           Debian GNU/Linux, kernel 2.6.17.3 
 root            (hd0,1) # This line may differ if ur root partition is not 
/dev/hda2
 kernel          /boot/vmlinuz-2.6.17.3 root=/dev/hda2 ro 
 initrd          /boot/initrd.img-2.6.17.3
 savedefault
 boot


 Now, it is time to reboot into your flashy new kernel image!

 It is beyond the scope of this article to troubleshoot kernel boot problems. 
These days it is no longer a black art it once was. So just go ahead and have 
fun. Should have any trouble please don't hesitate to mail me.

 Now let us assume that you have a kernel with the module cxacru built in.
 Now we want to be able to load it every time the kernel boots. So for that we 
add the line
 cxacru 
to the  file /etc/modules. Now try rebooting and see if

#lsmod 

lists the module cxacru as being loaded.

Please remember that for the cxacru module to load properly and work properly 
it requires the kernel's usbatm framework to be compiled. This is present in 
all kernels above 2.6.10. The usbatm framework exports a generic USB ATM device 
to the userspace that can be used in various ways. 

If you have an academic interest to learn more about ATM support in the linux 
kernel take a look at http://linux-atm.sourceforge.net

Ok time to get back to business.

Now it is time to get to something interesting.  I mean even more interesting.

We have to now configure the linux "hotplug" interface to load the firmware 
into the modem. Normally the hotplug framework is inclded as part of most linux 
distros.

Time to configure the hotplug framework to load the firmware into the USB modem 
once it is plugged into the USB socket. 

Note that the USB architecture is fairly complex with multiple layers.
Fortunately we do not have to get into all that level of detail to get out 
modem working. 

All we have to do is create two files conexant.usermap and conexant under the 
directory /etc/hotplug/usb.

The content of the conexant.usermap file is just one line but very cryptic.

Here goes, all in one line.

conexant 0x0003 0x0572 0xcb00 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x000 
   00000

And in the file conexant , enter this.


#!/bin/sh

# Load bulk/interrupt transfer test firmware into
# various EZ-USB USB devices that will run it
#
# Assumes 2002_04_11 release of fxload (or later)

FIRMWARE=/usr/local/lib/firmware/cxacru-fw.bin

FLAGS="-t fx2"

LOADER=/sbin/fxload

# use "-s $A3LOAD" for firmware that goes into external RAM
A3LOAD=/usr/share/usb/a3load.hex
# missing firmware?
if [ ! -r $FIRMWARE ]; then
    if [ -x /usr/bin/logger ]; then
        /usr/bin/logger -t $0 "missing $FIRMWARE for $PRODUCT ??"
    fi
    exit 1
fi

# missing loader?
if [ ! -x $LOADER ]; then
    if [ -x /usr/bin/logger ]; then
        /usr/bin/logger -t $0 "missing $LOADER ??"
    fi
    exit 1
fi

if [ -x /usr/bin/logger ]; then
    /usr/bin/logger -t $0 "load $FIRMWARE for $PRODUCT to $DEVICE"
fi
$LOADER $FLAGS -I $FIRMWARE


Of course you should make this file executable with the command

#chmod +x conexant

Now it is time to do things that we missed. I am a little contrariwise, so 
kindly bear with me.

We need a program called fxload to load the firmware. On my Debian box,I just 
have to type,

# apt-get install fxload

Ok, now the next step is to actually extract the firmware corresponding to the 
modem from the Modem's Windoze driver CD. Insert the CDROM into your computer 
and type 
$ mount /cdrom
 or
# mount -t iso9660 /dev/cdrom /cdrom

 And then copy the file CnxEtU.sys from the CD to your hard disk and put it 
somewhere, say /tmp.

 So now, we still don't have the firmware yet. We have it in some other form. 
We have to convert it into the form that fxload understands.

 So we need another program called cxacru-fw which needs to be downloaded like 
we did before.

 $ cvs 
-d:pserver:anonymous@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:/cvsroot/accessrunner 
login 

 Type enter when prompted for password.


 $ cvs -z3 
-d:pserver:anonymous@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:/cvsroot/accessrunner co 
-P utils. After download you should have a directory with this contents.


 -rw-r--r--  1 girish girish    453 2005-02-07 02:15 README
 -rw-r--r--  1 girish girish  15145 2005-02-07 02:15 COPYING
 -rw-r--r--  1 girish girish     11 2005-02-21 15:15 Makefile
 -rw-r--r--  1 girish girish   6119 2005-02-22 22:36 cxacru-fw.c
 drwxr-xr-x  2 girish girish   4096 2006-08-04 09:07 CVS

 Now just type make. 

 You will have an executable called cxacru-fw created there. 

 Now we are all set to extract the firmware from the CnxEtU.sys file we copied 
to /tmp.

 So now go to the utils directory where you have the cxacru-fw program and type

 $./cxacru /tmp/CnxEtU.sys cxacru-fw.bin

 If God is happy with your deeds so far you will have the firmware safely 
stored in the file cxacru-fw.bin.

 Now it is time to copy this file to the location mentioned in the conexant 
file long ago. If you have been following my instructions to the dot , you will 
do fine by copying it to /usr/local/lib/firmware directory.

 At last I am done with the configuration required to get the modem working. 
That is, if all goes well now we have the modem communicating perfectly with 
the computer.
 
 To verify this , just reboot the computer. Or type this .

#/etc/init.d/hotplug start

 This should load the firmware into the modem and your modem LED should start 
blinking. Congrats! You are halfway thro'.

 Now, connect the telephone line to the other end and you should see the LED 
blink for a few seconds and glow constantly.

 This means that the ATM link has been established with the modem server.

 To check the status, you can use the /proc interface of your kernel. I am 
hoping you enabled that during your kernel build process. If not no harm as it 
is used only for diagnostic purposes.

 Do a cat /proc/net/atm/devices

 You should see a line corresponding to cxacru.

 Also cat /proc/net/atm/cxacru will give you more info too.

 If you need to know what is the bandwidth configured for the link, you can 
take a look at /var/log/messages by

# tail -f /var/log/messages

 Fine. So now you got your ATM connection established. Now it is time to 
connect to BSNL; oh sorry Airtel using this modem.

 But the title of the article is connecting to BSNL right? 

 So let us do that first. Later we will connect to Airtel also.

 For that now, we have to get the program br2648ctl . 

# apt-get install br2648ctl

 Once installed just run the command 

# br2648ctl -b -c 0 -a 0.35 

 for BSNL 

 and 

# br2648ctl -b -c 0 -a 1.32

 for Airtel. 

 Other than this and the userid/passwords,there is really no difference in 
connecting to BSNL or Airtel. 

If this command was successful it will create a virtual nas0 interface. You 
have to link it up with the command

# ifconfig nas0 up

Now, ifconfig should list nas0 as one of the network interfaces. 

Now, it is time to dial using PPPoE. But wait a minute. We have to configure 
pppoe first. This is something many of you will be familiar. But I will give 
you my config file just in case.

The file /etc/ppp/peers/conexant file contains this.

lcp-no-failure 3
noipdefault
defaultroute
user <your user id here>
noauth
noaccomp
nopcomp
noccp
novj
holdoff 4
persist
maxfail 25
updetach
usepeerdns
plugin /usr/lib/pppd/2.4.3/rp-pppoe.so
nas0

And create a /etc/ppp/pap-secrets and /etc/ppp/chap-secrets file with your
username and password in one line. For instance just create a line

girish * ash

for configuring user "girish" with password "ash". 

Make this file non readable for others with the command

# chmod 0400 /etc/ppp/chap-secrets /etc/ppp/pap-secrets

Now, BSNL uses CHAP and Airtel uses PAP auth. But you can easily figure these 
things out by calling them up if necessary.

Now, let us connect. Moment of truth is fast approaching!

# pppd call conexant

should connect you to the Internet! Wow! It is amazing, isn't it? To be able to 
connect to the Internet using an Airtel modem to BSNL network? 

Now, let us do some trick to ensure that we connect to the Internet everytime 
we boot seamlessly. 

Just edit the file /etc/network/interfaces under Debian and add these lines to 
the end.

auto pppoe
iface pppoe inet ppp
        pre-up br2648tl -b -c 0 -a 0.35 # for BSNL
        pre-up ifconfig up nas0
        provider conexant
        post-down kill $(cat /var/run/nas0.pid)


Now, since broadband connectivity doesnt count the hours or minutes that you 
stay connected and since there is no such thing as a virus or automatic 
downloader for linux, you can safely connect everytime you boot up and enjoy 
life. 

Now, one last tip. Since you will most likely do all these things on a 
different machine and if you want to set this up on a different PC too this is 
what you have to do. 

Just copy the kernel and the config files. The config files , you know of 
course. I will tell you how to copy your kernel to another machine. 

Just insert a USB flash drive and mount it. 

# mount /dev/sda1 /usb

# cd /usb
# cp /boot/*.2.6.17.8 . ( We are copying the kernel image, initrd , System.map 
and config files )

# tar zcf modules.tar.gz /lib/modules/2.6.17.8 

And we are set. 

Copy these files to ur friend's machine's /boot directory and /lib/modules 
directory. 

And of course don't forget to add the appropriate entries in 
/boot/grub/menu.lst file as I mentioned above. 

Boot into the new kernel and Enjoy!





Other related posts: