Friday, August 11, 2006

Huawei EC321 (cdma) on linux

So what do you do after two days of non-sleep and a 5 hour party? You try to make your recently acquired gadget to work on linux :) I wish I was kidding!

It all started due to a cow orker "borrowing" the team laptop and somehow loading it upto the brim with spyware And Gopal trying to browse on it. within 12 minutes we were booting linux.

I had just procured a Tata Indicom cdma data card as replacement for my now broken reliance cdma card. Since the reliance junk would never work on linux. I was rubbing my hands in anticipation on my way back home.

Out with the reasons and on to the quest.

After a few Google queries we ran into a few helpful Chinese characters. Even though we couldn't read any chinese ... the commands were all in plain old ASCII.

So, if you do a

$cat /proc/bus/usb/devices
$sudo modprobe usbserial vendor=0x12d1 product=0x1001

you should be able to see /dev/ttyUSB0 /dev/ttyUSB1. If you're not using udev. you can

#mknod /dev/ttyUSB0 c 188 0
#mknod /dev/ttyUSB1 c 188 1

Congratulations, you are now the proud configurer of a modem. And, it's time to pull an old cat out of the bag. wvdial :)

cat > /etc/wvdial.conf
[Modem0]
Modem = /dev/ttyUSB0
Baud = 115200
SetVolume = 0
Dial Command = ATDT
Init1 = ATZ
FlowControl = Hardware (CRTSCTS)

[Dialer cdma]
Username = username
Password = *******
Phone = #777
Stupid Mode = 1
Inherits = Modem0

And then do a wvdial cdma and say hello to Intraweb 2,0TM

But we didnt just stop there, Mr Gopal is too lazy to type modprobe everytime he boots the comp, and so should be you. :D

So, As a little gift to our chinese fellows we give you a set of hotplug scripts.
 
cat > /etc/hotplug/usb/datacard.usermap
# Huawei EC321 CDMA data card
datacard 0x0003 0x12d1 0x1001 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000

The first three numbers are important here, if you noticed when we did a cat /proc/bus/usb/devices | grep -a2 -b1 Huawei it looked like,

1565-P: Vendor=12d1 ProdID=1001 Rev= 0.00
1603:S: Manufacturer=Huawei Technologies
1643:S: Product=Huawei Mobile
1686-S: SerialNumber=HUAWEI EC3X1

0x12d1 and 0x1001 is just the vendor and device identifier (duh!), So much for the linux is difficult. We just like to make it look confusing :D notice the useless 0x0000 padding that follows, reserved for future use and confusing all present grey matter.

Now that we have found the device we should be able to hotplug it. the script below should do just fine.
 
cat > /etc/hotplug/usb/datacard
#!/bin/bash
SED=/bin/sed

#/usr/bin/env > /tmp/datacard.log

if [ "$ACTION" = "add" ] && [ -f "$DEVICE" ]
then
VENDOR="`echo "$PRODUCT" | $SED "s/^\(.*\)\/.*\/.*$/\1/"`";
PRODUCT_ID="`echo "$PRODUCT" | $SED "s/^.*\/\(.*\)\/.*$/\1/"`";
modprobe usbserial "vendor=0x$VENDOR" "product=0x$PRODUCT_ID"
fi

Make sure you do a chmod +x /etc/hotplug/usb/datacard .

The above script is simply finding out the same vendor and device ID automagically ;) and doing a modprobe with it.

At this point you should stop your wvdial, proudly take out the card, push it back in and just do a wvdial again.

It should Just WorkTM.

27 comments:

Apurva said...

You are an absolute life saver! I am new to linux and just installed ubuntu... the only thing stopping me to actively use linux over my windows partition was that i needed my vdata card (huawei) to connect to the Internet. Thanks so much for this.

However the hotplug thing doesnt work! when i try to cat > /etc/hotplug/usb/datacard.usermap i get:

cat > /etc/hotplug/usb/datacard.usermap

can u please help?

spo0nman said...

Hello apurva,

cat > /etc/hotplug/usb/datacard.usermap
# Huawei EC321 CDMA data card
datacard 0x0003 0x12d1 0x1001 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000

The above commnd simply creates a file called /etc/hotplug/usb/datacard.usermap and put's the second and third line in it.

you can open a terminal and go to /etc/hotplug/usb/ and do sudo gedit datacard.usermap .

and in this file just copy paste the following line and save.

# Huawei EC321 CDMA data card
datacard 0x0003 0x12d1 0x1001 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000


That should do it.

Anonymous said...

card is detected......
but its saying PPP daemon died with exit code 19, i.e. PAP authentication failed

I am using fedora4.

The same card is working on windows XP.

Sandeep said...

Hi,
I am been digging on the net from last few month, i have got the EC321 data card, when i observ in the Hardware browser when i insert the card it gets detected and shows up there, but when i follow the procedure given on the page the i am not able to connect to the internet, i am using Fedora Core 4 Can you please explain me in details what is that issue
if possible for you please can you have a chat with me
san_20july for yahoo
All the search and all the links on the web point the same page but i am not able to get what needs to be done please help me out.

spo0nman said...

Sandeep:

Two questions, What all did you do follow from the post? and what happens? If you can explain step by step with error messages, I could help you.

Also, if you uncomment this line(by removing the hash'#'):
#/usr/bin/env > /tmp/datacard.log

/tmp/datacard.log could tell you whats going on.

Sandeep said...

Thanks for your quick response i will check with what you have said and will let you know what are the result,
i just want to confirm from you that is it really possible to configure this card on fedora core 4
if yes that would be very great, i really love linux very much but cant use it becouse of internet access restriction.

