Update, September 2016:
This post has been slightly shortened. I would also like to add that it’s over five years old now and newer dongles probably use less braindead SIM lock systems.
Before going through this procedure:
See Neil McPhail’s unlocker script and/or this slightly friendlier guide.
Step one: get your unlock code.
Find your modem’s 15-digit IMEI, open up a terminal, run python
and copy-paste the following code:
import hashlib def get_code (input): imei=str(input) digest=hashlib.md5((imei+"5e8dd316726b0335").lower()).digest() code=0 for i in range(0,4): code += (ord(digest[i])^ord(digest[4+i])^ord(digest[8+i])^ord(digest[12+i])) << (3-i)*8 code &= 0x1ffffff code |= 0x2000000 return code
Hit Enter twice after pasting. Next, type in the following, replacing the example IMEI with your own:
get_code(123456789098765)
Hit Enter and you’ll get your 8-digit unlock code. For my example IMEI, the code would be 47412550
.
Step two: find your dongle’s control channel.
Open a terminal and become superuser (sudo -i
or su
). Try cat /dev/ttyUSB0
, cat /dev/ttyUSB1
and so on, until you get a continuous output that looks like this:
^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. If you’re getting no output, hit Control-C and try again with the next ttyUSB. If you run out of ttyUSBs to try, I don’t know what to say.
Step three: send the unlock command.
If you do get output, don’t hit Control-C or close the terminal. Instead, 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 just found out:
chat TIMEOUT 1 '' 'AT^CARDLOCK="47412550"' 'OK' > /dev/ttyUSB1
You should see OK
on the other terminal window. I also got a +CME error: operation not allowed
error, but it didn’t seem to be a problem.
If you get something like +CME error 3
, though, that means something has gone wrong at some point. Maybe look for another guide?
Pingback: Wuawei e172 | Challengedsing
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
Wow, thanks. I’ll add that to the post. ^_^
Thank you Andy C. and Neil McPhail.
I used Neil’s automated script (https://github.com/mcphail/linux_huawei_unlocker)
on Linux Mint 17 Cinnamon.
Unlocked Huawei e173u-2 usb modem on Optus (Australia).
It worked perfectly.
Now I can use a Vodafone Australia prepaid mobile broadband sim as well.
Thanks again, guys.
Tried it with a Huawei E220 but it didn’t work,
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!
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?
Sorry, no. I’d suggest double-checking to make sure you’ve typed the right command first, and asking in your distro’s forums (e.g. Ubuntu Forums) or an IRC channel if it still doesn’t work.
Pingback: Unlock your Huawei E160
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!