Navigation

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

    Useful 3G modem 'mode switching' script

    General pfSense Questions
    4
    52
    28553
    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.
    • J
      jamesc last edited by

      Yes, i think K3565 is just the Vodafone model number, its actually an E169 underneath. Have you managed to get it to switch?

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

        Nope!  ::)

        
        [2.0.1-RELEASE][root@pfsense.fire.box]/dev(24): usb_modeswitch -c /tmp/e169.txt
        
        Looking for target devices ...
         No devices in target mode or class found
        Looking for default devices ...
           found matching product ID
         No devices in default mode found. Nothing to do. Bye.
        
        [2.0.1-RELEASE][root@pfsense.fire.box]/dev(25): cat /tmp/e169.txt
        # Huawei E169 and others
        #
        # Contributor: Dale Lane
        
        DefaultVendor=  0x12d1
        DefaultProduct= 0x1001
        
        TargetClass=    0xff
        
        # choose one of these:
        HuaweiMode=1
        
        

        Steve

        Edit: Seems to be because it's already in the target class (0xff):

        
        Looking for target devices ...
         No devices in target mode or class found
        Looking for default devices ...
          searching devices, found USB ID 12d1:1001
           found matching vendor ID
           found matching product ID
           target class ff matching
           not adding device
          searching devices, found USB ID 0000:0000
          searching devices, found USB ID 0000:0000
          searching devices, found USB ID 0000:0000
         No devices in default mode found. Nothing to do. Bye.
        
        

        Possibly already switched?  :-\

        Doh! looks like E169 is already a supported modem.  ::)

        1 Reply Last reply Reply Quote 0
        • J
          jamesc last edited by

          Looks that way, your console output when you plug the device in doesnt say that its a SCSI device so its already switched!

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

            Yep, already works fine.

            
            [2.0.1-RELEASE][root@pfsense.fire.box]/root(1): cu -l cuaU0.0 -s 115200
            Connected
            at
            OK
            at I0
            Manufacturer: huawei
            Model: K3565
            Revision: 11.608.10.51.00
            IMEI: 359574032708530
            +GCAP: +CGSM,+DS,+ES
            
            OK
            
            

            Steve

            1 Reply Last reply Reply Quote 0
            • J
              jamesc last edited by

              I'll give the ZTE a try on Sunday, ive tried this modem previously with pfSense and failed because it is definately seen as a storage device. Will report back with my results.

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

                You might think that but here is the system log from when I plugged it in:

                
                Feb 17 18:16:17 pfsense kernel: ugen2.2: <huawei technology="">at usbus2
                Feb 17 18:16:17 pfsense kernel: ugen2.2: <huawei technology="">at usbus2 (disconnected)
                Feb 17 18:16:24 pfsense kernel: ugen2.2: <huawei technology="">at usbus2
                Feb 17 18:16:24 pfsense kernel: u3g0: <huawei 0="" 2="" technology="" huawei="" mobile,="" class="" 0,="" rev="" 2.00="" 0.00,="" addr="">on usbus2
                Feb 17 18:16:24 pfsense kernel: u3g0: Found 3 ports.
                Feb 17 18:16:24 pfsense kernel: umass0: <huawei 0="" 2="" technology="" huawei="" mobile,="" class="" 0,="" rev="" 2.00="" 0.00,="" addr="">on usbus2
                Feb 17 18:16:26 pfsense kernel: umass1: <huawei 0="" 2="" technology="" huawei="" mobile,="" class="" 0,="" rev="" 2.00="" 0.00,="" addr="">on usbus2
                Feb 17 18:16:26 pfsense kernel: (probe0:umass-sim0:0:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0
                Feb 17 18:16:26 pfsense kernel: (probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
                Feb 17 18:16:26 pfsense kernel: (probe0:umass-sim0:0:0:0): SCSI status: Check Condition
                Feb 17 18:16:26 pfsense kernel: (probe0:umass-sim0:0:0:0): SCSI sense: NOT READY asc:3a,0 (Medium not present)
                Feb 17 18:16:26 pfsense kernel: cd0 at umass-sim0 bus 0 scbus0 target 0 lun 0
                Feb 17 18:16:26 pfsense kernel: cd0: <huawei mass="" storage="" 2.31="">Removable CD-ROM SCSI-2 device
                Feb 17 18:16:26 pfsense kernel: cd0: 40.000MB/s transfers
                Feb 17 18:16:26 pfsense kernel: cd0: Attempt to query device size failed: NOT READY, Medium not present
                Feb 17 18:16:27 pfsense kernel: (probe0:umass-sim1:1:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0
                Feb 17 18:16:27 pfsense kernel: (probe0:umass-sim1:1:0:0): CAM status: SCSI Status Error
                Feb 17 18:16:27 pfsense kernel: (probe0:umass-sim1:1:0:0): SCSI status: Check Condition
                Feb 17 18:16:27 pfsense kernel: (probe0:umass-sim1:1:0:0): SCSI sense: NOT READY asc:3a,0 (Medium not present)
                Feb 17 18:16:27 pfsense kernel: da0 at umass-sim1 bus 1 scbus1 target 0 lun 0
                Feb 17 18:16:27 pfsense kernel: da0: <huawei mmc="" storage="" 2.31="">Removable Direct Access SCSI-2 device
                Feb 17 18:16:27 pfsense kernel: da0: 40.000MB/s transfers
                Feb 17 18:16:27 pfsense kernel: da0: Attempt to query device size failed: NOT READY, Medium not present</huawei></huawei></huawei></huawei></huawei></huawei></huawei></huawei> 
                

                It clearly comes up as a CD-ROM drive (cd0) and the micro SD reader (da0).
                But u3g also shows 'found 3 ports' and looking in /dev there are cuaU0.0 1.1 and 2.2.
                I haven't actually tried using this as a modem though, I'm not sure I have a simcard that can do it.

                Steve

                1 Reply Last reply Reply Quote 0
                • J
                  jamesc last edited by

                  We have some progress….

                  Fresh install of 2.0.1 full on an old Celeron box to avoid mapping USB devices through to a VMWare VM.
                  Modem is a ZTE MF112

                  Here's what happens initially when plugging the modem in (not using modeswitch)

                  Feb 19 15:55:56 pfSense kernel: umass0: <zte,incorporated 0="" 2="" zte="" wcdma="" technologies="" msm,="" class="" 0,="" rev="" 2.00="" 0.00,="" addr="">on usbus3
                  Feb 19 15:55:56 pfSense kernel: umass0:  SCSI over Bulk-Only; quirks = 0x0000
                  Feb 19 15:55:57 pfSense kernel: umass0:0:0:-1: Attached to scbus0
                  Feb 19 15:55:57 pfSense kernel: (probe0:umass-sim0:0:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0
                  Feb 19 15:55:57 pfSense kernel: (probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
                  Feb 19 15:55:57 pfSense kernel: (probe0:umass-sim0:0:0:0): SCSI status: Check Condition
                  Feb 19 15:55:57 pfSense kernel: (probe0:umass-sim0:0:0:0): SCSI sense: NOT READY asc:3a,0 (Medium not present)
                  Feb 19 15:55:57 pfSense kernel: cd0 at umass-sim0 bus 0 scbus0 target 0 lun 0
                  Feb 19 15:55:57 pfSense kernel: cd0: <hspa usb="" scsi="" cd-rom="" 2.31="">Removable CD-ROM SCSI-2 device
                  Feb 19 15:55:57 pfSense kernel: cd0: 40.000MB/s transfers
                  Feb 19 15:55:57 pfSense kernel: cd0: Attempt to query device size failed: NOT READY, Medium not present</hspa></zte,incorporated> 
                  

                  No interfaces are available to assign under PPP.

                  I then install the port and create a config file for the MF112 and run modeswitch

                  Looking for target devices ...
                   No devices in target mode or class found
                  Looking for default devices ...
                     found matching product ID
                     adding device
                   Found device in default mode, class or configuration (1)
                  Accessing device 005 on bus 000 ...
                  Getting the current device configuration ...
                   OK, got current device configuration (1)
                  Using first interface: 0x00
                  Using endpoints 0x01 (out) and 0x81 (in)
                  Inquiring device details; driver will be detached ...
                   Cant't do driver detection and detaching on this platform.
                  
                  SCSI inquiry data (for identification)
                  -------------------------
                    Vendor String: HSPA
                     Model String: USB SCSI CD-ROM
                  Revision String: 2.31
                  -------------------------
                  
                  USB description data (for identification)
                  -------------------------
                  Manufacturer: ZTE,Incorporated
                       Product: ZTE WCDMA Technologies MSM
                    Serial No.: P673A3H3GD010000
                  -------------------------
                  Setting up communication with interface 0
                  Using endpoint 0x01 for message sending ...
                  Trying to send message 1 to endpoint 0x01 ...
                   OK, message successfully sent
                  Reading the response to message 1 (CSW) ...
                   OK, response successfully read (13 bytes).
                  Trying to send message 2 to endpoint 0x01 ...
                   OK, message successfully sent
                  Reading the response to message 2 (CSW) ...
                   Response reading got error -6
                   Device is gone, skipping any further commands
                  -> Run lsusb to note any changes. Bye.
                  
                  

                  I then have two new PPP interfaces /dev/cuaU0.1 and /dev/cuaU0.2

                  Unfortunately, I have no simcard to test any further :(

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

                    Ah, looks promising.  :)
                    You can try talking to the modem with cu or tip like I did. If it responds to AT commands I would expect it to work.

                    Steve

                    1 Reply Last reply Reply Quote 0
                    • J
                      jamesc last edited by

                      The next thing to try is adding the below line to the firewall config to test whether pfSense will switch the modem before it does the PPP dial:

                      <shellcmd>usb_modeswitch -c /usr/local/etc/modem.txt</shellcmd>

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

                        If not then try <earlyshellcmd>instead.

                        Steve</earlyshellcmd>

                        1 Reply Last reply Reply Quote 0
                        • J
                          jamesc last edited by

                          It does respond to AT commands on cuaU0.2  :)

                          My question is, what is cuaU0.1 which is also available to assign under PPP

                          Also, when I assign the PPP to an interface, I also see cuaU0.0 and cuau0 in the 'Modem Port' dropdown list so i'm a little confused  ???

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

                            Probably due to the way pfSense finds the serial ports to display:

                            $serialports = pfSense_get_modem_devices();
                            
                            

                            I can't find that function but if it relies on, for example, sysctl dev.u3g then they won't appear there.

                            The reason that the modem provides several serial ports is not obvious to me but it seems it's possible to get stats from the modem on one interface whilst connected via another, signal strength, baud rate etc.

                            Steve

                            1 Reply Last reply Reply Quote 0
                            • J
                              jamesc last edited by

                              Thanks Steve.

                              I found a simcard, there's no credit on it but it still connects and gets an IP address.

                              I've tried both the shellcmd and earlyshellcmd options but sometimes there is a delay until the actual switch occurs.  The boot sequence continues regardless, the PPP interface is brought up but the modem is not yet ready so a WAN connection isn't established.  If I go into the GUI and manually hit connect, PPP is dialled and the WAN comes online.

                              Any idea of how we can delay bringing up PPP until we know the modem has successfully switched?

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

                                What happens when it tries to dial out before the interface is switched?
                                I'm surprised that it doesn't just keep trying.
                                Maybe using dial-on demand or idle time out.

                                You could write a script that ran usb_modeswitch, waited and then called the appropriate interface connect function.

                                Steve

                                1 Reply Last reply Reply Quote 0
                                • J
                                  jamesc last edited by

                                  It doesnt do anything, the box continues its boot process as if no modem was plugged in. I see the modem details flash up on the console towards the end of the boot process but PPP has already initialised at this point (without seeing the modem) so i suspect it wont keep on attempting a dial out because as far it's concerned, no modem was detected at the time of initialisation, I hope that makes sense!

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

                                    Yes I see exactly what you mean.
                                    Would probably be best to use an rc script then.
                                    This is just a guess but perhaps:

                                    
                                    #!/bin/sh
                                    /usr/local/sbin/usb_modeswitch -c yourmodem.txt
                                    sleep 5
                                    /etc/rc.reload_interfaces
                                    
                                    

                                    Try issuing a /etc/rc.reload_interfaces and see if it finds the modem and connects.

                                    Steve

                                    1 Reply Last reply Reply Quote 0
                                    • J
                                      jamesc last edited by

                                      I had just finished creating a similar script and was looking for a command that would restart PPP, the reload_interfaces seems to do the trick nicely, thank you.

                                      1 Reply Last reply Reply Quote 0
                                      • J
                                        jly2680 last edited by

                                        how can i put my usbmode_switch script in startup??i have bandluxe 21 mbps 3g modem and successfully flip it to modem mode using usb_modeswitch..I want to connect my modem's ppp  in start up..thanks

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

                                          If it's an RC script, as I detailed above, put it in /usr/local/etc/rc.d and it will run at boot.

                                          Steve

                                          1 Reply Last reply Reply Quote 0
                                          • J
                                            jly2680 last edited by

                                            i already put my script in /usr/local/etc/rc.d/ but when i reboot pfsense,,ppp dials in fiirst before flipping my usb modem,thus i need to dial my ppp manually..i want to flip my modem first then ppp dials in..TIA

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

                                              Yes Jamesc experienced that problem above.
                                              Doesn't it redial when you reload the interfaces in the script?

                                              Steve

                                              1 Reply Last reply Reply Quote 0
                                              • J
                                                jly2680 last edited by

                                                thanks..reload interfaces did the trick..now i will add 1 more different usb modem.. :)

                                                1 Reply Last reply Reply Quote 0
                                                • J
                                                  jly2680 last edited by

                                                  problem occurs: persistent disconnections..i cant make my modem to hold for an hour or so..my ppp connection disconnects  every 10 seconds..i try to use my 3g modem directly with my laptop but never had a connection hangup..

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

                                                    Is it exactly 10 seconds every time? This might indicate some sort of ppp error. Or more random?
                                                    What do you see in the logs? Does it do this if you setup the connection manually instead of using the script?
                                                    Have you set the PPP session to be 'always on' (idle timeout = 0, which is the default setting)

                                                    using rc.reload_interfaces seemed a bit crude when I suggested it earlier and it still does. It maybe that it is causing some other undesired consequence. It would be much better to simply reload WAN or indeed just have it redial. Sadly I'm not sufficiently familiar with the code to suggest anything better.  :(

                                                    Steve

                                                    Edit: rc.linkup WAN up (or should that be 'up WAN') perhaps?  :-\ Complete guesswork!

                                                    1 Reply Last reply Reply Quote 0
                                                    • J
                                                      jly2680 last edited by

                                                      i think ppp error side?

                                                      Mar 5 23:07:52	ppp: [opt2] IPCP: SendConfigReq #3
                                                      Mar 5 23:07:52	ppp: [opt2] IPADDR 176.225.134.77
                                                      Mar 5 23:07:52	ppp: [opt2] IPCP: rec'd Configure Ack #3 (Ack-Sent)
                                                      Mar 5 23:07:52	ppp: [opt2] IPADDR 176.225.134.77
                                                      Mar 5 23:07:52	ppp: [opt2] IPCP: state change Ack-Sent --> Opened
                                                      Mar 5 23:07:52	ppp: [opt2] IPCP: LayerUp
                                                      Mar 5 23:07:52	ppp: [opt2] 176.225.134.77 -> 10.0.0.1
                                                      Mar 5 23:07:52	ppp: [opt2] IFACE: Up event
                                                      Mar 5 23:08:36	ppp: Multi-link PPP daemon for FreeBSD
                                                      Mar 5 23:08:36	ppp:
                                                      Mar 5 23:08:36	ppp: process 28199 started, version 5.5 (root@FreeBSD_8.0_pfSense_2.0-snaps.pfsense.org 10:25 12-Oct-2011)
                                                      Mar 5 23:08:36	ppp: caught fatal signal term
                                                      Mar 5 23:08:36	ppp: [opt2] IFACE: Close event
                                                      Mar 5 23:08:36	ppp: [opt2] IPCP: Close event
                                                      Mar 5 23:08:36	ppp: [opt2] IPCP: state change Opened --> Closing
                                                      Mar 5 23:08:36	ppp: [opt2] IPCP: SendTerminateReq #4
                                                      Mar 5 23:08:36	ppp: [opt2] IPCP: LayerDown
                                                      Mar 5 23:08:36	ppp: waiting for process 16679 to die...
                                                      Mar 5 23:08:36	ppp: [opt2] IFACE: Down event
                                                      Mar 5 23:08:36	ppp: [opt2] IPCP: rec'd Terminate Ack #4 (Closing)
                                                      Mar 5 23:08:36	ppp: [opt2] IPCP: state change Closing --> Closed
                                                      Mar 5 23:08:36	ppp: [opt2] IPCP: LayerFinish
                                                      Mar 5 23:08:36	ppp: [opt2] Bundle: No NCPs left. Closing links...
                                                      Mar 5 23:08:36	ppp: [opt2] Bundle: closing link "opt2_link0"...
                                                      Mar 5 23:08:36	ppp: [opt2_link0] Link: CLOSE event
                                                      Mar 5 23:08:36	ppp: [opt2_link0] LCP: Close event
                                                      Mar 5 23:08:36	ppp: [opt2_link0] LCP: state change Opened --> Closing
                                                      Mar 5 23:08:36	ppp: [opt2_link0] Link: Leave bundle "opt2"
                                                      Mar 5 23:08:36	ppp: [opt2] Bundle: Status update: up 0 links, total bandwidth 9600 bps
                                                      Mar 5 23:08:36	ppp: [opt2] IPCP: Close event
                                                      Mar 5 23:08:36	ppp: [opt2] IPCP: Down event
                                                      Mar 5 23:08:36	ppp: [opt2] IPCP: state change Closed --> Initial
                                                      Mar 5 23:08:36	ppp: [opt2_link0] LCP: SendTerminateReq #3
                                                      Mar 5 23:08:36	ppp: [opt2_link0] LCP: LayerDown
                                                      Mar 5 23:08:36	ppp: [opt2_link0] LCP: rec'd Terminate Ack #3 (Closing)
                                                      Mar 5 23:08:36	ppp: [opt2_link0] LCP: state change Closing --> Closed
                                                      Mar 5 23:08:36	ppp: [opt2_link0] LCP: LayerFinish
                                                      Mar 5 23:08:36	ppp: [opt2_link0] Link: DOWN event
                                                      Mar 5 23:08:36	ppp: [opt2_link0] LCP: Down event
                                                      Mar 5 23:08:36	ppp: [opt2_link0] LCP: state change Closed --> Initial
                                                      
                                                      1 Reply Last reply Reply Quote 0
                                                      • J
                                                        jly2680 last edited by

                                                        /etc/rc.reload_interfaces in my script causes my 3g ppp connection to restart every 10-20 secs..

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

                                                          Can you show us your script?
                                                          It should only be run once at boot, I can't see how it could possibly effect the ppp cycling time.  :-\

                                                          Steve

                                                          1 Reply Last reply Reply Quote 0
                                                          • J
                                                            jly2680 last edited by

                                                            #!/bin/sh
                                                            /usr/local/sbin/usb_modeswitch usb_modeswitch -v 1a8d -p 2000 -M "5553424312345678000000000000061e000000000000000000000000000000" -2 "5553424312345679000000000000061b000000020000000000000000000000" -n 1 -W
                                                            sleep 5
                                                            /etc/rc.reload_interfaces
                                                            

                                                            removing reload interfaces makes my 3g ppp connection stable..is there a place where my script will run first then ppp dials in?or to restart ppp connection after my script run?
                                                            i can easily do this with openwrt/ddwrt but i want to try pfsense..

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

                                                              The code in /usr/local/etc.rc.d should only be run once as far as I know.
                                                              You could try calling the script using shellcmd or earlyshellcmd instead:
                                                              http://doc.pfsense.org/index.php/Executing_commands_at_boot_time

                                                              Steve

                                                              1 Reply Last reply Reply Quote 0
                                                              • J
                                                                jly2680 last edited by

                                                                thanks,,same thing it doesnt auto connect on boot even if i edit my xml with earlyshellcmd or shellcmd..
                                                                on openwrt,,i usually put my script in /etc/rc.local and run a cron job with a watchdog scripts,,it automatically restart my 3g interface when ppp hangs up.hope i can do same thing on pfsense.am total noob with pfsense thats why im still catching up with it..

                                                                1 Reply Last reply Reply Quote 0
                                                                • T
                                                                  th3r3isnospoon last edited by

                                                                  Hello,

                                                                  I'd really like to get this feature working on my pfSense box.

                                                                  I read through this thread 3 times but, I don't see how to go about actually installing the port or using one of your scripts.

                                                                  If you have a minute or two, can you just throw together a how-to so I can take the necessary steps to get this to work?  I'd really appreciate it!

                                                                  Thank you!

                                                                  -th3r3isnospoon

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

                                                                    Ok, this may have to be multipart as I'm pushed for time!  ::)

                                                                    First check the usb-modeswitch forum/website to see if your modem is supported at all:
                                                                    http://www.draisberghof.de/usb_modeswitch/
                                                                    Note down any relevant switching code that other users may have posted if it's not included as standard in device_reference.txt:
                                                                    http://www.draisberghof.de/usb_modeswitch/device_reference.txt

                                                                    Install the FreeBSD package in pfSense. This will vary depending on your pfSense version.
                                                                    For 2.0.X NanoBSD:

                                                                    
                                                                    /etc/rc.conf_mount_rw
                                                                    pkg_add -r ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/Latest/usb_modeswitch.tbz
                                                                    /etc/rc.conf_mount_ro
                                                                    
                                                                    

                                                                    For 2.0.X full install:

                                                                    
                                                                    pkg_add -r ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/Latest/usb_modeswitch.tbz
                                                                    
                                                                    

                                                                    Now depending on what the required code for your modem is you can either just enter it at the command line directly, e.g.:

                                                                    
                                                                    /usr/local/sbin/usb_modeswitch usb_modeswitch -v 1a8d -p 2000 -M "5553424312345678000000000000061e000000000000000000000000000000" -2 "5553424312345679000000000000061b000000020000000000000000000000" -n 1 -W
                                                                    
                                                                    

                                                                    or call a file containing the appropriate section from device_reference.txt (or some custom code), e.g.:

                                                                    /usr/local/sbin/usb_modeswitch -c yourmodem.txt
                                                                    

                                                                    You can run it with -h to list the command line options:

                                                                    /usr/local/sbin/usb_modeswitch -h
                                                                    

                                                                    If you get it right usb_modeswitch will report success and you will see some lines in the pfSense log showing devices removed and attached.

                                                                    If you have found the code to correctly switch your modem you can put a script file in /usr/local/etc/rc.d.
                                                                    Call it whateveryouwant.sh:

                                                                    
                                                                    #!/bin/sh
                                                                    /usr/local/sbin/usb_modeswitch -c yourmodem.txt
                                                                    sleep 5
                                                                    /etc/rc.reload_interfaces
                                                                    
                                                                    

                                                                    I am still of the opinion that /etc/rc.reload_interfaces is probably not the correct way to get the modem running, it seems too crude, but it worked for jamesc.

                                                                    Steve

                                                                    1 Reply Last reply Reply Quote 0
                                                                    • T
                                                                      th3r3isnospoon last edited by

                                                                      You sir are a gentleman and scholar.  I really appreciate this.

                                                                      I will try this out, this evening and report back.

                                                                      THANK YOU!

                                                                      -th3r3isnospoon.

                                                                      1 Reply Last reply Reply Quote 0
                                                                      • T
                                                                        th3r3isnospoon last edited by

                                                                        Hey,

                                                                        Here is what I have so far:

                                                                        My modem settings (att G10461) :
                                                                        ########################################################

                                                                        Option iCon 461

                                                                        Contributor: Samit Basu

                                                                        DefaultVendor=  0x0af0
                                                                        DefaultProduct= 0x7a05

                                                                        TargetClass=    0xff

                                                                        MessageContent="55534243123456780000000000000601000000000000000000000000000000"

                                                                        My specific command I ran:

                                                                        /usr/local/sbin/usb_modeswitch usb_modeswitch -v 0af0 -p 7a05 -C 0xff -M "55534243123456780000000000000601000000000000000000000000000000" -n 1 -W
                                                                        

                                                                        My Results:
                                                                        [2.0.1-RELEASE][admin@local.loc]/root(1): /usr/local/sbin/usb_modeswitch usb_modeswitch -v 0af0 -p 7a05 -C 0xff -M "55534243123456780000000000000601000000000000000000000000000000" -n 1 -W
                                                                        Taking all parameters from the command line

                                                                        • usb_modeswitch: handle USB devices with multiple modes
                                                                        • Version 1.2.1 (C) Josua Dietze 2011
                                                                        • Based on libusb0 (0.1.12 and above)

                                                                        ! PLEASE REPORT NEW CONFIGURATIONS !

                                                                        DefaultVendor=  0x0af0
                                                                        DefaultProduct= 0x7a05
                                                                        TargetVendor=  not set
                                                                        TargetProduct=  not set
                                                                        TargetClass=    0xff
                                                                        TargetProductList=""

                                                                        DetachStorageOnly=0
                                                                        HuaweiMode=0
                                                                        SierraMode=0
                                                                        SonyMode=0
                                                                        QisdaMode=0
                                                                        GCTMode=0
                                                                        KobilMode=0
                                                                        SequansMode=0
                                                                        MobileActionMode=0
                                                                        CiscoMode=0
                                                                        MessageEndpoint=  not set
                                                                        MessageContent="55534243123456780000000000000601000000000000000000000000000000"
                                                                        NeedResponse=1
                                                                        ResponseEndpoint= not set

                                                                        InquireDevice enabled (default)
                                                                        Success check disabled
                                                                        System integration mode disabled

                                                                        Looking for target devices …
                                                                        No devices in target mode or class found
                                                                        Looking for default devices ...
                                                                          searching devices, found USB ID 0af0:7a05
                                                                          found matching vendor ID
                                                                          found matching product ID
                                                                          target class ff not matching
                                                                          adding device
                                                                          searching devices, found USB ID 0000:0000
                                                                          searching devices, found USB ID 0000:0000
                                                                          searching devices, found USB ID 0000:0000
                                                                          searching devices, found USB ID 0000:0000
                                                                          searching devices, found USB ID 0000:0000
                                                                        Found device in default mode, class or configuration (1)
                                                                        Accessing device 006 on bus 000 ...
                                                                        Getting the current device configuration ...
                                                                        OK, got current device configuration (1)
                                                                        Using first interface: 0x00
                                                                        Using endpoints 0x01 (out) and 0x81 (in)
                                                                        Inquiring device details; driver will be detached ...
                                                                        Cant't do driver detection and detaching on this platform.

                                                                        SCSI inquiry data (for identification)

                                                                        Vendor String: ZCOption
                                                                          Model String: HSUPA Modem
                                                                        Revision String:

                                                                        USB description data (for identification)

                                                                        Manufacturer: Option N.V.
                                                                            Product: Globetrotter HSUPA Modem
                                                                          Serial No.: Serial Number

                                                                        Setting up ugen4.2: <option n.v.="">at usbus4 (disconnected)
                                                                        umass0: at uhub4, port 2, addr 2 (disconnected)
                                                                        communication wi(cd0:umass-sim0:0:0:0): lost device
                                                                        (cd0:umass-sim0:0:0:0): removing device entry
                                                                        th interface 0
                                                                        Using endpoint 0x01 for message sending ...
                                                                        Trying to send message 1 to endpoint 0x01 ...
                                                                        OK, message successfully sent
                                                                        Reading the response to message 1 (CSW) ...
                                                                        OK, response successfully read (13 bytes).
                                                                        Resetting response endpoint 0x81
                                                                        Resetting message endpoint 0x01
                                                                        -> Run lsusb to note any changes. Bye.

                                                                        [2.0.1-RELEASE][admin@local.loc]/root(2): ugen4.2:</option> <option n.v.="">at usbus4
                                                                        umass0:</option> <option 2="" n.v.="" globetrotter="" hsupa="" modem,="" rev="" 2.00="" 0.00,="" addr="">on usbus4
                                                                        (probe0:umass-sim0:0:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0
                                                                        (probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
                                                                        (probe0:umass-sim0:0:0:0): SCSI status: Check Condition
                                                                        (probe0:umass-sim0:0:0:0): SCSI sense: NOT READY asc:3a,0 (Medium not present)
                                                                        da0 at umass-sim0 bus 0 scbus0 target 0 lun 0
                                                                        da0: <sd hsupa="" modem="">Removable Direct Access SCSI-2 device
                                                                        da0: 40.000MB/s transfers
                                                                        da0: Attempt to query device size failed: NOT READY, Medium not present

                                                                        When I go to see if I can add a PPP interface, still none are listed.  What should I change in order to make it work?
                                                                        I'm so close, I can feel it!!

                                                                        Thank you!

                                                                        -th3r3isnospoon</sd></option>

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

                                                                          Hmm, yes you are close. I have to say that I have only played with this a little and mostly under Ubuntu and that was a few years ago!
                                                                          My own modem turned out to be supported by u3g on FreeBSD so I didn't need usb_modeswitch.

                                                                          Does your modem have an SD card slot?

                                                                          It looks like it's doing it's thing. From the log you see it has removed the virtual cd drive and you can see it receives the '1' response it's looking for.

                                                                          From memory the creation of a new serial port does not generate any log entries which is why I initially thought my modem wasn't working.

                                                                          Check the contents of /dev.
                                                                          There are two ways in which serial ports are represented by FreeBSD and both are shown just to confuse you. Here is the output from my box before I connect my modem:

                                                                          
                                                                          [2.0.1-RELEASE][root@pfsense.fire.box]/dev(2): ls
                                                                          ad0        ata        cuau0      devctl     klog       mem        ptmx       stdout     ttyu1.lock urandom
                                                                          ad0s1      bpf        cuau0.init devstat    kmem       nfslock    pts        ttyu0      ufs        usb
                                                                          ad0s1a     bpf0       cuau0.lock fd         led        null       random     ttyu0.init ufsid      usbctl
                                                                          ad0s2      console    cuau1      fido       md0        pci        speaker    ttyu0.lock ugen0.1    xpt0
                                                                          ad0s2a     crypto     cuau1.init geom.ctl   md1        pf         stderr     ttyu1      ugen1.1    zero
                                                                          ad0s3      ctty       cuau1.lock io         mdctl      ppi0       stdin      ttyu1.init ugen2.1
                                                                          
                                                                          

                                                                          And after:

                                                                          
                                                                          [2.0.1-RELEASE][root@pfsense.fire.box]/dev(3): ls
                                                                          ad0          console      cuaU0.2.init devstat      mdctl        pts          ttyU0.1.init ttyu1.lock   xpt0
                                                                          ad0s1        crypto       cuaU0.2.lock fd           mem          random       ttyU0.1.lock ufs          zero
                                                                          ad0s1a       ctty         cuau0        fido         nfslock      speaker      ttyU0.2      ufsid
                                                                          ad0s2        cuaU0.0      cuau0.init   geom.ctl     null         stderr       ttyU0.2.init ugen0.1
                                                                          ad0s2a       cuaU0.0.init cuau0.lock   io           pass0        stdin        ttyU0.2.lock ugen1.1
                                                                          ad0s3        cuaU0.0.lock cuau1        klog         pass1        stdout       ttyu0        ugen2.1
                                                                          ata          cuaU0.1      cuau1.init   kmem         pci          ttyU0.0      ttyu0.init   ugen2.2
                                                                          bpf          cuaU0.1.init cuau1.lock   led          pf           ttyU0.0.init ttyu0.lock   urandom
                                                                          bpf0         cuaU0.1.lock da0          md0          ppi0         ttyU0.0.lock ttyu1        usb
                                                                          cd0          cuaU0.2      devctl       md1          ptmx         ttyU0.1      ttyu1.init   usbctl
                                                                          
                                                                          

                                                                          cua and tty devices are all serial ports. Those with a capital 'U' in the name are USB connected serial ports. You can see that my modem add three serial ports.

                                                                          Steve

                                                                          1 Reply Last reply Reply Quote 0
                                                                          • First post
                                                                            Last post

                                                                          Products

                                                                          • Platform Overview
                                                                          • TNSR
                                                                          • pfSense Plus
                                                                          • Appliances

                                                                          Services

                                                                          • Training
                                                                          • Professional Services

                                                                          Support

                                                                          • Subscription Plans
                                                                          • Contact Support
                                                                          • Product Lifecycle
                                                                          • Documentation

                                                                          News

                                                                          • Media Coverage
                                                                          • Press
                                                                          • Events

                                                                          Resources

                                                                          • Blog
                                                                          • FAQ
                                                                          • Find a Partner
                                                                          • Resource Library
                                                                          • Security Information

                                                                          Company

                                                                          • About Us
                                                                          • Careers
                                                                          • Partners
                                                                          • Contact Us
                                                                          • Legal
                                                                          Our Mission

                                                                          We provide leading-edge network security at a fair price - regardless of organizational size or network sophistication. We believe that an open-source security model offers disruptive pricing along with the agility required to quickly address emerging threats.

                                                                          Subscribe to our Newsletter

                                                                          Product information, software announcements, and special offers. See our newsletter archive to sign up for future newsletters and to read past announcements.

                                                                          © 2021 Rubicon Communications, LLC | Privacy Policy