HOWTO avoid pains with NetCom 3g USB on jaunty

Download this article as an e-bookDownload this article as an e-book

Internet anywhere, ain’t it great?

If you have one of those 3g netcome HSDPA USB dongles you might hve noticed how they don’t really work so well out of the box.

After I had spent 4 hours trying to get the thing working Martin smugly told me these things should be plug’n'play and proceeded to… fail to get it working. oW hELL…

Cutting to the chase and sparing you the gritty details I have a recipie for getting 3g working with the Netcom ZTE-MF636 USB dongle. This recipie should work in ubuntu jaunty and similar recent distros, and most of the instructions apply to other USB dongles too. Included are also all the tips you need to avoid spending 4 hours hammering your head against the wall…

What you need:
udev usb-modeswitch hal wvdial

This USB device has the braindead capability of pretending to be a CD-ROM containing windows drivers when you plug it in. The modem part of the device is hidden from your system until it is “switched”. On older kernels it is enough to eject the faux CDROM to switch the device to modem mode, but in recent kernels the linux developers in all their wisdom decided to create a special rule to ignore this CD-ROM device – that’s supposed to help make the device work, but really just makes it impossible to switch to modem mode unless you have a special program.

# dmesg | grep usb
usb 1-1: new high speed USB device using ehci_hcd and address 11
usb 1-1: configuration #1 chosen from 1 choice
Initializing USB Mass Storage driver...
usb-storage: device ignored
# lsusb
Bus 001 Device 001: ID 19d2:2000

So the device is detected but not added to the system. You need usb_modeswitch to kick the device into modem mode:

# apt-get install usb-modeswitch

Make the file /etc/usb_modeswitch.conf contain:

# ZTE MF628+ (tested version from Telia / Sweden)
# Contributor: Joakim Wennergren
# Also applies to MF627 (Tested 3 UK) JF
# Also applies to MF636 (Tested Netcom Norway)

DefaultVendor=  0x19d2
DefaultProduct= 0x2000

TargetVendor=   0x19d2
TargetProduct=  0x0031


You can tell it’s working when the productID of the modem switches from 19d2:2000 to 19d2:0031.

Then, tell udev to switch the modem automagically by creating a file called /etc/udev/rules.d/999-zte.rules with the contents:

SUBSYSTEM=="usb", SYSFS{idProduct}=="2000", SYSFS{idVendor}=="19d2", RUN+="/usr/sbin/usb_modeswitch"

You also need to tell HAL about the device. Create a new file

<!-- WordPress sucks at preformatted code! -->
<!-- -*- SGML -*- -->
<deviceinfo version="0.2">
<!-- ZTE MF636 HSDPA USB dongle -->
      <match key="@info.parent:usb.vendor_id" int="0x19d2">
         <match key="@info.parent:usb.product_id" int="0x0031">
            <match key="@info.parent:usb.interface.number" int="3">
            <append key="modem.command_sets" type="strlist">GSM-07.07</append>
            <append key="modem.command_sets" type="strlist">GSM-07.05</append>
            <append key="info.capabilities" type="strlist">modem</append>

Phew. Now restart hal and udev

# /etc/init.d/hal restart; /etc/init.d/udev restart

and re-plug your USB modem, which should kick into modem mode, attach itself to /dev/ttyUSB[012] and mount usb-storage. There is a very helpful manual.pdf in there. Why in the ehll did they not put the windows drivers in there as well!?! At this point in time you can also plug a MicroSD into the dongle’s very useful MicroSD port. Gee, I wonder if it makes coffee, foo?
If you don’t have /dev/ttyUSB* by now, you’ll have to do a little debugging. I recommend a console tailing messages, another console with udev monitor and another console with udev trigger to see what’s up.

Moving on, you can talk to your modem with minicom and AT commands and even get connected with the ever wonderful wvdial (all ingredients included below), or your favorite dialer (excersise left for the student).

Just note that your modem is attached to /dev/ttyUSB2 and not the first device /dev/ttyUSB0 as you might have thought.

/etc/wvdial.conf should contain:

[Dialer pin]
Modem = /dev/ttyUSB2
Baud = 115200
Dial Attempts = 2

