Unlocking the Huawei E172… on Linux

Update: commenter Neil McPhail posted a Python-based solution to this. The script is here – save that somewhere (say, on your desktop), mark it as executable and run it. I haven’t tried it, so make sure to take a look at it before executing.

Note: you may find the guide here friendlier. It describes essentially the same procedure, but it tells you how to use minicom to do it.

My apologies (again) for the lack of new content on this marvelous weblog. I’m in a rural area now, and the Internet connection sucks around here. And my HTC Diamond, which I used as a wireless router, only manages to make that sucky connection even suckier. So, what do I do?
I grab my aunt’s E172. The modem, while awesome because it doesn’t overheat itself to death (unlike my Diamond), was unfortunately tied to Vodafone’s service, which is a) paid and b) slower than the free service I have from RDS. The logical solution: unlock the thing!

So here’s a tutorial, the kind I usually post when I find out how to do something. Note that this tutorial should work for all Huawei dongles, but I make no promises.

Step one: get your (free, of course) unlock code. For that, you’ll need your modem’s 15-digit IMEI, which, on the E172, is engraved into its back side. Make a note of it.
Now, open your browser and type this in your address bar: http://www.bb5.at/huawei.php?imei=123456789098765 (replacing 123456789098765 with your own IMEI, of course). You need the number that will be displayed after “Entsperren/Unlock:”; with the example IMEI, that would be 47412550.

Step two: insert the code. This is the step that gave me headaches, mainly because I’m on Linux and I don’t get prompted for a code.
First, you’ll need to know what “control channel” your dongle uses; for that, open a terminal, become superuser (sudo -i on Ubuntu, su on most other distros) and type cat /dev/ttyUSB0, cat /dev/ttyUSB1 and so on, until you get a continuous output resembling this: (for me, /dev/ttyUSB1 was the control channel)
^DSFLOWRPT:00000832,00000000,00000000,00000000001874A9,000000000029ABE3,0003E800,102E1AC3
Note that the DSFLOWRPT messages will only appear when the dongle is actually connected. If it isn’t connected, you’ll probably get BOOT messages instead. Oh, and hit Control-C to get your prompt back if you get no output.
If you do get output, don’t hit Control-C or close the terminal; open another terminal window and copy-paste this command, replacing 47412550 with the unlock code you got in the previous step and /dev/ttyUSB1 with the control channel you found out earlier:

chat TIMEOUT 1 '' 'AT^CARDLOCK="47412550"' 'OK' > /dev/ttyUSB1

There you go. If you watched the other terminal window, you should see OK; I also saw +CME error: operation not allowed. That message shouldn’t be a problem; if you got something like +CME error 3, though, that means that you’re probably doing something wrong.

Disclaimer: I did this and everything worked just okay. Your mileage may vary. I give you no warranty that these instructions are correct, just my testimony. :D
Please leave a comment if this worked… or didn’t. I’m open to criticism.

About these ads

9 Comments on “Unlocking the Huawei E172… on Linux”

  1. [...] Unlocking the Huawei E172… on Linux « Andy C.’s weblogJul 9, 2011 … Update: commenter Neil McPhail posted a Python-based solution to this. The script is here – save that somewhere (say, on your desktop), mark … [...]

  2. Neil McPhail says:

    Thanks for this guide, Andy. It helped me unlock my E173 painlessly on Linux without resorting to windows. I’ve stuck a script on GitHub which automates the process. I hope your readers will find it helpful.

    https://github.com/mcphail/linux_huawei_unlocker

  3. Linux Loonie says:

    Tried it with a Huawei E220 but it didn’t work,

  4. ronald says:

    Hello, I’m Ronald in France, I have a Hawei E172 on SFR-provider.
    I suit your method and I have a good result. Thank-You Andy !
    (Search good CODE with IMEI
    (stop Huawei modem.
    ( cat /dev/ttyUSB1 = ^BOOT ….
    ( minicom -f
    ( modif. serial port -> ttyUSB1 +return +esc
    (AT^CARDLOCK=”…myCode..” +return
    (> ok (no more message)

    Bye!

  5. frank says:

    hi, i tried it with Huewei E173 from Austria an i got
    “bash: /dev/ttyUSB2: Device or resource busy” with the command “sudo chat TIMEOUT 1 ” ‘AT^CARDLOCK=”59560428″‘ ‘OK’ > /dev/ttyUSB2″.
    With “sudo cat /dev/ttyUSB2″ I got output in the other terminal window.
    Do you have any ideas?

  6. [...] Unlocking the Huawei E172… on Linux [...]

  7. stickboy11 says:

    Glad I found this, your method of figuring out which tty to use is quite helpful. I usually just guess, and in minicom that’s kinda a pain in the ass. Cheers!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.