Unfinished Sofware's Blog

I recently bought a 3G wireless card to use with my laptop, a ZTE, model MF622.

Since the first time I tried linux, also the first time I encountered this kind of problems with my usb ADSL modem, and this being an usb modem also, I knew I was going to have troubles.

At first I tried USB ModeSwitch which has experimental support for ZTE’s MF620 model with no luck. I then followed the instructions on the site to snoop the usb comunication under M$ Win to get the messages being sent to the device so I could mimic that under linux. Still, no luck.

I then tried to code a python script which used the libusb so that I could make the device switch to the modem configuration. Still, no luck.

I spent a lot of time on this subject and then one time I removed the usb_storage module while hal was waiting for the device to settle down and guess what!? After a few seconds, the device changed itself to the modem configuration. All I needed now was to automate this procedure.

Here’s the udev script that does the job:

ACTION!="add", GOTO="ZTE_End"

# Is this the ZeroCD device?
SUBSYSTEM=="usb", SYSFS{idProduct}=="2000",
SYSFS{idVendor}=="19d2", GOTO="ZTE_ZeroCD"

# Is this the actual modem?
SUBSYSTEM=="usb", SYSFS{idProduct}=="0001",
SYSFS{idVendor}=="19d2", GOTO="ZTE_Modem"

LABEL="ZTE_ZeroCD"
# This is the ZeroCD part of the card, remove
# the usb_storage kernel module so
# it does not get treated like a storage device
RUN+="/sbin/rmmod usb_storage"

LABEL="ZTE_Modem"
# This is the Modem part of the card, let's
# load usbserial with the correct vendor
# and product ID's so we get our usb serial devices
RUN+="/sbin/modprobe usbserial vendor=0x19d2 product=0x0001",
# Make users belonging to the dialout group
# able to use the usb serial devices.
MODE="660", GROUP="dialout"

LABEL="ZTE_End"

Save this file as /etc/udev.d/15-zte-mf622.rules for example(this path is a good one under (K)Ubuntu).

The next time you plug-in the modem, at first, the usb_storage module get’s removed. After a few seconds, since the modem is not being handled like a storage device, it’ll switch to the modem configuration. At this stage we tell udev to load the usbserial kernel module with the vendor and product id’s and you’ll get 3 ttyUSB devices. The /dev/ttyUSB0 will be the one you should use to make a connection.

You can now point ppp or wvdial to that device a start the connection, or, you might also want to check UMTSmon, this is an application suited for these kind of modems.

 