[Dialer Defaults]
Modem = /dev/ttyUSB2
Modem Type = Analog Modem
ISDN = 0
Baud = 460800
Dial Attempts = 1
Username = internet
Password = internet
Dial Command = ATDT
Dial Attempts = 2
Init1 = ATZ
Init2 = AT&F &D2 &C1
Init3 = ATS7=60 S30=0 S0=0
Init4 = AT+CGDCONT=1,"IP",""
Phone = *99#
Stupid Mode = 1

Do remember to fill in your pin code!
Once you have that in place you can connect to the internet like so:

# wvdial pin

This should finally switch the evil red light on the dongle to a pulsating blue led, and inform you that the PIN was accepted, that the unit is searching for nets, oh now it found nets, now it’s connecting to nets, and bam bobs your uncle you have an IP address, a gateway and some DNS servers and you’re connected :-)

The modem will have a continuous blue light while you are connected.

Just like with a live grenade, you can’t put the pin in twice, and that’s why we have the Dialer Defaults. If you need to reconnect later, just do

 # wvdial

and it’ll connect without trying to put in the pin again.

Now go create some scripts and desktop items so you can get connected with the click of a button.

If you want a regular user to be able to connect, as opposed to switching to root, you need to add this user to the appropriate groups:

adduser myuser dip
adduser myuser dialout
# pppd must be setuid
chmod 4750 `which pppd`
chgrp dip `which pppd`

… and the user needs to relogin for these changes to take affect.
Note! If you plugged the modem into a low-speed USB hub you’ll be able to connect to the internet, but the connection will drop all the time:

 # dmesg | grep speed
usb 3-3: not running at top speed; connect to a high speed hub

You need a usb 2.0 port to surf through the usb dongle.

These instructions are 2 parts experience with the T400 3g module, 3 parts googling other people’s problem solving, and 5 parts perspiration.

Next up: built-in ThinkPad T400 3g modem HOWTO, and a one-shot debian package for the ZTE-MF363 (HA! fat chance! I don’t have time for that kind of thing!)

Download this article as an e-bookDownload this article as an e-book

Tags: , , , , ,

8 Responses to “HOWTO avoid pains with NetCom 3g USB on jaunty”

  1. The usb-modeswitch used to require compilation a while ago, so I got it to work but found that the ZeroCD tool is better and far easier for newbies to use (as far as hso.ko kernel module compilation is not required… Like it is the case in odd architectures ):

    This rocks under Ubuntu at least!

    The built in 3g modem in the Lenovo X200 works like a charm. It even can send sms.

    Now you know :)


  2. kacper says:

    Rubén’s way is good too – but I can’t abide by Network Manager. usb-modeswitch doesn’t require compilation, but leaves a lot to be desired in terms of usability.

    Then again, set it up once and never think about it again.

    Incidentally, linux sure has many serial drivers for the same purpose: there’s the traditional option.ko, there is cdc_acm.ko, hso.ko and also usbserial.ko. I’m sure I’ve missed one :-P

    Sure, the kernel modules are specialized for a general type of device, but my T400 ships with a 3G card that works with all these kernel modules.


    Guess what? The netcom ZTE MF-636 modem, besides featuring a fake CDROM, built-in read only usb-storage and microSD slot also has a built in GPS!

    … and it’s not that easy to get working in windoes either.

  3. Gøyt. Men før du brenner timesvis på T400 modemet sjekk blog posten min (. Så kan du debian-pakke scriptene jeg postet og være ferdig på 20 minutter. GPS har T400 modumet også – med overraskende bra mottaks-styrke, antenne i skjermen er tydligvis effektivt.

  4. kacper says:

    Takk Nicolai – på grunnlag av dine 3g skript fikk jeg T400 på treege før sommer. Men Telenoir er så vanvittig dyrt at jeg har sluttet å bruke tjenesten.

  5. David Faure says:

    Rubén Romero: how do you send SMS with a usb 3g key? I have one, it connects to the internet using wvdial, but then how do I send/receive SMS? Thanks for any pointers, please email reply to faure at

  6. spiele says:

    Thanks for the suggestions. It will help me to run it properly.

  7. Tibia says:


    Thanks, I always love a good read. Hehe I usually do agree with your posts opinions and stuff ;) Dont stop posting!…