# [HOWTO] UMTS Huawei E169 HSDPA USB stick (E-Plus)

## Blubbmon

Here, I'll shortly describe how to make your Huawei E169 UMTS USB modem work. You may get this USB stick from the german providers E-Plus or Base.

This HOWTO has been tested on Linux kernel 2.6.24.

Plug the SIM card into your USB stick and connect it to your computer's USB port. 

```
$ lsusb

Bus 006 Device 001: ID 0000:0000  

Bus 004 Device 003: ID 12d1:1001 Huawei Technologies Co., Ltd. E620 USB Modem

Bus 004 Device 001: ID 0000:0000  

Bus 007 Device 001: ID 0000:0000  

Bus 005 Device 001: ID 0000:0000  

Bus 003 Device 002: ID 0483:2016 SGS Thomson Microelectronics Fingerprint Reader

Bus 003 Device 001: ID 0000:0000  

Bus 001 Device 001: ID 0000:0000  

Bus 002 Device 001: ID 0000:0000  

```

In the 3rd line the USB stick is recognized as an E620 Modem. The vendor ID is 0x12d1 and the product ID is 0x1001. This is a little bit different to the E220 model (vendor ID 0x12d1 and product ID 0x1003) which has been described here. 

Like for the E220 model I patched the airprime kernel module to recognize the modem correctly:

```
--- airprime.old.c      2008-05-03 14:58:38.000000000 +0200

+++ airprime.c  2008-05-03 14:58:29.000000000 +0200

@@ -18,6 +18,8 @@

 

 static struct usb_device_id id_table [] = {

        { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */

+  { USB_DEVICE(0x12d1, 0x1003) }, /* Huawei E220 */ 

+  { USB_DEVICE(0x12d1, 0x1001) }, /* Huawei E169 */ 

        { },

 };

 MODULE_DEVICE_TABLE(usb, id_table);

```

Now, disconnect your modem from the USB port. 

First, you have to add the module in your kernel configuration and compile it:

```
$ cd /usr/src/linux

$ make menuconfig

Device Drivers  --->

 USB support  --->

  USB Serial Converter support  --->

   <M> USB Serial Converter support

    [*]   USB Generic Serial Driver

    <M>   USB AirPrime CDMA Wireless Driver 

```

Save the new kernel configuration, built and install the module(s).

```
$ make drivers/usb/serial/airprime.ko

$ make modules_install

```

Plug in the modem and check whether the airprime module is loaded correctly:

```
$ dmesg

...

usb 4-1: new full speed USB device using uhci_hcd and address 6

usb 4-1: configuration #1 chosen from 1 choice

scsi7 : SCSI emulation for USB Mass Storage devices

usb-storage: device found at 6

usb-storage: waiting for device to settle before scanning

usbcore: registered new interface driver usbserial

drivers/usb/serial/usb-serial.c: USB Serial support registered for generic

usbcore: registered new interface driver usbserial_generic

drivers/usb/serial/usb-serial.c: USB Serial Driver core

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

usbcore: registered new interface driver option

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

drivers/usb/serial/usb-serial.c: USB Serial support registered for airprime

usbcore: registered new interface driver airprime

scsi 7:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2

sr0: scsi-1 drive

sr 7:0:0:0: Attached scsi CD-ROM sr0

sr 7:0:0:0: Attached scsi generic sg1 type 5

usb-storage: device scan complete

```

Note: The USB stick has an integrated memory card reader. Therefore, the kernel loads the usb-storage module as well.

At this point your kernel may already have created /dev/ttyUSB0. If not, you may use the following program to do this for you:

