# Huawei E220 and wvdial [SOLVED]

## rudi_aber

Having got mixed messages here and elsewhere about how to set up a Huawei E220 USB mobile phone modem, I thought I give a quick report of how I got mine to run.  I bought mine from Vodafone UK, who market it as "Vodafone 3G USB modem".  It works out of the box under WinXP.

I recently installed a new laptop (Advent 7203) with

```
13:13 rudi@(none):~ > uname -a

Linux (none) 2.6.22-gentoo-r5 #21 SMP Sun Sep 30 12:58:08 BST 2007 i686 Intel(R) Core(TM)2 CPU T5300 @ 1.73GHz GenuineIntel GNU/Linux
```

Following earlier posts here, I enabled in make menuconfig:

```

  | |                      Device Drivers  --->

  | |                           Network device support  --->

  | |              <*>            PPP (point-to-point protocol) support  

  | |              <*>            PPP support for async serial ports  

  | |                           USB support  ---> 

  | |              <M>          USB Mass Storage support 

  | |                               USB Serial Converter support  ---> 

  | |              <M>               USB Serial Converter support 

  | |              <M>   USB driver for GSM and CDMA modems 

```

After compiling this kernel

```

make clean && make && make modules_install

```

and rebooting with the Huawei plugged in, I get

```

13:58 rudi@(none):~ > dmesg | grep GSM

drivers/usb/serial/usb-serial.c: USB Serial support registered for GSM modem (1-port)

option 4-1:1.0: GSM modem (1-port) converter detected

usb 4-1: GSM modem (1-port) converter now attached to ttyUSB0

option 4-1:1.1: GSM modem (1-port) converter detected

usb 4-1: GSM modem (1-port) converter now attached to ttyUSB1

option 4-1:1.2: GSM modem (1-port) converter detected

usb 4-1: GSM modem (1-port) converter now attached to ttyUSB2

drivers/usb/serial/option.c: USB Driver for GSM modems: v0.7.1

```

and can see the modem sitting on its serial port(s):

```

13:59 rudi@(none):~ > ll /dev/*USB*

crw-rw---- 1 root uucp 188, 0 Sep 30 13:23 /dev/ttyUSB0

crw-rw---- 1 root uucp 188, 1 Sep 30 13:08 /dev/ttyUSB1

crw-rw---- 1 root uucp 188, 2 Sep 30 13:08 /dev/ttyUSB2

```

.

So much for the hardware side of it.  To operate the modem, I've emerged wvdial and then run wvdialconf.  This produces a configuration file

```

14:00 rudi@(none):~ > cat /etc/wvdial.conf 

[Dialer Defaults]

Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0

Modem Type = Analog Modem

; Phone = <Target phone number>

ISDN = 0

; Username = <Your user name>

Init1 = ATZ

; Password = <Your password>

Modem = /dev/ttyUSB0

Baud = 460800

```

,

in which the Phone, Username and Password lines need to be uncommented (remove the ';' at the start of those lines) and the dummy values need replacing with real ones.  Unless this is done, wvdial fails complaining that no valid phone number, username or password is specified.

Now Vodafone didn't provide me with any of those three pieces of information.  However, I found the phone number under WinXP in Start -> Control Panel -> Network Connections -> Dial-up: VMCLite (that may be called differently if your Huawei isn't from Vodafone) -> Properties -> General: Phone number.  It doesn't really look like a phone number (what with asterisks and hash marks in it) but typing that "number" into wvdial.conf's does work.  The username and password can be anything other than empty; I don't think it's actually used, but wvdial complains if they're not set.

When wvdial is started from a terminal, it says

```

14:10 rudi@(none):~ > wvdial

WvDial<*1>: WvDial: Internet dialer version 1.56

WvDial<*1>: Initializing modem.

WvDial<*1>: Sending: ATZ

WvDial Modem<*1>: ATZ

WvDial Modem<*1>: OK

WvDial<*1>: Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0

WvDial Modem<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0

WvDial Modem<*1>: OK

WvDial<*1>: Modem initialized.

WvDial<*1>: Sending: ATDT<Phone number from wvdial.conf>

WvDial<*1>: Waiting for carrier.

WvDial Modem<*1>: ATDT<Phone number from wvdial.conf>

WvDial Modem<*1>: CONNECT

WvDial<*1>: Carrier detected.  Waiting for prompt.

```

...and continues after a few nerve-wrecking seconds...

```

WvDial<Notice>: Don't know what to do!  Starting pppd and hoping for the best.

WvDial<Notice>: Starting pppd at Sun Sep 30 14:11:07 2007

WvDial<Err>: Warning: Could not modify /etc/ppp/pap-secrets: Permission denied

WvDial<Err>: --> PAP (Password Authentication Protocol) may be flaky.

WvDial<Err>: Warning: Could not modify /etc/ppp/chap-secrets: Permission denied

WvDial<Err>: --> CHAP (Challenge Handshake) may be flaky.

WvDial<Notice>: Pid of pppd: 22702

WvDial<*1>: Using interface ppp0

WvDial<*1>: pppd: 0[06][08]

WvDial<*1>: pppd: 0[06][08]

WvDial<*1>: pppd: 0[06][08]

WvDial<*1>: local  IP address 10.182.224.68

WvDial<*1>: pppd: 0[06][08]

WvDial<*1>: remote IP address 10.64.64.64

WvDial<*1>: pppd: 0[06][08]

WvDial<*1>: primary   DNS address 10.203.129.68

WvDial<*1>: pppd: 0[06][08]

WvDial<*1>: secondary DNS address 10.203.129.68

WvDial<*1>: pppd: 0[06][08]

```

until it's Ctrl-C'ed, which makes it quit like this:

```

Caught signal 2:  Attempting to exit gracefully...

WvDial<*1>: Terminating on signal 15

WvDial<*1>: pppd: 0[06][08]

WvDial<*1>: Connect time 0.3 minutes.

WvDial<*1>: pppd: 0[06][08]

WvDial<*1>: pppd: 0[06][08]

WvDial<*1>: pppd: 0[06][08]

WvDial<*1>: Disconnecting at Sun Sep 30 14:11:28 2007

```

Shutting down wvdial and re-starting it works fine, even if the modem is unplugged in between.  It's not particularly fast, but it isn't any slower than under WinXP.  Vodafone are a bit generous on themselves with their coverage map methinks.

So there we are: A n00b can install a Huawei modem.  Lovely.

Now, here's my question for the experts:

How can I measure the rate at which data are received and the total amount downloaded over a period?

----------

