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.
Code: Select all
$ 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
Like for the E220 model I patched the airprime kernel module to recognize the modem correctly:
Code: Select all
--- 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);
First, you have to add the module in your kernel configuration and compile it:
Code: Select all
$ 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
Code: Select all
$ make drivers/usb/serial/airprime.ko
$ make modules_install
Code: Select all
$ 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
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/archi ... eiAktBbo.c. The product ID has been modified for the E169 modem.)
Code: Select all
/* 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;
}
Code: Select all
$ gcc -O2 -Wall -lusb huawei.c -o huawei
$ ./huawei
Now you can start configuring PPP to handle the connection to your ISP.
I use the following peer script in /etc/ppp/peers/umts:
Code: Select all
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
Code: Select all
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
In the file /etc/ppp/chap-secrets I added a line for the user "eplus":
Code: Select all
# Secrets for authentication using CHAP
# client server secret IP addresses
eplus * eplus
Finally, you can test your setup by connecting via UMTS by
Code: Select all
$ 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


