Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Patching u3g for XS Stick (pfSense on FreeBSD8.3) - Solved

    Scheduled Pinned Locked Moved Problems Installing or Upgrading pfSense Software
    12 Posts 3 Posters 5.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      Guest
      last edited by

      I finished testing the Installation and can report that beside some little problems with clog, the Installation is running stable (but off load) for at least two days now.

      off load, because im too stupid to get my modem up and running (again).
      U3g works fine, the modem is (after modeswitching) responding to attention commands, but will only dial, when it was initialised too with its Windows App :(

      Anyway, it runs perfectly with Gnome Net/modemmanager, so i looked at the init Commands there to see what else has to be done. It uses a state machine to establish a connection with over 20 AT commands… im a bit unhappy.

      Tried mr Frankenbergers config but had no success.
      http://linux.frankenberger.at/Huawei_E220_V1.html
      He is using chat scripts with a simple delay to get around the need for case switching when the modem has to choose another Network type.

      later on then, i tried with the nm at commands which i fetched from the gnome mm.  
      At least now im getting to the point where some LCP nego is happening. (which stops for no specific reason at some point…)

      Now i really think about installing the freebsd DBUS and MODEMManager Ports but have security concerns...

      • Anyone has an opinion on this....?

      hanD, Tho

      1 Reply Last reply Reply Quote 0
      • stephenw10S
        stephenw10 Netgate Administrator
        last edited by

        Have you tried using usb_modeswitch (freebsd port) in pfSense 2.0.1?

        Seems to have the required switching code:

        
        ######################################################## 
        # MobiData MBD-200HU (aka 4G XS Stick W10/W14, aka Micromax MMX 300G,
        # aka ChinaBird CBCPL68)
        #
        # Contributor: Chris
        
        DefaultVendor=  0x1c9e
        DefaultProduct= 0xf000
        
        TargetVendor=   0x1c9e
        TargetProduct=  0x9603
        
        MessageContent="55534243123456788000000080000606f50402527000000000000000000000"
        
        

        Though from your data the modem is already in the target mode.

        Steve

        1 Reply Last reply Reply Quote 0
        • ?
          Guest
          last edited by

          Hi Steve -

          thank you for helping - will try modeswitch now, just to be sure having tried all options before i buy a globetrotter.
          I think the problem is the modem firmw. which has to be initializised with variable commands like AT+CMER=3,0,0,1 ; AT+CNMI=2,1,2,1,0  and others before it does whats expected.  I further recognized that modemmanager is a linuxism because of its udev dependency and there is no freebsd port of it. (yet)  :(

          so, maybe this device is just a bad example of some proprietary crap, i think.
          But as usual - it was at least worth the cool experience of seeing pfSense on Freebsd 8.3 :)

          1 Reply Last reply Reply Quote 0
          • stephenw10S
            stephenw10 Netgate Administrator
            last edited by

            Many of these '4G' modems can be brought up as either a standard modem, that responds to dial-up etc, or as a usb ethernet device, no need to use any AT commands. You might investigate that.

            Steve

            1 Reply Last reply Reply Quote 0
            • ?
              Guest
              last edited by

              Hi Steve, Ethernet mode would be a great solution but actually the case for this device is that it supports only the more or less hayes compatible modem mode, you described.

              But first for our modeswitch topic - its funny - as soon as u3g takes responsibility for the device, it automatically switches itself from mass storage to modem mode, (even when not in a VM env) so no need for manual modeswitchng in this case.

              Im quite sure it needs more special init commands with params depending on dynamically acquired information, gathered before by at? commands.
              (Modemmanager does this like this.)  one can try to emulate this more or less with shell scripts (for easy cases like in mr Frankenbergers Huaway example) and may be succesful, if its known how to respond accurate to the dev.

              But as usual such Information is not very easy to aquire. Most of the time normal "small" folks like we are dont get such information from the companys that produce such cheap home gadgets.(maybe this is different if you have a big corp behind you)

              So, in this case, it may be better trying to port modemmanager to devd or at leas reverse the meaning of the commands in the mm plugin. I have thought and even will look into this one, but it may be beyond my skills to archive that.

              So far im diggin through the source of the loncheer plugin and try to reverseeng the meanings of the init commands.
              AT+MODODR? for example means
              switch (mododr) {
                 case 1:
                     mode = MM_MODEM_GSM_ALLOWED_MODE_3G_ONLY;
                     break;
                 case 2:
              #thorstenK: not documented in plugin source, reasonable meaning from windows client: automatically selected, see pic in attachment.
                 case 4:
                     mode = MM_MODEM_GSM_ALLOWED_MODE_3G_PREFERRED;
                     break;
                 case 3:
                     mode = MM_MODEM_GSM_ALLOWED_MODE_2G_ONLY;

              and so on.

              But for me as a networking guy it would be for sure the best solution to just buy a freebsd supported stick and use that.

              at+mododr+psrat.png
              at+mododr+psrat.png_thumb
              mm-modem-longcheer-gsm.c.txt

              1 Reply Last reply Reply Quote 0
              • ?
                Guest
                last edited by

                … To be even more off topic now ... I will note the progress of understanding those initcommands here.
                so maybe another guy with a problem like this has it a bit easier....

                General information:

                modem-base.c ITU-T Recommendation T.32
                AT+GMR Product revision
                AT+GMM Product model
                AT+GMI  Product Manufractor
                ATI(x) GeneralInformation (hayes)
                ATE Echo 1 0 (command echo hayes)
                AT+GSN Product Serial

                But those ones were prefered by modemmanager: (same but defined in ITU-T Recommendation V.250)
                AT+CGSN Product Ser.
                AT+CGMR C-Revision
                AT+CGMM C-Model
                AT+CGMI  C-Manufractor
                AT+CRSM=176,28589,0,0,4 Get Administrative Date
                AT+CRSM=176,28486,0,0,17 Get Service Provider Name
                AT+CIMI  IMEI
                AT+CIND indicators like smsFULL
                AT+CGDCONT=? Get allowed cid Range for APNs
                AT+CPIN= Send Pin ,newpin
                AT+CSQ Signal quality 2...30 -109... -53 dBm
                AT+CGAP Capabilities
                Polling and steering

                as modem response AT+CREG Network registration information.
                AT+CREG?
                Note in Source - Some modems send CREGs from themselfs and dont like when polling them manually
                This command open and close serial ports on the modem-.
                AT+CREG=(1,2) Enable notification for Ports 1/2
                AT+COPS Register to Network umts / egprs ...
                AT+CMER=3,0,0,1 Enable CMER on secondary port
                AT+CPMS=ME SMS Storage location
                AT+CNMI=2,1,2,1,0 Enable SMS Notification
                AT+CUSD=1 Enable CUSD Notification (unstructured supplementary Service)
                AT+CMEE=1 Initialize SIM (sounds good)!
                AT+CNUM Phonenumber

                Stop - found a reference to some Standard in the source called
                3GPP TS 27.007 (9.1)
                woooh...  stopping now... and trying to play around abit....

                PS: These are proprietary:
                AT+PSRAT NetworkType (HSDPA...)
                AT+MODODR Allowed Technologies (2G,3G,Auto)

                ......SnipSnap......surfing with lynx is quite strange....:=)

                192.168.116.png
                192.168.116.png_thumb
                pfSense_XS_STICK.png
                pfSense_XS_STICK.png_thumb

                1 Reply Last reply Reply Quote 0
                • ?
                  Guest
                  last edited by

                  It wooorks ™  :-*   and i have to rewrite, because i deleted the post wt lynx :(

                  So - i found out, how to handle it. This is good. The key is to first reset the modem when its already initialized.
                  i could'nt see that in the logs, because mm had no reason to do so.

                  And maybe its better to not post how i did it, because i did not fully understand exactly why its working yet.
                  I will search the specs and document the above attentions with information from the specs.

                  If you are curious- they can be found here:

                  http://www.3gpp.org/ftp/Specs/html-info/27007.htm

                  NOTE: This might (or should) work for other modems too which wont work by now with standard hayes init methods.
                  If you are lost and want to play with it -please pm me.
                  I use etc/ppp/ppp.conf and ppp, so this is a bit "around" normal pfsense methods.

                  1 Reply Last reply Reply Quote 0
                  • ?
                    Guest
                    last edited by

                    (Update) Finally - everything runs !

                    Now, that i know more why its running, i noticed, that i had just to activate the pin request, physically un and replug the modem after switching it to vmware and gone (with just sending the pin) … batsch

                    It works with this chatscript, because it resets the modem with the first commands too.  (Case PIN_Deactivated) gngn... But - anyway - if someone out there ever has to use a proprietary / generic 3/4g modem just with chat scripts, then he can make use of this configuration.....

                    set dial "ABORT BUSY TIMEOUT 5
                           ""
                           AT OK-AT-OK
                           AT+CPIN? READY-AT+CPIN=\"0000\"-OK   #Send Pin in PINactivated case
                           AT OK \                                #Sendig Pin takes some Time. Optional but useful when viewing the log
                           AT+CREG=0 OK-AT-OK \          # reset modem when pin is deactivated (and running under vmware)
                           AT+CGREG=0 OK-AT-OK
                           AT+CMER=0 OK-AT-OK
                           AT+CMEE=1 OK-AT-OK \         # Initialize Modem in case pin deact
                           AT+IFC=1 OK
                           AT+CPMS=\"ME\" OK \        # SMS Storage - optional
                           AT+CREG=2 OK \                    # Enable diag port
                           AT+COPS=3,2;+COPS OK \       # put info on diag port optional
                           AT+CSCS=\"UCS2\" OK \     # Force UCS2 Net type - optional
                           AT+PSRAT OK\                      # XS proprietary Network information optional
                           AT+MODODR=2 OK \                # XS proprietary Choose Automatically between HSDPA/HSUPA...
                           ATD99**1# CONNECT"        # connect to apn 1 (web.vodafone in my case)

                    Note: XS Stick answers to pin ready requests (AT+CPIN?) with READY and does not like AT+CPIN=?)  
                    so i adapted pfSenses /var/etc/mpd.script for case Pin_Activated

                    http://forum.pfsense.org/index.php/topic,49392.msg261874.html#msg261874

                    Anyway - Now, i can use pfSense as a virtualized Firewall for my win7 host :=)

                    win7_via_pfsense_vmware.png
                    win7_via_pfsense_vmware.png_thumb

                    1 Reply Last reply Reply Quote 0
                    • stephenw10S
                      stephenw10 Netgate Administrator
                      last edited by

                      Nice.  :)
                      Lots of useful info there.

                      Steve

                      1 Reply Last reply Reply Quote 0
                      • R
                        ryates
                        last edited by

                        @stephenw10:

                        Many of these '4G' modems can be brought up as either a standard modem, that responds to dial-up etc, or as a usb ethernet device, no need to use any AT commands. You might investigate that.

                        Steve

                        Any pointers for the usb ethernet device route under FreeBSD?

                        Thanks

                        1 Reply Last reply Reply Quote 0
                        • stephenw10S
                          stephenw10 Netgate Administrator
                          last edited by

                          You could follow this thread:
                          http://forum.pfsense.org/index.php/topic,48780.0.html
                          That involves such a device.

                          Steve

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.