(The program has been written by Miroslav Bobovsky: http://www.kanoistika.sk/bobovsky/archiv/umts/huaweiAktBbo.c. The product ID has been modified for the E169 modem.)

```
/* HUAWEI E220 3G HSDPA modem - Aktivator modemu = aktivuje ttyUSB0 tty USB1 

   bobovsky 11.12.2006

   dalej sa uz pouzije usbserial a usb-storage

   cc huaweiAktBbo.c -lusb  (resp -I. -L.)

   armeb-linux-gcc huaweiAktBbo.c -L. -I. -lusb

   Copyright (C) 2006 bobovsky bobovsky@kanoistika.sk  GPL 

   This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License2.

*/

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <assert.h>

#include <signal.h>

#include <ctype.h>

#include <usb.h>

#if 0

 #include <linux/usbdevice_fs.h>

 #define LIBUSB_AUGMENT

 #include "libusb_augment.h"

#endif

struct usb_dev_handle *devh;

void release_usb_device(int dummy) {

  int ret;

  ret = usb_release_interface(devh, 0);

  if (!ret)

    printf("failed to release interface: %d\n", ret);

  usb_close(devh);

  if (!ret)

    printf("failed to close interface: %d\n", ret);

  exit(1);

}

void list_devices() {

  struct usb_bus *bus;

  for (bus = usb_get_busses(); bus; bus = bus->next) {

    struct usb_device *dev;

    for (dev = bus->devices; dev; dev = dev->next)

      printf("0x%04x 0x%04x\n",

          dev->descriptor.idVendor,

          dev->descriptor.idProduct);

  }

}

struct usb_device *find_device(int vendor, int product) {

  struct usb_bus *bus;

  for (bus = usb_get_busses(); bus; bus = bus->next) {

    struct usb_device *dev;

    for (dev = bus->devices; dev; dev = dev->next) {

      if (dev->descriptor.idVendor == vendor

          && dev->descriptor.idProduct == product)

        return dev;

    }

  }

  return NULL;

}

void print_bytes(char *bytes, int len) {

  int i;

  if (len > 0) {

    for (i=0; i<len; i++) {

      printf("%02x ", (int)((unsigned char)bytes[i]));

    }

    printf("\"");

    for (i=0; i<len; i++) {

      printf("%c", isprint(bytes[i]) ? bytes[i] : '.');

    }

    printf("\"");

  }

}

int main(int argc, char **argv) {

  int ret, vendor, product;

  struct usb_device *dev;

  char buf[65535];

#if 0

  usb_urb *isourb;

  struct timeval isotv;

  char isobuf[32768];

#endif

  usb_init();

  usb_find_busses();

  usb_find_devices();

  printf("HUAWEI E169 - setting into modem mode.\n");

  vendor = 0x12d1;

  product = 0x1001;

  dev = find_device(vendor, product);

  assert(dev);

  devh = usb_open(dev);

  assert(devh);

  signal(SIGTERM, release_usb_device);

  // BBO typ 1 = DEVICE

  ret = usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012);

  usleep(1*1000);

  // BBO typ 2 = CONFIGURATION

  ret = usb_get_descriptor(devh, 0x0000002, 0x0000000, buf, 0x0000009);

  usleep(1*1000);

  // BBO typ 2 = CONFIGURATION

  ret = usb_get_descriptor(devh, 0x0000002, 0x0000000, buf, 0x0000020);

  usleep(1*1000);

  ret = usb_control_msg(devh, USB_TYPE_STANDARD + USB_RECIP_DEVICE, USB_REQ_SET_FEATURE, 00000001, 0, buf, 0, 1000);

  printf("4 set feature request returned %d\n", ret);

  ret = usb_close(devh);

  assert(ret == 0);

  printf("Prepnute-OK, Mas ttyUSB0 ttyUSB1 (cez usbserial vendor=0x12d1 product=0x1001)\n");

  printf("pozri /proc/bus/usb/devices\n");

  return 0;

}

```

Save this code in a file, e.g. huawei.c, compile and run it as root:

```
$ gcc -O2 -Wall -lusb huawei.c -o huawei

$ ./huawei

```

This should at least create the device /dev/ttyUSB0.

Now you can start configuring PPP to handle the connection to your ISP.

I use the following peer script in /etc/ppp/peers/umts:

```
 hide-password 

noauth

connect "/usr/sbin/chat -v -f /etc/ppp/chat/umts"

debug

/dev/ttyUSB0

460800

defaultroute

noipdefault 

user "eplus"

mtu 1500

mru 1500

idle 300

nobsdcomp

noccp

ipcp-accept-local

ipcp-accept-remote

noipdefault

novj

novjccomp 

nomagic

usepeerdns

```

The corresponding chat script /etc/ppp/chat/umts looks like this:

```
ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE' ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT DELAYED

# modeminit

'' ATZ

TIMEOUT 5

OK AT+CPIN? READY-AT+CPIN=XXXX-OK ""

TIMEOUT 20

'' 'AT+cgdcont=1,"IP","internet.eplus.de"' OK "ATDT*99#"

# ispconnect

CONNECT \d\c

```

Replace XXXX by the PIN of your UMTS SIM card.

In the file /etc/ppp/chap-secrets I added a line for the user "eplus":

```
# Secrets for authentication using CHAP

# client        server  secret                  IP addresses

eplus         *         eplus

```

You can choose an arbitraty password as the authentication is performed on information from your SIM card.

Finally, you can test your setup by connecting via UMTS by

```
$ pppd file /etc/ppp/peers/umts debug nodetach

Serial connection established.

using channel 3

Using interface ppp0

Connect: ppp0 <--> /dev/ttyUSB0

sent [LCP ConfReq id=0x1 <asyncmap 0x0> <pcomp> <accomp>]

rcvd [LCP ConfReq id=0x0 <asyncmap 0x0> <auth chap MD5> <magic 0xf31ff8> <pcomp> <accomp>]

sent [LCP ConfRej id=0x0 <magic 0xf31ff8>]

rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <pcomp> <accomp>]

rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <auth chap MD5> <pcomp> <accomp>]

sent [LCP ConfAck id=0x1 <asyncmap 0x0> <auth chap MD5> <pcomp> <accomp>]

rcvd [LCP DiscReq id=0x2 magic=0xf31ff8]

...

rcvd [CHAP Success id=0x2 ""]

CHAP authentication succeeded

CHAP authentication succeeded

sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]

rcvd [IPCP ConfNak id=0x1 <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]

sent [IPCP ConfReq id=0x2 <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14>]

rcvd [IPCP ConfReq id=0x0]

sent [IPCP ConfNak id=0x0 <addr 0.0.0.0>]

rcvd [IPCP ConfNak id=0x2 <addr 10.161.57.155> <ms-dns1 212.23.97.2> <ms-dns3 212.23.97.3>]

sent [IPCP ConfReq id=0x3 <addr 10.161.57.155> <ms-dns1 212.23.97.2> <ms-dns3 212.23.97.3>]

rcvd [IPCP ConfReq id=0x1]

sent [IPCP ConfAck id=0x1]

rcvd [IPCP ConfAck id=0x3 <addr 10.161.57.155> <ms-dns1 212.23.97.2> <ms-dns3 212.23.97.3>]

Could not determine remote IP address: defaulting to 10.64.64.64

not replacing existing default route to wlan0 [192.168.1.1]

local  IP address 10.161.57.155

remote IP address 10.64.64.64

primary   DNS address 212.23.97.2

secondary DNS address 212.23.97.3

Script /etc/ppp/ip-up started (pid 2531)

Script /etc/ppp/ip-up finished (pid 2531), status = 0x0

```

I still don't know how to tell ?udev? to create the device /dev/ttyUSB0 automatically each time I plug in the modem ... but at least it works after running the program mentioned above  :Smile: 

----------

## fumoffu

I'd like to thank you a lot for this guide. After trying for several hours my card is finally working. I'm on 2.6.25 and i use the "option" module instead of airprime. Using this, I just need to plug in my card, the module gets loaded and /dev/ttyUSB0 gets created automatically. No more need for the self-compield "huawei"-tool either.

I tried using umtsmon 0.9, but it always fails to build up a ppp connection. I finally got ppp to work by using your config files. Thanks again  :Smile: 

----------

## Slalomsk8er

Thank you for this nice guide.

 After I recompiled my Kernel with the option driver and the ppp options that the ppp ebuild requested, I got my Sunrise T@KE AWAY PREPAID working on Gentoo.

The last thing to do is automating the connection.

Thanks again

----------

## Tae_kyon

I have a new install of gentoo on an HP laptop and I tried to get my Huawei E620 to connect to the internet by using your method, did a copy and paste of the relevant files and edited them as appropriate.

The laptop recognizes the device and creates  /dev/ttyUSB0

When I debug the script the modem is unlocked (so it reads the PIN correctly) but in the end I get ... "Connect script failed".

Any hints as to how to debug this?

----------

## Blubbmon

 *Quote:*   

> "Connect script failed"

 

Sometimes, this happens here as well. I just <Ctrl>+C and retry after some seconds (this works for me).

Did you had a look in your /var/log/messages? Do you see any reason reported by the PPP process there?

----------

## Tae_kyon

OK, I now reach the point where it says "CHAP authentication succeeded".

It says that twice, then hangs up.

 :Sad: 

----------

## Blubbmon

As you may have seen in the log of my 1st posting, I get this authentication output twice as well.

Maybe you could try to change the various timeout parameters of pppd (and chat). I had a similar issue with a satellite modem. In the end (after two days of frustration), I found the timeout configuration parameter in the source of pppd, which I missed it in the manpage before. It was the "connect-delay" parameter in my case.

HTH.

----------

## Tae_kyon

... everything seems to work, but I still can't set up a connection with gentoo. I've tried using ppp pon script, wvdial, umtsmon ... here is the output of umtsmon with maximum verbosity:

*****output of PPP to stdout                                                                                                                              

##P4 t=520: * pppd options in effect:                                                                                                                                 

##P4 t=520: * debug debug debug         # (from command line)                                                                                                         

##P4 t=520: * updetach          # (from command line)                                                                                                                 

##P4 t=520: * idle 7200         # (from command line)                                                                                                                 

##P4 t=520: * dump              # (from command line)                                                                                                                 

##P4 t=520: * user clic         # (from command line)                                                                                                                 

##P4 t=520: * password ??????           # (from command line)                                                                                                         

##P4 t=520: * /dev/ttyUSB0              # (from command line)                                                                                                         

##P4 t=520: * 460800            # (from command line)                                                                                                                 

##P4 t=520: * lock              # (from command line)                                                                                                                 

##P4 t=520: * crtscts           # (from command line)                                                                                                                 

##P4 t=520: * modem             # (from command line)                                                                                                                 

##P4 t=520: * asyncmap 0                # (from command line)                                                                                                         

##P4 t=520: * novj              # (from command line)                                                                                                                 

##P4 t=520: * noipx             # (from command line)                                                                                                                 

##P4 t=520: * using channel 6                                                                                                                                         

##P4 t=520: * Using interface ppp0                                                                                                                                    

##P4 t=520: * Connect: ppp0 <--> /dev/ttyUSB0                                                                                                                         

##P4 t=520: * sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xc9b19fbb> <pcomp> <accomp>]                                                                            

##P4 t=520: * rcvd [LCP ConfReq id=0xc <asyncmap 0x0> <auth chap MD5> <magic 0x10236f9> <pcomp> <accomp>]                                                             

##P4 t=520: * sent [LCP ConfAck id=0xc <asyncmap 0x0> <auth chap MD5> <magic 0x10236f9> <pcomp> <accomp>]                                                             

##P4 t=520: * rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xc9b19fbb> <pcomp> <accomp>]                                                                            

##P4 t=520: * rcvd [LCP DiscReq id=0xd magic=0x10236f9]                                                                                                               

##P4 t=520: * rcvd [CHAP Challenge id=0x1 <2437d0349237d451367c8c43dedf2ebc>, name = "UMTS_CHAP_SRVR"]                                                                

##P4 t=520: * sent [CHAP Response id=0x1 <befbc2864d8f3bca9e1abf8df74f0060>, name = "clic"]                                                                           

##P4 t=520: * rcvd [CHAP Challenge id=0x2 <56c86ba9fedc2de3361c08d8068c74fc>, name = "UMTS_CHAP_SRVR"]                                                                

##P4 t=520: * sent [CHAP Response id=0x2 <e00e6b61da06dad6663033c6f047f749>, name = "clic"]                                                                           

##P4 t=520: * rcvd [CHAP Success id=0x2 ""]                                                                                                                           

##P4 t=520: * CHAP authentication succeeded                                                                                                                           

##P4 t=520: * CHAP authentication succeeded                                                                                                                           

##P4 t=520: * sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]                                                                                   

##P4 t=520: * sent [IPCP ConfReq id=0x1 <addr 0.0.0.0>]                                                                                                               

##P4 t=520: * rcvd [LCP ProtRej id=0xe 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15 03 2f]                                                                            

##P4 t=520: * Protocol-Reject for 'Compression Control Protocol' (0x80fd) received                                                                                    

##P4 t=520: * Hangup (SIGHUP)                                                                                                                                         

##P4 t=520: * Modem hangup                                                                                                                                            

##P4 t=520: * Connection terminated.     

##P4 t=520: *****end-of-output                                                                                                                                        

##P4 t=520: *****output of PPP to stderr                                                                                                                              

##P4 t=520: *****end-of-output             

OK, so I KNOW my provider doesn't allow bsd compression. I must deactivate it. So I added the option noBsdComp=true to umtsmon configuration.

Output changes only in that I still get the "Protocol-Reject" line, but it is followed by another 2 lines before hangup:

##P4 t=972: * rcvd [IPCP ConfNak id=0x1 <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]                                      

##P4 t=972: * sent [IPCP ConfReq id=0x2 <addr 0.0.0.0>]    

Same thing happens with tweaking ppp script. And connect-delay parameter doesn't help either. So? HELP !!!

----------

## Slalomsk8er

After redoing my pppd configuration I remembered this thread and wanted to share my results with you.

I got my Huawei E169 UMTS USB stick from a Sunrise T@KE AWAY PREPAID deal and like prepaid deals are the money on the card is evaporated at some point.

I was on a train at the time I found out about this lack of credit associated with my SIM and remembered that my regular mobile phone contract has a free monthly data option included.

So what would be easier then to use the SIM from m phone and changing the pppd configuration? Well you guessed right, at the time I left the train it was still not working.

I classified this problem under things to do and now finally got to scratch that itch.

One thing to remember is to check that the device is not SIM locked like mine was. I spend some time testing with different configurations till I realized that the the problem was not the pppd configuration but the SIM lock.

After unlocking the E169 and going trough some of the different configurations I created earlier I suddenly had a connection to the Internet over the Swisscom mobile network.

The following two configurations are of most utility to swiss residents as the ".ch" indicates in the chat scripts.

/etc/ppp/peers/swisscom

```
hide-password

noauth

connect "/usr/sbin/chat -v -f /etc/ppp/chat/umts-swisscom"

/dev/ttyUSB0

460800

defaultroute

noipdefault

user "swisscom"

mtu 1500

mru 1500

idle 300

nobsdcomp

noccp

ipcp-accept-local

ipcp-accept-remote

noipdefault

novj

novjccomp

nomagic

usepeerdns

#debug

#nodetach

```

/etc/ppp/chat/umts-swisscom

```
ABORT BUSY

ABORT 'NO CARRIER'

ABORT ERROR

REPORT CONNECT

TIMEOUT 120

"" "AT&F"

OK "ATZ"

OK "ATQ0 V1 E1 S0=0 &C1 &D2"

# enter pin below if needed

OK AT+CPIN? READY-AT+CPIN=1234-OK ""

OK 'AT+CGDCONT=1,"IP","gprs.swisscom.ch"'

SAY "Calling Swisscom"

OK "ATDT*99***1#"

TIMEOUT 120

CONNECT ''

```

Command used to connect to the service:

```
# pppd call swisscom
```

/etc/ppp/peers/sunrise

```
hide-password

noauth

connect "/usr/sbin/chat -v -f /etc/ppp/chat/umts-sunrise"

/dev/ttyUSB0

460800

defaultroute

noipdefault

user "sunrise"

mtu 1500

mru 1500

idle 300

nobsdcomp

noccp

ipcp-accept-local

ipcp-accept-remote

noipdefault

novj

novjccomp

nomagic

usepeerdns

#debug

#nodetach

```

/etc/ppp/chat/umts-sunrise

```
ABORT BUSY

ABORT VOICE

ABORT DELAYED

ABORT ERROR

ABORT 'NO CARRIER'

ABORT 'NO DIALTONE'

ABORT 'NO DIAL TONE'

ABORT 'NO ANSWER'

REPORT CONNECT

# modeminit

'' ATZ

TIMEOUT 5

# enter pin below if needed

OK AT+CPIN? READY-AT+CPIN=1234-OK ""

TIMEOUT 20

'' 'AT+cgdcont=1,"IP","internet.sunrise.ch"' OK "ATDT*99#"

# ispconnect

CONNECT \d\c

```

Command used to connect to the service:

```
# pppd call sunrise
```

I hope this will be useful for some one besides me for reference.

----------

## Pearlseattle

Hi

One more installation variant - for a Huawei E1552/E1762:

http://www.blah-blah.ch/Mra/HuaweiUmts

Hope it's useful   :Very Happy: 

----------

## NeddySeagoon

Moved from Networking & Security to Documentation, Tips & Tricks.

This thread should have been here a long time ago.

----------