Anonymous said...

We managed to get the vdata card work out of the bod on Ubuntu, and wvdial does the dialing and establishes connection. I think the next step in hacking is to develop a small utility to call other phones using this card. next step, to send sms etc. any clues on how to hack this?

--
GN

Ashok said...

I guess I suffer from a different problem . I work on Suse 9.0 linux on an Acer aspire 5000. After reading all your mails, I went for this Vdata card. While it behaves well on windows, linux is different. My entire system hangs up once I insert the card (if I insert and boot it, it refuses go past the step where it detects pci and hotplugs. Any idea what is happening. At one time, I got a message in super user window as

msg from syslogd
kernel panic: pci_map_single: high address but no IOMMU.

I will be thankful for any help

Ashok

Anonymous said...

It worked perfectly for my ubuntu 6.06. The only problem is that in the first time it is to be activated from a windows machine. My case vendor activated it for me. Is there any way in GNU/Linux to activate this card?

BTW i got EC321 from reliance.

Anonymous said...

But, How can I make calls using Huweai as I can do in windows?

Anonymous said...

Hey man Its perfect working with me on Deb machine.
speed is excellent too.
Cheers!

Vikas Jayna said...

I am using Fedora 4 and I've tried all the steps mentioned above but still when I run wvdial I get:

--> WvDial: Internet dialer version 1.54.0
--> Warning: section [Dialer Defaults] does not exist in wvdial.conf.
--> Initializing modem.
--> Sending: ATZ
--> Sending: ATQ0
--> Re-Sending: ATZ
--> Modem not responding.

Vishram said...

Hello Folks,

I need to use a Reliance CDMA broadband data connection with an embedded Linux COmputer (MOXA UC-7420-LC).

This is for a mobile application.

This has both a PCMCIA slot, USA abd serial ports. Please let me know if any of these tweaks will work there.

_VG Bapat

Abhinav Gupta said...

Nice... It's helping half of the people in your office... :D

Tanuj said...

Ubuntu is mad...never heard of a vdata card!!!

Anonymous said...

can any one help me on how to send sms in huawei ec321 in linux

Warren said...

Reliance now ships the EC321 Card too.

madondo said...

how about the Huawei ETS2288 or Huawei ETS1201 on Linux. Has anybody managed to use these fixed wireless terminals (not data cards) on Linux?????
Please assist......

Sarfaraz said...

Hi
I have just installed Xubuntu 7.10.
I dont have "devices" files under "/proc/bus/usb"

Can you plzz help me.

Anonymous said...

Great tutorial. Works cleanly on my Ubuntu box.

Thanks a gig.

Anonymous said...

Hi,
Thanks to the info posted here, I could start my Reliance Data Card. I am using FC4. I get the following output when I run wdial cdma. But still I am unable to browse the net.
Output of wdial cdma:
WvDial: Internet dialer version 1.54.0
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT 230400
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Thu Jun 5 17:01:05 2008
--> pid of pppd: 3328
--> Using interface ppp0
--> local IP address 123.239.179.211
--> remote IP address 220.224.134.78
--> primary DNS address 202.138.97.193
--> secondary DNS address 202.138.96.2

Kindly guide ASAP.
Thanks

Anonymous said...

hi.
first thing. i got confidence that my ec321 will work in my linux. i followed all your steps. but it is failing with an bad password error. my data card is given by employer which simply works in windows. no password is given to me. i just copied the password from the SysConfig.dat file from the Windows installation. What should i do now? is there any work around? pl get back asap. you can even ping me lamp19 at gmail com .... its kinda very urgent.

thanks for the nice article.

Anonymous said...

I am using UBUNTU 8.10 ,TATA Huawei EC321...
I am getting error like this can u help me regarding this ....
--> WvDial: Internet dialer version 1.60
--> Warning: section [Dialer Defaults] does not exist in wvdial.conf.
--> Cannot open /dev/modem: No such file or directory
--> Cannot open /dev/modem: No such file or directory
--> Cannot open /dev/modem: No such file or directory

Anonymous said...

Hi,
Thanks to the info posted here, I could start my Reliance Data Card. I am using FC4. I get the following output when I run wdial cdma. But still I am unable to browse the net.
Output of wdial cdma:
WvDial: Internet dialer version 1.54.0
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT 230400
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Thu Jun 5 17:01:05 2008
--> pid of pppd: 3328
--> Using interface ppp0
--> local IP address 123.239.179.211
--> remote IP address 220.224.134.78
--> primary DNS address 202.138.97.193
--> secondary DNS address 202.138.96.2

Kindly guide ASAP.
Thanks

Dip said...

Hi,
Thanks to the info posted here, I could start my Reliance Data Card. I am using FC4. I get the following output when I run wdial cdma. But still I am unable to browse the net.
Output of wdial cdma:
WvDial: Internet dialer version 1.54.0
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT 230400
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Thu Jun 5 17:01:05 2008
--> pid of pppd: 3328
--> Using interface ppp0
--> local IP address 123.239.179.211
--> remote IP address 220.224.134.78
--> primary DNS address 202.138.97.193
--> secondary DNS address 202.138.96.2

Kindly guide ASAP.
Thanks

khan said...

Hi,
Iam trying to connect ZTE-AC2726 to fedora(Kernel image is 2.6.25-14.fc9.i686).

When did WvDial cdma,getting an error
> WvDial: Internet dialer version 1.60
>Cannot open /dev/ttyUSB0

Adi said...

Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa pages. Thank you So much.
Oes Tsetnoc | Semangat Mengembalikan Jati Diri Bangsa