Comments

  • Hi, Thanks alot, you are a saviour! Dead simple just remember to reboot once you’ve placed the file in the system to make it all work!

    Comment by Jim — Jan 15, 2008 10:44:22 PM | # - re

  • Any chance on a detailed howto after this, how to connect to Three mobile with the modem, umtsmon is giving me nothing …

    Comment by Patrik Olterman — Jan 25, 2008 10:17:27 PM | # - re

  • To Patrik: Sorry, don’t know what else you should do regarding umtsmon, perhaps contact the developer?

    Comment by s0undt3ch — Jan 26, 2008 12:11:28 AM | # - re

  • To Patrik: I’ve just done this - see my blog entry at http://hillj.co.uk/2008/01/31/how-to-get-online-with-three-mobile-uk-and-linux-ubuntu/ To the blog author: Thanks for the udev snippet, it works great!

    Comment by James Hill — Jan 31, 2008 4:46:04 PM | # - re

    • Hi James & UfSoft Fantastic article on your link, had the modem up & running in about ten minutes. wish all linux config dramas were so easy to solve.

      Comment by Mark — Apr 13, 2008 3:08:51 PM | # - re

  • Hi just to say thanks for a super solution to the use of the 3 mobile modem using Linux. Even when 3 tell you that their system will not work with Linux.

    Comment by Johnbywr — Feb 4, 2008 3:57:18 PM | # - re

    • could you please guide me how to install 3 modem in my 2 GB linux Eee PC?

      Comment by tamjid — Mar 12, 2008 10:55:45 AM | # - re

    • could you please guide me how to install 3 modem in my 2 GB linux Eee PC? e-mail : opu_ul@yahoo.com

      Comment by tamjid — Mar 12, 2008 10:56:15 AM | # - re

  • Hi! I am having some problems because the daemon is freezing while sending the config requests. Has anyone got this problem? Best regards, Marco

    Comment by Marco — Mar 4, 2008 3:32:52 PM | # - re

  • Hi! I have big problem with mounting external usb storage devices like HDD or my PSP. It loads without your script but when i copy it to /etc/udev/rules.d/ it’s stopping them from mounting. Do you have any solution?

    Comment by Maciej Szpakowski — Mar 10, 2008 3:55:26 PM | # - re

    • I’m trying to find a solution for this myself. For now I’ve been connecting the modem and then hashing out the line in the script: RUN+=”/sbin/rmmod usb_storage” Then running: # udevcontrol reload_rules This stops it killing usb_storage after the modem’s already connected. Hope that helps, and hopefully I can find some time for something neater. Dave

      Comment by Dave — Apr 8, 2008 2:16:37 PM | # - re

    • The problem with removing “usb_storage” is that it affects all devices. If you use USB_ModeSwitch with the flag “DetachStorageOnly” the mode switching works too, but all other USB storage devices (disks, sticks etc.) continue to work. There is an entry for the ZTE MF622 in the config file now.

      Comment by josh — Apr 25, 2008 8:48:07 AM | # - re

  • […] Riferimenti: usb_modeswitch Unfinished Sofware’s Blog OpenLinux […]

    Pingback by Andrea Boscolo » Onda MT512HS Tim — Mar 13, 2008 8:02:41 AM | # - re

  • This script looks promising, but I get an error “Error inserting usbserial (…): Unknown symbol in module, or unknown parameter”. dmesg says “usbserial: Unknown parameter ‘vendor’”. Anyone else come across this?

    Comment by Paddy — Mar 28, 2008 11:56:19 AM | # - re

  • My little HOWTO on ZTE MF620 and Fedora 8 http://www.dit.upm.es/~jantonio/personal/mf620 (In Spanish, sorry, but should not difficult to read :)

    Comment by jonsy — Apr 1, 2008 6:45:01 PM | # - re

  • Just wondering if anyone’s had success with this on an Asus eee PC - I’m looking at buying one but won’t until I know I can use my ZTE622 with it!

    Comment by Jef Woodhouse — Apr 1, 2008 11:16:39 PM | # - re

  • hi there. Sorry for the really stupid question… When I attempt to save the script to the given location, I get the message that I do not have permissions. When I try to modify the permissions, I am told that I cannot modify permissions as I do not own the folder. Help!!!

    Comment by rax — Apr 4, 2008 12:19:51 AM | # - re

  • […] file ini berasal dari sini. Intinya rules tersebut menghilangkan fitur usb storage yg dimilik modem ini. di linux, belum adanya fitur usb mode […]

    Pingback by Menginstall ZTE MF622 USB Modem di Linux Ubuntu at Adi Setiawan weblog — Apr 20, 2008 11:23:33 AM | # - re

  • Oi! I’m noob in linux and I don’t understand anything. Maybe someone could took pictures how to? And write how to ? :D please, people help, I want to learn something…

    Comment by Hematogenas — Apr 26, 2008 5:47:26 PM | # - re

  • Just a simple answer to the usb-storage not working problem.I set up a directory in the root tree called udv-rls and copied the mf622 ruleinto there. I also put a sub-directory called bckup and copied all the rules from udev into that for security. I then wrote a small shell script: : #!/bin/bash cp -v /udv-rls/15-zte-mf622.rules /etc/udev/rules.d/ udevcontrol reload_rules # end of script. I saved it in /bin as “3up” That then loaded the rule. I made sure that there were no usb_storage devices in the usb ports, and then plugged in the mf622 dongle and waited for it sort itself out. After it had produced the /dev/ttyusb0 I then ran another script I called /bin/usf #!/bin/bash rm -v -f /etc/udev/rules.d/15-zte-mf622.rules udevcontrol reload_rules #end of script (I found the “force” switch necessary) I could then plug in the usb-storages device(s) at will. The shell scripts have to be run as root from a shell terminal. I use opensuse10.3 I also expect it to work on mandriva 2007.

    Comment by Dorothy Hyde — May 8, 2008 5:18:41 PM | # - re

  • Tengo un modem usb zte que quiero instalar en linux open suse 10.0 pero no he podido. sera que me pueden expliar los pasos logicos de instalacion que debo dar. por favor. Marino ovidio

    Comment by Marino Ovidio — Sep 14, 2008 10:47:57 PM | # - re

  • Hi guys, You Linux users are a more adaptive lot than us Windozers. I also have a ZTE MF622 and it works fine on my XP laptop. But I truly hate the official software and would like to automate the connection process. Their app auto-starts when the device is plugged in and it does some magic to initialize the modem. Their ‘connect’ button creates a Dial-Up Networking profile and launches that. With their software loaded, but disconnected, I can connect manually with a profile of my own. However, when I close their ghastly software the modem light goes from green to red and the DUN profile complains that the modem has gone, although it is still available in the devices list and can still be quieried with the built-in modem diagnostic util. So my question is this… what black magic have you guys discovered to initialize the modem, check the usim, connect to the 3g network, etc. All of that seems to be done by the nasty nasty win app, and the modem isn’t ready to connect with (although does exist as a queryable modem) until then. I’m asking you guys not because I expect you to care but coz I think you already understand far more about this device than I do. Thanks in advance for any assistance you can offer me. Cheers, Peter C

    Comment by Peter C — Oct 13, 2008 1:50:32 AM | # - re

    • This brings us to the linux “problem” when using these modems. The thing is, software/hardware creators care more to have a Supported by Window$ logo than by making good and simple software. In this modem case(and other modems like this one), they tried to make it as annoying as Window$ itself is, “the user shouldn’t have to do anything”, so, the modem contains 2 different hardwares, an storage hardware like a pen-drive(so that it also provides the windows software to use the modem) and the modem. What we linux users do(and what you want to also do) is make the modem “switch” from pen-drive to the actual modem, that’s what the provided window$ software does besides some other crappy stuff ;) From my point of view, you’re stuck with that software but what you might try to search for is, window$ software like usb_modeswitch(http://www.draisberghof.de/usb_modeswitch/) or UMTSmon(http://umtsmon.sourceforge.net/) both for linux ;) The idea is, you have to be able to make the modem switch from pen-drive to the actual modem. You might want to try to go to your control panel -> system hardware and when you plug the modem you’ll briefly see a new usb storage device or a new cd-rom like device, by right clicking that device you have the option to ignore that device. What happens is that after a few seconds, if the pen-drive or cd-rom driver isn’t used, the fake-modem auto-switches to the actual modem, though, if you have it’s software installed, you probably won’t be able to do this. Note that I won’t be held responsible for anything you do on your Window$! ;)

      Comment by s0undt3ch — Oct 13, 2008 3:05:41 AM | # - re

      • Thanks s0undt3ch. I get the pen-drive vs. modem debate. I’ve watched the hardware devices come and go as it is plugged in. I’ve not yet been able to stop their hideous app from launching when it’s inserted so I don’t know whether their app does the switching or something else - probably their app. I suspect that if I ever do manage to disable it then I will need to do the switching myself, as you suggested. As it is I am stuck on the next step which is how to make the modem connect to the 3g network. That is something which their software does when it starts. You cannot “connect” until it’s ready for you. The bummer is that it closes it all down again when the software is closed. If I leave theirs running, but not connected, then I have a working 3G modem to play with via terminal, or through DUN. But close their software and it all falls apart again :-( I think I’m on my way to sorting that out by initializing it via the NMEA port, as I subsequently posted about. I suppose I should count myself lucky that, as a signed up Windozer (I’ve got a pointy hat with a big “D” on it), I don’t *have* to get this working. I pity you guys who are so poorly supported by the manufacturers and have to resort to the cunning hacks. At least you learn stuff though. I’ve had my hand held for so long I’m really struggling here! Thanks for your advice. If I crack this then I will post back - you never know, it may even help one of your Linuxer mates :-) Cheers, Pete.

        Comment by Peter C — Oct 13, 2008 3:17:33 AM | # - re

        • If you find a way, please do! ;)

          Comment by s0undt3ch — Oct 13, 2008 3:21:29 AM | # - re

  • Hi again, Just did some more sniffing and it seems to be the exchange on the NMEA COM port that initializes the device. I logged a number of start ups and it doesn’t seem to be the same twice, so I might need to spend some time looking into this NMEA business (it’s all new to me). Tried replaying a couple of the sequences and I still don’t get a green light. However, I’m hopeful that this will eventually yield a working modem, ready to use with Windows Dial-Up Networking. To help me follow the various Linux instructions that I’ve found perhaps you can tell me what utility/app you guys use to init the device? Presumably your Linux app does the same thing on the NMEA port? Windozers don’t seem to hack about with the same gusto that Linuxers do. Maybe I’m batting for the wrong team (but not in a sexual way)! Cheers again, Pete

    Comment by Peter C — Oct 13, 2008 3:04:04 AM | # - re

  • Hello do you have a guide for the wm66 usb modem? Are these steps the same for my device? Here is the link… http://www.mudah.com.my/vi/1336427.htm?ca=11_s please help me…I would like to run this device on my Arch Linux Desktop… Thanks alot

    Comment by arch(er) — Nov 13, 2008 12:09:25 PM | # - re

  • […] Google: ZTE MF622 USB Modem Under Linux — UfSoft.org Blog Por lo que se ve es super facil, pero no tengo uno asi que no puedo probar jaja. Intenta y nos cuentas. Saludos […]

    Pingback by instalar modem ZTE MF622 empresa claro - Foros de CHW — Nov 13, 2008 6:17:21 PM | # - re

    • Latest version of Kubuntu(intrepid) detects the ZTE MF622 modem correctly, making this “solution” deprecated. All you have to do then is setup a ppp connection according do your ISP details.

      Comment by s0undt3ch — Nov 22, 2008 1:23:35 PM | # - re

  • This blog post give you the details (search for wm66 in it) of how to use usb_modeswitch for the wm66. Or at least what works for me. I never got the MF 622 working. http://blog.annoyedtoday.com/usb_modeswitch/20081115-034016-Sucky-Modem-and-USBModeswitch-Annoyances

    Comment by wilbur@wilburcorncob.com — Nov 22, 2008 1:56:44 AM | # - re

  • […] to use them is remove the file and reload the rules. I got the following solution from a comment by Dorothy Hyde to the post i mention in the reference part of this article […]

    Pingback by Setup ZTE MF622 USB Modem in Linux « Bits of Wizardry — Dec 2, 2008 8:10:18 PM | # - re

  • Thanks! Works great! I had previously tried usb_modeswitch, modprobe optional settings, and more on a linpus box with no success. This udev rules did the trick ;)

    Comment by gentux — Dec 6, 2008 5:27:47 PM | # - re

  • I’m trying to use the same method for the ZTE MF627 USB Modem with no luck until now, is there anyone who’s got that model to work?

    Comment by 7mefree — Dec 12, 2008 5:46:14 PM | # - re

  • You don’t need to mess around with this anymore!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! openSUSE 11.1 works straight out of the box with this modem!!!! Damn openSUSE is the best linux version out there! Just plugin your modem and knetworkmanager recognises it, just put in the number and username/pass and off you go peice of cake!

    Comment by Anon — Jan 6, 2009 12:36:07 PM | # - re

  • thank’s alot bro… but the system have a respond the device /dev/ttyUSB0 is not such directory....
    please tell me about this....
    thanks one more....

    Comment by Bi4kKob4r — Jan 15, 2009 2:10:08 AM | # - re

  • Can you help me? i have a ZTE, model MF622. but i try tu use your script but.
    1 i use mandriva one 2009
    2 mandriva mount the modem like a usb storage
    3 i cant apper the ttyUSB0 or ttyUSB1 and ttyUSB2

    please help me i need use my modem in linux. this modem run great in window but i dont want to use it in window

    Comment by rordan — Feb 3, 2009 10:18:29 PM | # - re

  • please be aware that the udev script here will break aspects of your system (and not work for the ZTE) if you are using usb-storage or usb-serial for anything else (such as a USB pen drive or USB serial port adapter). There is a program “usb-modeswitch” that can flip the ZTE devices over to serial mode without having to forcefully remove or insert modules; however, it seems since at least 2.6.26 the device flips over of it’s own accord without manual intervention (on Debian Lenny at least).

    Comment by Jon — Apr 7, 2009 9:10:56 PM | # - re

    • Yes, you are right, it breaks storage support and at least for me, I now don’t need this script since Kubuntu 8.10 flips my modem, at least, last time I tried it ;)

      Comment by s0undt3ch — Apr 24, 2009 4:35:42 PM | # - re

  • can you tell me how can use usb_modeswitch to change my reliance usb modem AC8710 from storage mode to modem mode. so that i can load the driver to detect the device in /dev/ttyUSB0

    Comment by Sarahana T — Jun 4, 2009 5:29:23 AM | # - re

  • for people, who use Windows i uploaded latest drivers(xp, 2k, vista support). download from answercop servers - answercop.com/ZTE_MF622_Driver_Download_For_Windows_2000_XP_and_Vista

    Comment by marko — Jul 11, 2009 8:28:15 PM | # - re

  • Hi there

    ZTE MF636 using Slackware, with kernel 2.6.30.5

    This is my zte-mf636-beta.rules (I use the option module which is reputed to use a higher speed)

    ACTION!=”add”, GOTO=”ZTE_End”

    1. Is this the ZeroCD device?
      SUBSYSTEM==”usb”, SYSFS{idProduct}==”2000″,
      SYSFS{idVendor}==”19d2”, GOTO=”ZTE_ZeroCD”
    1. Is this the actual modem?
      SUBSYSTEM==”usb”, SYSFS{idProduct}==”0031″,
      SYSFS{idVendor}==”19d2”, GOTO=”ZTE_Modem”

    LABEL=”ZTE_ZeroCD”

    1. This is the ZeroCD part of the card, remove
    2. the usb_storage kernel module so
    3. it does not get treated like a storage device
      RUN+=”/usr/bin/eject /dev/sr0”

    LABEL=”ZTE_Modem”

    1. This is the Modem part of the card, let’s
    2. load usbserial with the correct vendor
    3. and product ID’s so we get our usb serial devices RUN+=”/sbin/modprobe usbserial vendor=0x19d2 product=0x0031”,
    4. Make users belonging to the dialout group
    5. able to use the usb serial devices.
      MODE=”660″, GROUP=”dialout”

    LABEL=”ZTE_End”

    Comment by David — Aug 25, 2009 9:40:25 PM | # - re

  • Hi,

    I installed that udev-rule on debian lenny and now I just only get one usb-modem (/dev/ttyUSB0) since I have never used ppp on linux, what do I have to do, to connect to the internet. wvdial is installed, but actually I have no clue how to operate it. does anybody got a hint for me? thanks

    heinz

    Comment by Heinz — Aug 27, 2009 1:52:59 PM | # - re

  • working great. Thank you so much.

    Comment by koko — Mar 30, 2010 12:33:42 AM | # - re

  • i have (( zte ax225 )) windows 7 regnize it as (( zte wimax bcm1000 )) anyone had the same device …

    Comment by Anass — Dec 27, 2010 11:22:12 AM | # - re

  • […] Yep, that’s the way! It is possible to automate these steps via a udev rule like this user did with his ZTE device: ZTE MF622 USB Modem Under Linux — UfSoft.org Blog […]

    Pingback by Problem with Novatel 3G modem — Sep 12, 2011 8:55:14 PM | # - re

  • Buenos dias, no lei todos los post porque eran un monton, no se si solucionaron el problema:

    No lee mis usb despues de usar este script

    Bueno, por si no lo respondieron aca pongo la Solucion:

    Es solo agregar la linea GOTO=”ZTE_End” en cierta parte. Aca la solucion:

    ACTION!=”add”, GOTO=”ZTE_End”

    1. Is this the ZeroCD device? SUBSYSTEM==”usb”, SYSFS{idProduct}==”2000″,SYSFS{idVendor}==”19d2”, GOTO=”ZTE_ZeroCD”
    1. Is this the actual modem? SUBSYSTEM==”usb”, SYSFS{idProduct}==”0001″,SYSFS{idVendor}==”19d2”, GOTO=”ZTE_Modem”

    GOTO=”ZTE_End”

    LABEL=”ZTE_ZeroCD”

    1. This is the ZeroCD part of the card, remove
    2. the usb_storage kernel module so
    3. it does not get treated like a storage device
      RUN+=”/sbin/rmmod usb_storage”

    LABEL=”ZTE_Modem”

    1. This is the Modem part of the card, let’s
    2. load usbserial with the correct vendor
    3. and product ID’s so we get our usb serial devices RUN+=”/sbin/modprobe usbserial vendor=0x19d2 product=0x0001”,
    4. Make users belonging to the dialout group
    5. able to use the usb serial devices.
      MODE=”660″, GROUP=”dialout”

    LABEL=”ZTE_End”

    Con esta mejora del script ya leera las usb normalmente, espero les ayude.

    Saludos.

    Comment by YAGAMI — Oct 10, 2011 7:05:49 PM | # - re

  • hi,guys~~I have try to make my dongle work for a long time ,I I fail ,including the method of yous. the dmesg is show like below:

    3956 Feb 20 11:18:20 scv kernel: [ 104.926447] usb 1-1.2: new high speed USB device using ehci_hcd and address 7 3957 Feb 20 11:18:20 scv kernel: [ 105.021259] usb 1-1.2: configuration #1 chosen from 1 choice 3958 Feb 20 11:18:21 scv kernel: [ 105.077056] Initializing USB Mass Storage driver… 3959 Feb 20 11:18:21 scv kernel: [ 105.077228] scsi5 : SCSI emulation for USB Mass Storage devices 3960 Feb 20 11:18:21 scv kernel: [ 105.077371] usbcore: registered new interface driver usb-storage 3961 Feb 20 11:18:21 scv kernel: [ 105.077376] USB Mass Storage support registered. 3962 Feb 20 11:18:21 scv kernel: [ 105.077502] usb-storage: device found at 7 3963 Feb 20 11:18:21 scv kernel: [ 105.077505] usb-storage: waiting for device to settle before scanning 3964 Feb 20 11:18:21 scv kernel: [ 105.081247] usbcore: deregistering interface driver usb-storage

    what’s more :

    I can see ttyUSBx in the directory of /dev/

    thank you in advanced.any advices will help .

    Comment by wuxinxinggg — Feb 20, 2012 3:37:48 AM | # - re

  • i have a zte modem ax226..and pid and vid is 19d2 and 0220…so if i customize this file according to my requirement, it will work or not??

    Comment by imrul — Jul 17, 2012 8:18:18 AM | # - re

  • i have a zte modem ax226..and pid and vid is 19d2 and 0220…so if i customize this file according to my requirement, it will work or not??

    Comment by imrul — Jul 17, 2012 8:28:21 AM | # - re

  • Thanks for this post, it worked perfectly for my 3-Mobile ZTE MF622 modem with Ubuntu 12.04.

    The only thing I would add is that for Ubuntu 12.04 the file has to be created as etc/udev/rules.d/15-zte-mf622.rules

    NOT the path specified in you guide.

    The default settings for 3-Mobile in “Network Connections” worked perfectly first time after reboot.

    Comment by Chris Gill — Dec 9, 2013 1:35:34 PM | # - re

  • Thank you. This works fine on Ubuntu 12.04 if the file is saved as /etc/udev/rules.d/15-zte-mf622.rules

    Unfortunately in doing so it disables another usb storage device, how can I prevent this?

    Comment by Chris Gill — Dec 9, 2013 5:21:45 PM | # - re

Leave a Reply