Huawei E1692 On Linux HOWTO

0. Meta

Author: David Santinoli david-at-santinoli-dot-com

Last revised: 24 Dec 2010

This document is targeted to an audience having a decent knowledge of Linux.

1. Intro

The E1692 is a UMTS/HSDPA USB dongle which, as of June 2009, is being sold in Italy by the TIM telephone operator.

The E1692 is one of those "dual mode" devices which upon insertion are identified as a CD-ROM drive, and switch to a serial device (modem) when prodded with a particular control sequence. The CD-ROM includes some software by the operator and a driver. I didn't even try to install this stuff, believing that it would be much better to rely only on standard Linux components.

Eventually, I got it working on a Ubuntu system running a 2.6.28.5 kernel, but the instructions that follow are general enough to fit many different setups.

2. Switching Mode

When in CD-ROM mode the device exhibits the 12d1:1446 USB ID, which becomes 12d1:140c in serial device mode.

The usb_modeswitch utility is required to switch to serial device mode. Install it and edit the /etc/usb_modeswitch.conf file as follows:

# Huawei E1692
DefaultVendor=  0x12d1
DefaultProduct= 0x1446

TargetVendor=   0x12d1
TargetProduct=  0x140c

MessageContent="55534243000000000000000000000011060000000000000000000000000000"

CheckSuccess=5
Then run usb_modeswitch (you might need to run it as root, e.g. sudo usb_modeswitch, if you are unsure whether you have the proper permissions to access the device). If all goes well, the messages
Found a new device in target mode or class
Mode switch succeeded. Bye.
will show up in the output, and lsusb will display the new USB ID:

Bus 001 Device 123: ID 12d1:140c Huawei Technologies Co., Ltd.

Before running usb_modeswitch, make sure that no other process is accessing the storage part of the device. Double-check that it is not mounted anywhere in the filesystem tree. Especially beware of file managers which automatically try to mount every piece of hardware that gets connected to the system (Nautilus is one of these).

3. The Kernel Driver

USB device 12d1:140c is handled in recent kernels by the option driver. To see if your kernel version supports the device, look for
alias:          usb:v12D1p140Cd*dc*dsc*dp*icFFiscFFipFF*
in the output of modinfo option.

After the device is switched to modem mode, the module should be automatically loaded (check with lsmod). As a consequence, the (pseudo) serial devices /dev/ttyUSB0 to /dev/ttyUSB3 should become available (look for them in dmesg). The first of them, /dev/ttyUSB0, is the one you can use with serial port applications like minicom and, most importantly, pppd.

4. Establishing the PPP link

Nothing really special here: just use /dev/ttyUSB0 as the serial port in the pppd configuration file, and keep in mind that dialing over UMTS requires different strings than POTS.

Anyway, these are my configuration files (they were named after my telephone operator, TIM - and you might want to substitute the proper APN for yours in place of ibox.tim.it):

/etc/chatscripts/tim:

ABORT BUSY
ABORT 'NO CARRIER'
ABORT VOICE
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT DELAYED
'' ATZ
OK-AT-OK AT+CGDCONT=1,"IP","ibox.tim.it"
OK-AT-OK AT+CGQREQ=1,2,4,3,6,31
OK-AT-OK AT+CGQMIN=1,2,4,3,6,31
OK-AT-OK AT+CGATT=1 OK-AT-OK ATD*99#
CONNECT ''

/etc/ppp/peers/tim:

hide-password
noauth
connect "/usr/sbin/chat -v -s -f /etc/chatscripts/tim"
debug
-crtscts
/dev/ttyUSB0
460800
defaultroute
noipdefault
remotename huawei
ipparam huawei
usepeerdns
nodetach 
With this setup, the Internet connection can be established and terminated with pon tim and poff, respectively.

5. Remarks

Although it is branded TIM, the dongle can work with other operators as well. Different PPP configurations for different SIM cards can coexist without problems. Run pon operator1, pon operator2 etc. to refer to the configurations under /etc/ppp/peers.

In some cases, some minor tweaks might be required. For example, I had no success with H3G (a.k.a. Tre Italia) until I realized that the PIN of the SIM had to be included at the beginning of the dialing sequence. Here is my /etc/chatscripts/tre:

ABORT BUSY
ABORT 'NO CARRIER'
ABORT VOICE
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT DELAYED
'' ATZ
OK "AT+CPIN=XXXX"
OK-AT-OK AT+CGDCONT=1,"IP","tre.it"
OK-AT-OK ATD*99#
CONNECT ''
Replace XXXX with your PIN.

6. TODO

I have yet to find a way to lock the device into UMTS-only mode, to avoid expensive GPRS roaming (you may run into this with H3G in Italy).

The string AT^SYSCFG=14,2,3FFFFFFF,2,4 is accepted when issued in minicom but rejected as unsupported command if placed in a chat script.
The string AT$NWRAT=2,2 is always rejected as unsupported command.