26

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

Nie łyka tej komendy: AT^SETPORT=A2;1,2,3,7,A2
ERROR

27

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

A po zmianie cudzysłowu na dwukropek?

28

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

AT^SETPORT=A2:1,2,3,7,A2-bez zmian.

29

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

A komendę AT^SETPORT=A1,A2;1,2,3,7,A1,A2 przyjmuje bez problemu?

30

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

Również error: AT^SETPORT=A1,A2;1,2,3,7,A1,A2
ERROR

31 (edytowany przez frutis 2012-03-29 20:42:37)

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

Dziwne. A komendy AT^U2DIAG=256 też nie łyka?

No tak złą składnie Ci podałem. Powinno być: AT^SETPORT="A2;1,2,3,7,A2"

32

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

frutis napisał/a:

Dziwne. A komendy AT^U2DIAG=256 też nie łyka?

No tak złą składnie Ci podałem. Powinno być: AT^SETPORT="A2;1,2,3,7,A2"

Uparty: AT^SETPORT="A2;1,2,3,7,A2"
ERROR
AT^U2DIAG=256
COMMAND NOT SUPPORT

33

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

Jeśli komendy AT^SETPORT="A1,A2;1,2,3,7,A1,A2" (lub AT^SETPORT="A1,A2:1,2,3,7,A1,A2") nie przyjmuje to niestety nie mam pojęcia jak coś ustawić w tym modemie.

34 (edytowany przez pepe_lodz 2012-04-01 16:57:37)

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

A może mi ktoś pomóc skonfigurować multiwan do obsługi łacza Kablowego WAN a jako zapasu łacza 3G. Mam nawet w LUCI doinstalowane MULTIWAN. Jednak jak zrestartuje router to nie majac MULTIWANU zainstalowanego bylo tak ze modem 3G chyba pierwszy sie laczył i jak z laptopa otwieralem interenet to szlo odrazu po 3G. Jednak chcialem aby szlo domyslnie po WAN. Mam wrazenie ze poprostu modem 3G szybciej uzyskuje dostep nic dostep na WAN przy uruchomieniu routera. Prosze o pomoc najlepiej krok po kroku jak poprawnie skonfigurowac to aby jako domyslen lacze bylo WAN a zapasowe w przypadku awarii dostawcy WAN lub fizycznego odlaczenia WAN przelaczylo sie automatycznie na 3G. Bede wdzieczny. Jestem poczatkujacy.

Aha dodam ze router to WR1043ND , modem E1820 i soft Backfire z interfacem LUCI.

Czy moj modem HUAWEI E1820 obsluhuje te tryb NDIS ?

35

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

A mój opis jest niewystarczający?

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

36 (edytowany przez pepe_lodz 2012-04-01 20:52:49)

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

Tylko na Twoim wedlug tego nie dziala mi cos...Nie przelacza mi poprostu.

Nie wiem tez jak przerobic w Backfire twoim aby modem sie laczyl przez NDIS... Zainstalowalem dodatkowy sterownik. Ale nie wiem jak zrobic aby to bylo zautomatyzowane jak za pomoca standardowych skryptow co byly odrazu dostepne w Backfire. Poprostu chcialbym aby dzialo sie to automatycznie. Tylko pewnie trzeba bedzie wylaczyc opcje laczenia sie po staremu ? Dobrze mysle ? Bo bedzie sie gryzc polaczenie NDIS z tym SERIALowym

I czy opis odnosnie 3ginfo bedzie dzialac gdy bede uzywac tego polaczenia NDIS?

37

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

Do świątecznego koszyczka wrzucam kolejne wersje skryptów:)

W skrypcie /bin/3gtester.sh dodałem priorytet zdarzenia  i przekierowałem komunikaty gcom do logu. Także zmieniłem cel ping-ów, może to być kilka domyślnych hostów a w przypadku gdy network w danym połączeniu zdefiniowane są DNS-s to one są ping-owane dla sprawdzenia czy połączenie żyje.

#!/bin/sh
# Establishing 3G modem connection in dialup or NDIS mode
# Script version 1.03 Rafal Drzymala 2012
#
# Changelog
#    1.00    RD    First stable code
#    1.01    RD    Prevent from parallel comgt/gcom execution
#    1.02    RD    Add logger priority, redirect comgt/gcom to logger
#    1.03    RD    Change ICMP monitoring, use device, multiwan or default dns
#
SCR=$(basename $0)
DEF_ICMP="8.8.8.8 8.8.4.4"
COMGT_APP="gcom"
NDISUP="/etc/gcom/ndisup.gcom"
WANS=$(uci show network | awk -F[.=] '{if (($3=="proto" && $4=="3g") || ($3=="ifname" && match($4,"usb[0-9]"))) print $2}')
for WAN in $WANS; do
    NDIS="N"
    [ $(uci -q get network.$WAN.proto) != "3g" ] && NDIS="Y"
    DEV_IFNAME=$(uci -q get network.$WAN.ifname)
    DEV_APN=$(uci -q get network.$WAN.apn)
    DEV_PINCODE=$(uci -q get network.$WAN.pincode)
    DEV_MODE=$(uci -q get network.$WAN.mode)
    [ "$NDIS" == "Y" ] && DEV_COMM=$(uci -q get network.$WAN.comm)
    [ "$NDIS" == "N" ] && DEV_COMM=$(uci -q get network.$WAN.device)
    DEV_AUTO="1"
    [ "$NDIS" == "N" ] && DEV_AUTO=$(uci -q get network.$WAN.auto)
    DEV_ICMP=$(uci -q get network.$WAN.dns)
    [ "$DEV_ICMP" == "" ] && DEV_ICMP=$(uci -q get multiwan.$WAN.dns)
    [ "$DEV_ICMP" == "" ] && DEV_ICMP=$DEF_ICMP
    logger -p user.notice -t $SCR "Checking $WAN for active connection"
    logger -p user.notice -t $SCR " interface=$DEV_IFNAME"
    logger -p user.notice -t $SCR " apn=$DEV_APN"
    logger -p user.notice -t $SCR " comm=$DEV_COMM"
    logger -p user.notice -t $SCR " icmp=$DEV_ICMP"
    [ "$DEV_MODE" != "" ] && logger -t $SCR " mode=$DEV_MODE"
    if [ "$DEV_AUTO" == "1" ]; then
        if [ -e $DEV_COMM ]; then
            for ICMP in $DEV_ICMP; do
                if ping -q -c 1 -W 2 -I $DEV_IFNAME $ICMP &>/dev/null; then
                    ICMP_OK=$ICMP
                    break
                fi
            done
            if [ "$ICMP_OK" != "" ]; then
                logger -p user.notice -t $SCR "ICMP successfully sent via $WAN to $ICMP_OK"
            else
                logger -p user.notice -t $SCR "Restarting $WAN connection"
                if [ "$NDIS" == "N" ]; then
                    (ifdown $WAN; sleep 2; ifup $WAN) &
                else
                    COMGT_DEV="-d $DEV_COMM"
                    COMGT_SCR="-s $NDISUP"
                    if pgrep -l -f "$COMGT_APP $COMGT_DEV $COMGT_SCR"> /dev/null; then
                        logger -p user.notice -t $SCR "Connection $WAN is already restarted"
                    elif pgrep -l -f "$COMGT_APP $COMGT_DEV"> /dev/null; then
                        logger -p user.notice -t $SCR "Device $DEV_COMM used by another instance of $COMGT_APP"
                    elif ([ "$DEV_COMM" == "/dev/ttyUSB2" ] || [ "$DEV_COMM" == "/dev/noz2" ] || [ "$DEV_COMM" == "/dev/modem" ]) && pgrep -l -f  "$COMGT_APP" | grep -q -v "\-d"> /dev/null; then
                        logger -p user.notice -t $SCR "Device $DEV_COMM used by another instance of $COMGT_APP"
                    else
                        (ifdown $WAN; PINCODE=$DEV_PINCODE APN=$DEV_APN MODE=$DEV_MODE $COMGT_APP $COMGT_DEV $COMGT_SCR | logger -p user.notice -t $COMGT_APP; sleep 2; ifup $WAN) &
                    fi
                fi
            fi
        else
            logger -p user.error -t $SCR "Device $DEV_COMM for $WAN not exist"
        fi
    fi
done
# Done

W skrypcie /etc/gcom/ndisup.gcom zmieniłem sposób wyświetlania poziomu sygnału (taki wodotrysk).

# cat >/etc/gcom/ndisup.gcom
opengt
    let $x="ndisup:"+$basename($dev())+" "
    print $x+"Establishing 3G modem connection in NDIS mode\n"
    print $x+"Script for comgt version 1.02 Rafal Drzymala 2012\n"
#
# Changelog
#    1.00    RD    First stable code
#    1.01    RD    Move "Getting received signal strength" section
#                Reset command changed from ATZ to ATZ0
#                Changed wait time for establish connection from 20 to 30 secs
#    1.02    RD    Changed signal level bar
#
# Modem succesfuly tested
# - HUAWEI E173        11.126.85.00.209
# Modem tested, not supported 
# - HUAWEI E160G    11.608.02.02.55
# - HUAWEI E160        11.604.09.00.00
# - HUAWEI E220
#
    set com 115200n81
    set ignorecase on
    set comecho off
    set senddelay 0.02

    let $a=$env("APN")
    let $m=$env("MODE")
    let $p=$env("PINCODE")

    if  $a = "" print $x+"APN environment var not specified\n" goto finish    
    let r1=1

:start
# Initializing communication with modem
    if r1=1 print $x+"Try to communicate with modem\n"
    if r1>1 print $x+"Again try to communicate with modem (",r1,")\n"
    waitquiet 2 0.5
    send "ATQ0; E0^m"
    waitfor 1 "OK"
    if % = -1 goto comm_timeout
    send "AT+CMEE=2^m"
    waitfor 1 "OK","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 2 waitquiet 1 0.5
    send "AT\^CURC=0^m"
    waitfor 1 "OK","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 2 waitquiet 1 0.5

# Getting device information
    print $x+"Getting device information\n"
    waitquiet 1 0.2 
    send "AT+CGMI^m"
    get 1 "^mOK^m" $i1
    if % != 0 goto comm_timeout
    waitquiet 1 0.1
    send "AT+CGMM^m"
    get 1 "^mOK^m" $i2
    if % != 0 goto comm_timeout
    waitquiet 1 0.1 
    send "AT+CGMR^m"
    get 1 "^mOK^m" $i3
    if % != 0 goto comm_timeout
    waitquiet 1 0.1
    send "AT+CGSN^m"
    get 1 "^mOK^m" $i4
    if % != 0 goto comm_timeout
    if len($i1)>1 let $i1=$right($i1,len($i1)-1)
    if len($i2)>1 let $i2=$right($i2,len($i2)-1)
    if len($i3)>1 let $i3=$right($i3,len($i3)-1)
    if len($i4)>1 let $i4=$right($i4,len($i4)-1)
    print $x+"- modem: "+$toupper($i1)+" "+$toupper($i2)+"\n"
    print $x+"- firmware: "+$i3+"\n"
    print $x+"- IMEI: "+$i4+"\n"
:end_devinfo

# Getting received signal strength
    print $x+"Getting received signal strength\n"
    send "AT+CSQ^m"
    waitfor 5 "+CSQ: ","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while getting received signal strength\n" goto end_sigstr
    if % = 2 gosub cme_error print $x+"Error "+$e+" while getting received signal strength\n" goto end_sigstr
    get 1 "," $i1
    if % != 0 goto comm_timeout
    get 1 "^mOK^m" $i2
    if % != 0 goto comm_timeout
    if $i1 = "99" print $x+"- signal strength: unknown\n" goto end_sigstr
    let s1=val($i1)
    let s2=(s1*2)-113 
    let s3=((s1*100000)/31000)
    print $x+"- signal strength: (",s1,"), ",s2," dBm, ",s3,"%\n"
    let s3=s3/2
    let $s3=$left("##################################################",s3)
    let $s3=$s3+$right("----1----2----3----5----5----6----7----8----9----$",50-s3)
    print $x+"- level: ["+$s3+"]\n"
:end_sigstr

# Checking modem for NDIS support
    print $x+"Checking modem for NDIS support\n"
    send "AT\^DIALMODE?^m" 
    waitfor 5 "\^DIALMODE:","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % > 0 print $x+"- This modem doesn't support NDIS mode\n" goto abort
    get 1 "^mOK^m" $i1
    if % != 0 goto comm_timeout
    let $i1=$left($i1,1)
    if $i1 = "1" goto ok_ndis_check
    if $i1 = "2" goto ok_ndis_check
    print $x+"- This modem doesn't support NDIS mode\n"
    goto abort
:ok_ndis_check
    print $x+"- NDIS mode is supported by this modem\n"
    waitquiet 1 1

# Checking for password input request
    print $x+"Checking for password input request\n"
    let u=0
    send "AT+CPIN?^m"
    waitfor 5 "+CPIN: ","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while checking for password input request\n" goto end_chkpin
    if % = 2 gosub cme_error print $x+"Error "+$e+" while checking for password input request\n" goto end_chkpin
    if % = 3 print $x+"Command not supported\n" goto end_chkpin
    get 1 "^mOK^m" $i1
    if % != 0 goto comm_timeout
    let $d="Unknown modem response ("+$i1+")"
    if $i1 = "READY" let $d="MT without password input request"
    if $i1 = "SIM PIN" let $d="UICC/SIM PIN password request"
    if $i1 = "SIM PUK" let $d="UICC/SIM PUK password request, to unblock the SIM PIN which was blocked for 3 verification failure"
    if $i1 = "SIM PIN2" let $d="PIN2 password request"
    if $i1 = "SIM PUK2" let $d="PUK2 password request, to unblock the SIM PIN2 which was blocked for 3 verification failure"
    if $i1 = "PH-SIM PIN" let $d="SIM lock (phone-to-SIM) is required"
    if $i1 = "PH-NET PIN" let $d="Network personnalisation is required"
    print $x+"- state: "+$d+"\n"
    if $i1 = "SIM PIN" goto do_pin_unlock
    if $i1 <> "READY" goto finish
:end_chkpin

# Unlock the PIN 
    goto end_pin_unlock
:do_pin_unlock
    print $x+"UICC/SIM unlocking by PIN\n"
    if $p = "" print $x+"PINCODE environment var not specified\n" goto abort
    send "AT+CPIN="+$p"^m"
    waitfor 5 "OK","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while unlocking by PIN\n" goto abort
    if % = 2 gosub cme_error print $x+"Error "+$e+" while unlocking by PIN\n" goto abort
    if % = 3 print $x+"Command not supported\n" goto end_chkpin
    print $x+"UICC/SIM unlocked successfully\n"
    let r2=0
:wait_for_reg
    let r2=r2+1
    if r2>5 print $x+"Number of retries exhausted\n" goto abort
    print $x+"Waiting for network registration (",r2,")\n"
    send "AT+CGREG=0; +CGREG?^m"
    waitfor 2 "+CGREG: ","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while getting network registration status\n" goto end_pin_unlock
    if % = 2 gosub cme_error print $x+"Error "+$e+" while getting network registration status\n" goto end_pin_unlock
    if % = 3 print $x+"Command not supported\n" goto end_pin_unlock
    get 1 "," $i1
    if % != 0 goto comm_timeout
    get 1 "^m^mOK^m" $i2
    if % != 0 goto comm_timeout
    let $d="Unknown modem response ("+$i2+")"
    if $i2 = "0" waitquiet 1 5 goto wait_for_reg
    if $i2 = "1" goto end_pin_unlock
    if $i2 = "2" waitquiet 1 5 goto wait_for_reg
    if $i2 = "3" let $d="Registration rejected"
    if $i2 = "4" let $d="Unknown reasons"
    if $i2 = "5" goto end_pin_unlock
    print $x+"- error: "+$d+"\n"
    goto abort
:end_pin_unlock

# Getting system information
:do_sysinfo
    print $x+"Getting system information\n"
    send "AT\^SYSINFO^m"
    waitfor 5 "\^SYSINFO:","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while getting system information\n" goto end_sysinfo
    if % = 2 gosub cme_error print $x+"Error "+$e+" while getting system information\n" goto end_sysinfo
    if % = 3 print $x+"Command not supported\n" goto end_sysinfo
    get 1 "," $i1
    if % != 0 goto comm_timeout
    get 1 "," $i2
    if % != 0 goto comm_timeout
    get 1 "," $i3
    if % != 0 goto comm_timeout
    get 1 "," $i4
    if % != 0 goto comm_timeout
    get 1 "^mOK^m" $i5
    if % != 0 goto comm_timeout
    if len($i5)>3 let $i6=$right($i5,1)
    let $i5=$left($i5,1)
    let $d="Unknown modem response ("+$i1+")"
    if $i1 = "0" let $d="No service"
    if $i1 = "1" let $d="Restricted service"
    if $i1 = "2" let $d="Valid service"
    if $i1 = "3" let $d="Restricted regional service"
    if $i1 = "4" let $d="Power-saving and deep sleep state"
    print $x+"- service state: "+$d+"\n"
    let $d="Unknown modem response ("+$i2+")"
    if $i2 = "0" let $d="No service"
    if $i2 = "1" let $d="Only CS service"
    if $i2 = "2" let $d="Only PS service"
    if $i2 = "3" let $d="PS+CS service"
    if $i2 = "4" let $d="CS and PS not registered, searching"
    print $x+"- domain: "+$d+"\n"    
    let $d="Unknown modem response ("+$i3+")"
    if $i3 = "0" let $d="Non roaming state"
    if $i3 = "1" let $d="Roaming state"
    print $x+"- roaming: "+$d+"\n"
    let $d="Unknown modem response ("+$i4+")"
    if $i4 = "0" let $d="No service"
    if $i4 = "1" let $d="AMPS mode"
    if $i4 = "2" let $d="CDMA mode"
    if $i4 = "3" let $d="GSM/GPRS mode"
    if $i4 = "4" let $d="HDR mode"
    if $i4 = "5" let $d="WCDMA mode"
    if $i4 = "6" let $d="GPS mode"
    if $i4 = "7" let $d="GSM/WCDMA"
    if $i4 = "8" let $d="CDMA/HDR HYBRID"
    if $i4 = "15" let $d="TD-SCDMA mode"
    print $x+"- mode: "+$d+"\n"
    let $d="Unknown modem response ("+$i5+")"
    if $i5 = "0" let $d="Invalid USIM card state or pin code locked"
    if $i5 = "1" let $d="Valid USIM card state"
    if $i5 = "2" let $d="USIM is invalid in case of CS"
    if $i5 = "3" let $d="USIM is invalid in case of PS"
    if $i5 = "4" let $d="USIM is invalid in case of either CS or PS"
    if $i5 = "255" let $d="USIM card is not existent"
    print $x+"- SIM: "+$d+"\n"
    let $d="Unknown modem response ("+$i6+")"
    if $i6 = "0" let $d="No service"
    if $i6 = "1" let $d="GSM mode"
    if $i6 = "2" let $d="GPRS mode"
    if $i6 = "3" let $d="EDGE mode"
    if $i6 = "4" let $d="WCDMA mode"
    if $i6 = "5" let $d="HSDPA mode"
    if $i6 = "6" let $d="HSUPA mode"
    if $i6 = "7" let $d="HSDPA mode and HSUPA mode"
    if $i6 = "8" let $d="TD_SCDMA mode"
    if $i6 = "9" let $d="HSPA+ mode"
    if $i6 = "17" let $d="HSPA+(64QAM) mode"
    if $i6 = "18" let $d="HSPA+(MIMO) mode"
    print $x+"- sub mode: "+$d+"\n"
    # Invalid state do finish
    if $i2 = "1" goto abort
    if $i5 = "0" goto abort
    if $i5 = "3" goto finish
    if $i5 = "4" goto finish
    if $i5 = "255" goto finish
    # Invalid state do restart_modem
    if $i1 = "0" goto restart_modem
    if $i1 = "4" goto restart_modem
    if $i2 = "0" goto restart_modem
    if $i2 = "4" goto restart_modem
    if $i4 = "0" goto restart_modem
:end_sysinfo

# Getting network registration status
    print $x+"Getting network registration status\n"
    let $i2=""
    send "AT+CGREG=2; +CGREG?^m"
    waitfor 2 "+CGREG: ","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while getting network registration status\n" goto end_cgreg
    if % = 2 gosub cme_error print $x+"Error "+$e+" while getting network registration status\n" goto end_cgreg
    if % = 3 print $x+"Command not supported\n" goto end_cgreg
    get 1 "," $i1
    if % != 0 goto comm_timeout
    get 1 "^m^mOK^m" $i4
    if % != 0 goto comm_timeout
    let $i2=$left($i4,1)
    if len($i4)>2 let $i3=$mid($i4,2,len($i4)-2)
    let $d="Unknown modem response ("+$i2+")"
    if $i2 = "0" let $d="Not registered. The MS is not searching the new operators to be registered"
    if $i2 = "1" let $d="Local network is registered"
    if $i2 = "2" let $d="Not registered. But the MS is searching the new operators to be registered"
    if $i2 = "3" let $d="Registration rejected"
    if $i2 = "4" let $d="Unknown reasons"
    if $i2 = "5" let $d="Roaming network is registered"
    print $x+"- status: "+$d+"\n"
    print $x+"- lac, ci: "+$i3+"\n"
    send "AT+CGREG=0^m"
    waitfor 1 "OK","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 2 waitquiet 1 0.5
:end_cgreg

# Disable CME error report
    send "AT+CMEE=0^m"
    waitfor 5 "OK","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout

# Verify if the modem is connected to APN
    print $x+"Verify if the modem is connected to APN\n"
    send "AT\^DHCP?^m"
    waitfor 5 "\^DHCP:","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 0 print $x+"Modem is already connected\n" goto do_disconnect
    if % = 3 print $x+"Command not supported\n" goto abort
    print $x+"No connection detected\n"

# Disconnecting from current APN
goto end_disconnect
:do_disconnect
    print $x+"Disconnecting from current APN\n"
    send "AT\^NDISDUP=1,0^m"
    waitfor 5 "OK","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while disconnecting from current APN\n" goto abort
    if % = 2 gosub cme_error print $x+"Error "+$e+" while disconnecting from current APN\n" goto abort
    if % = 3 print $x+"Command not supported\n" goto abort
    print $x+"Disconnected successfully\n"
    waitquiet 1 0.5
:end_disconnect    

# Setting mode
    if $m = "" goto end_mode_set
    print $x+"Setting mode "+$m+"\n"
    send $m+"^m"
    waitfor 5 "OK","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while setting mode error\n" goto abort
    if % = 2 gosub cme_error print $x+"Error "+$e+" while setting mode error\n" goto abort
    if % = 3 print $x+"Command not supported\n" goto abort
    print $x+"Mode set successfully\n"
:end_mode_set

# Establishing connection
    print $x+"Try to establish connection via APN "+$a+"\n"
    send "AT\^NDISDUP=1,1,\""+$a+"\"^m" 
    waitfor 5 "OK","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while connecting\n" goto abort
    if % = 2 gosub cme_error print $x+"Error "+$e+" while connecting\n" goto abort
    if % = 3 print $x+"Command not supported\n" goto abort
    print $x+"Waiting for establish connection\n"
    let r3=0
:wait_for_connection    
    let r3=r3+1
    if r3>30 goto restart_modem
    send "AT\^DHCP?^m"
    waitfor 5 "\^DHCP:","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 0 print $x+"Connection established\n" goto finish
    if % = 1 waitquiet 1 1 goto wait_for_connection
    if % = 2 waitquiet 1 1 goto wait_for_connection
    if % = 3 print $x+"Command not supported\n" goto abort

# In case of normal exit
:finish
    print $x+"Done.\n"
    exit 0

# In case of occurred an error
:abort
    print $x+"Done!\n"
    exit 1

# Error CME routine
:cme_error
    get 1 "^m" $e
    let $e="'"+$e+"'"
    return

# Restarting modem and start all
:restart_modem
    let r1=r1+1
    if r1>5 print $x+"Number of restart retries was exhausted\n" goto abort
    print $x+"Restarting modem\n"
    waitquiet 2 2
    send "AT\^NDISDUP=1,0^m"
    waitquiet 2 1
    send "ATZ0^m"
    waitquiet 2 1
    send "AT&F^m"
    waitquiet 2 1
    send "AT+CFUN=1^m"
    waitquiet 2 1
    goto start

# Timeout detected
:comm_timeout
    print $x+"Modem is not responding, timeout detected\n"
    goto restart_modem
# Done
install.sh - Aktualizacja systemu, sysinfo.sh - Info.o systemie, openvpn-auth.sh - Login dla OpenVPN
Tu moje skrypty na GitHub

38

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

Mam pewne uwagi co do skryptów.
W trunku interfejs sieciowy modemu nazywa się wwan0 a nie usb0 jak to było wcześniej i trzeba by dodać wyszukiwanie takich interfejsów w 3gtester.sh.
W skrypcie ndisup.gcom wpisywanie pinu powinno znajdować się gdzieś na początku. Inaczej dostaje komunikat, że modem (E372) nie obsługuje NDIS.
Wydaje mi się też, że logowanie informacji o interfejsie lub apn przy każdym uruchomieniu skryptu (a jest on często uruchamiany) jest zbędne.

Poza tym wszystko działa smile

39 (edytowany przez Rafciq 2012-05-02 07:49:00)

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

Dziękuję za spostrzeżenia, z chęcią dokonam takich zmian w skryptach. Miło, że są osoby, które z tego skorzystały smile

install.sh - Aktualizacja systemu, sysinfo.sh - Info.o systemie, openvpn-auth.sh - Login dla OpenVPN
Tu moje skrypty na GitHub

40

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

Zmodyfikowałem skrypty zgodnie z Twoimi spostrzeżeniami

frutis napisał/a:

Mam pewne uwagi co do skryptów.
W trunku interfejs sieciowy modemu nazywa się wwan0 a nie usb0 jak to było wcześniej i trzeba by dodać wyszukiwanie takich interfejsów w 3gtester.sh.
W skrypcie ndisup.gcom wpisywanie pinu powinno znajdować się gdzieś na początku. Inaczej dostaje komunikat, że modem (E372) nie obsługuje NDIS.
Wydaje mi się też, że logowanie informacji o interfejsie lub apn przy każdym uruchomieniu skryptu (a jest on często uruchamiany) jest zbędne.

skrypt /bin/3gtester.sh

#!/bin/sh
# Establishing 3G modem connection in dialup or NDIS mode
# Script version 1.05 Rafal Drzymala 2012
#
# Changelog
#    1.00    RD    First stable code
#    1.01    RD    Prevent from parallel comgt/gcom execution
#    1.02    RD    Added logger priority, redirect comgt/gcom to logger
#    1.03    RD    Changed ICMP monitoring, use device, multiwan or default dns
#    1.04    RD    Changed ICMP data size to 1 byte
#    1.05    RD    Changed log messages, added wwan interface detection (frutis suggestion)
#
SCR=$(basename $0)
DEF_ICMP="8.8.8.8 8.8.4.4"
COMGT_APP="gcom"
NDISUP="/etc/gcom/ndisup.gcom"
WANS=$(uci show network | awk -F[.=] '{if (($3=="proto" && $4=="3g") || ($3=="ifname" && (match($4,"usb[0-9]") || match($4,"wwan[0-9]")))) print $2}')
for WAN in $WANS; do
    NDIS="N"
    [ $(uci -q get network.$WAN.proto) != "3g" ] && NDIS="Y"
    DEV_IFNAME=$(uci -q get network.$WAN.ifname)
    DEV_APN=$(uci -q get network.$WAN.apn)
    DEV_PINCODE=$(uci -q get network.$WAN.pincode)
    DEV_MODE=$(uci -q get network.$WAN.mode)
    [ "$NDIS" == "Y" ] && DEV_COMM=$(uci -q get network.$WAN.comm)
    [ "$NDIS" == "N" ] && DEV_COMM=$(uci -q get network.$WAN.device)
    DEV_AUTO="1"
    [ "$NDIS" == "N" ] && DEV_AUTO=$(uci -q get network.$WAN.auto)
    DEV_ICMP=$(uci -q get network.$WAN.dns)
    [ "$DEV_ICMP" == "" ] && DEV_ICMP=$(uci -q get multiwan.$WAN.dns)
    [ "$DEV_ICMP" == "" ] && DEV_ICMP=$DEF_ICMP
    logger -p user.notice -t $SCR "Checking for active connection $WAN ($DEV_IFNAME) attempting to ping $DEV_ICMP"
    if [ "$DEV_AUTO" == "1" ]; then
        if [ -e $DEV_COMM ]; then
            for ICMP in $DEV_ICMP; do
                if ping -q -c 1 -W 2 -s 1 -I $DEV_IFNAME $ICMP &>/dev/null; then
                    ICMP_OK=$ICMP
                    break
                fi
            done
            if [ "$ICMP_OK" != "" ]; then
                logger -p user.notice -t $SCR "ICMP successfully sent via $WAN ($DEV_IFNAME) to $ICMP_OK"
            else
                logger -p user.notice -t $SCR "Restarting connection $WAN ($DEV_IFNAME) using device $DEV_COMM and apn $DEV_APN"
                [ "$DEV_MODE" != "" ] && logger -t $SCR "Using additional modem command $DEV_MODE"
                if [ "$NDIS" == "N" ]; then
                    (ifdown $WAN; sleep 2; ifup $WAN) &
                else
                    COMGT_DEV="-d $DEV_COMM"
                    COMGT_SCR="-s $NDISUP"
                    if pgrep -l -f "$COMGT_APP $COMGT_DEV $COMGT_SCR"> /dev/null; then
                        logger -p user.notice -t $SCR "Connection $WAN ($DEV_IFNAME) is already restarted"
                    elif pgrep -l -f "$COMGT_APP $COMGT_DEV"> /dev/null; then
                        logger -p user.notice -t $SCR "Device $DEV_COMM used by another instance of $COMGT_APP"
                    elif ([ "$DEV_COMM" == "/dev/ttyUSB2" ] || [ "$DEV_COMM" == "/dev/noz2" ] || [ "$DEV_COMM" == "/dev/modem" ]) && pgrep -l -f  "$COMGT_APP" | grep -q -v "\-d"> /dev/null; then
                        logger -p user.notice -t $SCR "Device $DEV_COMM used by another instance of $COMGT_APP"
                    else
                        (ifdown $WAN; PINCODE=$DEV_PINCODE APN=$DEV_APN MODE=$DEV_MODE $COMGT_APP $COMGT_DEV $COMGT_SCR | logger -p user.notice -t $COMGT_APP; sleep 2; ifup $WAN) &
                    fi
                fi
            fi
        else
            logger -p user.error -t $SCR "Device $DEV_COMM for $WAN not exist"
        fi
    fi
done
# Done

skrypt /etc/gcom/ndisup.gcom

opengt
    let $x="ndisup:"+$basename($dev())+" "
    print $x+"Establishing 3G modem connection in NDIS mode\n"
    print $x+"Script for comgt version 1.04 Rafal Drzymala 2012\n"
#
# Changelog
#    1.00    RD    First stable code
#    1.01    RD    Moved "Getting received signal strength" section
#                Reset command changed from ATZ to ATZ0
#                Changed wait time for establish connection from 20 to 30 secs
#    1.02    RD    Changed signal level bar
#    1.03    RD    Added support for SYSINFOEX modem command
#    1.04    RD    Moved "Checking for password input request" section (frutis suggestion)
#
# Modem succesfuly tested
# - HUAWEI E173        11.126.85.00.209
# Modem tested, not supported 
# - HUAWEI E160G    11.608.02.02.55
# - HUAWEI E160        11.604.09.00.00
# - HUAWEI E220
#
    set com 115200n81
    set ignorecase on
    set comecho off
    set senddelay 0.02

    let $a=$env("APN")
    let $m=$env("MODE")
    let $p=$env("PINCODE")

    if  $a = "" print $x+"APN environment var not specified\n" goto finish    
    let r1=1

:start
# Initializing communication with modem
    if r1=1 print $x+"Try to communicate with modem\n"
    if r1>1 print $x+"Again try to communicate with modem (",r1,")\n"
    waitquiet 2 0.5
    send "ATQ0; E0^m"
    waitfor 1 "OK"
    if % = -1 goto comm_timeout
    send "AT+CMEE=2^m"
    waitfor 1 "OK","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 2 waitquiet 1 0.5
    send "AT\^CURC=0^m"
    waitfor 1 "OK","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 2 waitquiet 1 0.5

# Checking for password input request
    print $x+"Checking for password input request\n"
    let u=0
    send "AT+CPIN?^m"
    waitfor 5 "+CPIN: ","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while checking for password input request\n" goto end_chkpin
    if % = 2 gosub cme_error print $x+"Error "+$e+" while checking for password input request\n" goto end_chkpin
    if % = 3 print $x+"Command not supported\n" goto end_chkpin
    get 1 "^mOK^m" $i1
    if % != 0 goto comm_timeout
    let $d="Unknown modem response ("+$i1+")"
    if $i1 = "READY" let $d="MT without password input request"
    if $i1 = "SIM PIN" let $d="UICC/SIM PIN password request"
    if $i1 = "SIM PUK" let $d="UICC/SIM PUK password request, to unblock the SIM PIN which was blocked for 3 verification failure"
    if $i1 = "SIM PIN2" let $d="PIN2 password request"
    if $i1 = "SIM PUK2" let $d="PUK2 password request, to unblock the SIM PIN2 which was blocked for 3 verification failure"
    if $i1 = "PH-SIM PIN" let $d="SIM lock (phone-to-SIM) is required"
    if $i1 = "PH-NET PIN" let $d="Network personnalisation is required"
    print $x+"- state: "+$d+"\n"
    if $i1 = "SIM PIN" goto do_pin_unlock
    if $i1 <> "READY" goto finish
:end_chkpin

# Unlock the PIN 
    goto end_pin_unlock
:do_pin_unlock
    print $x+"UICC/SIM unlocking by PIN\n"
    if $p = "" print $x+"PINCODE environment var not specified\n" goto abort
    send "AT+CPIN="+$p"^m"
    waitfor 5 "OK","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while unlocking by PIN\n" goto abort
    if % = 2 gosub cme_error print $x+"Error "+$e+" while unlocking by PIN\n" goto abort
    if % = 3 print $x+"Command not supported\n" goto abort
    print $x+"UICC/SIM unlocked successfully\n"
    let r2=0
:wait_for_reg
    let r2=r2+1
    if r2>5 print $x+"Number of retries exhausted\n" goto abort
    print $x+"Waiting for network registration (",r2,")\n"
    send "AT+CGREG=0; +CGREG?^m"
    waitfor 2 "+CGREG: ","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while getting network registration status\n" goto end_pin_unlock
    if % = 2 gosub cme_error print $x+"Error "+$e+" while getting network registration status\n" goto end_pin_unlock
    if % = 3 print $x+"Command not supported\n" goto end_pin_unlock
    get 1 "," $i1
    if % != 0 goto comm_timeout
    get 1 "^m^mOK^m" $i2
    if % != 0 goto comm_timeout
    let $d="Unknown modem response ("+$i2+")"
    if $i2 = "0" waitquiet 1 5 goto wait_for_reg
    if $i2 = "1" goto end_pin_unlock
    if $i2 = "2" waitquiet 1 5 goto wait_for_reg
    if $i2 = "3" let $d="Registration rejected"
    if $i2 = "4" let $d="Unknown reasons"
    if $i2 = "5" goto end_pin_unlock
    print $x+"- error: "+$d+"\n"
    goto abort
:end_pin_unlock

# Getting device information
    print $x+"Getting device information\n"
    waitquiet 1 0.2 
    send "AT+CGMI^m"
    get 1 "^mOK^m" $i1
    if % != 0 goto comm_timeout
    waitquiet 1 0.1
    send "AT+CGMM^m"
    get 1 "^mOK^m" $i2
    if % != 0 goto comm_timeout
    waitquiet 1 0.1 
    send "AT+CGMR^m"
    get 1 "^mOK^m" $i3
    if % != 0 goto comm_timeout
    waitquiet 1 0.1
    send "AT+CGSN^m"
    get 1 "^mOK^m" $i4
    if % != 0 goto comm_timeout
    if len($i1)>1 let $i1=$right($i1,len($i1)-1)
    if len($i2)>1 let $i2=$right($i2,len($i2)-1)
    if len($i3)>1 let $i3=$right($i3,len($i3)-1)
    if len($i4)>1 let $i4=$right($i4,len($i4)-1)
    print $x+"- modem: "+$toupper($i1)+" "+$toupper($i2)+"\n"
    print $x+"- firmware: "+$i3+"\n"
    print $x+"- IMEI: "+$i4+"\n"

# Getting received signal strength
    print $x+"Getting received signal strength\n"
    send "AT+CSQ^m"
    waitfor 5 "+CSQ: ","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while getting received signal strength\n" goto end_sigstr
    if % = 2 gosub cme_error print $x+"Error "+$e+" while getting received signal strength\n" goto end_sigstr
    get 1 "," $i1
    if % != 0 goto comm_timeout
    get 1 "^mOK^m" $i2
    if % != 0 goto comm_timeout
    if $i1 = "99" print $x+"- signal strength: unknown\n" goto end_sigstr
    let s1=val($i1)
    let s2=(s1*2)-113 
    let s3=((s1*100000)/31000)
    print $x+"- signal strength: (",s1,"), ",s2," dBm, ",s3,"%\n"
    let s3=s3/2
    let $s3=$left("##################################################",s3)
    let $s3=$s3+$right("----1----2----3----5----5----6----7----8----9----$",50-s3)
    print $x+"- level: ["+$s3+"]\n"
:end_sigstr

# Checking modem for NDIS support
    print $x+"Checking modem for NDIS support\n"
    send "AT\^DIALMODE?^m" 
    waitfor 5 "\^DIALMODE:","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % > 0 print $x+"- This modem doesn't support NDIS mode\n" goto abort
    get 1 "^mOK^m" $i1
    if % != 0 goto comm_timeout
    let $i1=$left($i1,1)
    if $i1 = "1" goto ok_ndis_check
    if $i1 = "2" goto ok_ndis_check
    print $x+"- This modem doesn't support NDIS mode\n"
    goto abort
:ok_ndis_check
    print $x+"- NDIS mode is supported by this modem\n"
    waitquiet 1 1

# Getting system information
    print $x+"Getting system information\n"
:do_sysinfoex
    send "AT\^SYSINFOEX^m"
    waitfor 5 "\^SYSINFOEX:","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 goto end_sysinfoex
    if % = 2 gosub cme_error goto end_sysinfoex
    if % = 3 goto end_sysinfoex
    get 1 "," $i1
    if % != 0 goto comm_timeout
    get 1 "," $i2
    if % != 0 goto comm_timeout
    get 1 "," $i3
    if % != 0 goto comm_timeout
    get 1 "," $i4
    if % != 0 goto comm_timeout
    get 1 "," $i5
    if % != 0 goto comm_timeout
    get 1 "," $i6
    if % != 0 goto comm_timeout
    get 1 "," $i7
    if % != 0 goto comm_timeout
    get 1 "," $i8
    if % != 0 goto comm_timeout
    get 1 "^mOK^m" $i9
    if % != 0 goto comm_timeout
    let $d="Unknown modem response ("+$i1+")"
    if $i1 = "0" let $d="No service"
    if $i1 = "1" let $d="Restricted service"
    if $i1 = "2" let $d="Valid service"
    if $i1 = "3" let $d="Restricted regional service"
    if $i1 = "4" let $d="Power-saving and deep sleep state"
    print $x+"- service state: "+$d+"\n"
    let $d="Unknown modem response ("+$i2+")"
    if $i2 = "0" let $d="No service"
    if $i2 = "1" let $d="Only CS service"
    if $i2 = "2" let $d="Only PS service"
    if $i2 = "3" let $d="PS+CS service"
    if $i2 = "4" let $d="CS and PS not registered, searching"
    print $x+"- domain: "+$d+"\n"    
    let $d="Unknown modem response ("+$i3+")"
    if $i3 = "0" let $d="Non roaming state"
    if $i3 = "1" let $d="Roaming state"
    print $x+"- roaming: "+$d+"\n"
    let $d="Unknown modem response ("+$i4+")"
    if $i4 = "0" let $d="Invalid USIM card state or pin code locked"
    if $i4 = "1" let $d="Valid USIM card state"
    if $i4 = "2" let $d="USIM is invalid in case of CS"
    if $i4 = "3" let $d="USIM is invalid in case of PS"
    if $i4 = "4" let $d="USIM is invalid in case of either CS or PS"
    if $i4 = "240" let $d="ROMSIM"
    if $i4 = "255" let $d="USIM card is not existent"
    print $x+"- SIM: "+$d+"\n"
    let $d="Unknown modem response ("+$i6+")"
    if $i7 != "" let d$=$i7 let $i6=""
    if $i6 = "0" let $d="No service"
    if $i6 = "1" let $d="GSM"
    if $i6 = "2" let $d="CDMA"
    if $i6 = "3" let $d="WCDMA"
    if $i6 = "4" let $d="TD-SCDMA"
    if $i6 = "5" let $d="WIMAX"
    if $i6 = "6" let $d="LTE"
    print $x+"- mode: "+$d+"\n"
    let $d="Unknown modem response ("+$i8+")"
    if $i9 != "" let d$=$i9 let $i8=""
    if $i8 = "0" let $d="No service"
    if $i8 = "1" let $d="GSM"
    if $i8 = "2" let $d="GPRS"
    if $i8 = "3" let $d="EDGE"
    if $i8 = "21" let $d="IS95A"
    if $i8 = "22" let $d="IS95B"
    if $i8 = "23" let $d="CDMA2000 1X"
    if $i8 = "24" let $d="EVDO Rel0"
    if $i8 = "25" let $d="EVDO RelA"
    if $i8 = "26" let $d="EVDO RelB"
    if $i8 = "27" let $d="HYBRID (CDMA2000 1X)"
    if $i8 = "28" let $d="HYBRID (EVDO Rel0)"
    if $i8 = "29" let $d="HYBRID (EVDO RelA)"
    if $i8 = "30" let $d="HYBRID (EVDO RelB)"
    if $i8 = "41" let $d="WCDMA"
    if $i8 = "42" let $d="HSDPA"
    if $i8 = "43" let $d="HSUPA"
    if $i8 = "44" let $d="HSPA"
    if $i8 = "45" let $d="HSPA+"
    if $i8 = "46" let $d="DC-HSPA+"
    if $i8 = "61" let $d="TD-SCDMA"
    if $i8 = "62" let $d="HSDPA"
    if $i8 = "63" let $d="HSUPA"
    if $i8 = "64" let $d="HSPA"
    if $i8 = "65" let $d="HSPA+"
    if $i8 = "81" let $d="802.16e"
    if $i8 = "101" let $d="LTE"
    print $x+"- sub mode: "+$d+"\n"
    # Invalid state do finish
    if $i2 = "1" goto abort
    if $i4 = "0" goto abort
    if $i4 = "3" goto finish
    if $i4 = "4" goto finish
    if $i4 = "255" goto finish
    # Invalid state do restart_modem
    if $i1 = "0" goto restart_modem
    if $i1 = "4" goto restart_modem
    if $i2 = "0" goto restart_modem
    if $i2 = "4" goto restart_modem
    if $i6 = "0" goto restart_modem
    goto end_sysinfo
:end_sysinfoex

:do_sysinfo
    send "AT\^SYSINFO^m"
    waitfor 5 "\^SYSINFO:","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while getting system information\n" goto end_sysinfo
    if % = 2 gosub cme_error print $x+"Error "+$e+" while getting system information\n" goto end_sysinfo
    if % = 3 print $x+"Command not supported\n" goto end_sysinfo
    get 1 "," $i1
    if % != 0 goto comm_timeout
    get 1 "," $i2
    if % != 0 goto comm_timeout
    get 1 "," $i3
    if % != 0 goto comm_timeout
    get 1 "," $i4
    if % != 0 goto comm_timeout
    get 1 "^mOK^m" $i5
    if % != 0 goto comm_timeout
    if len($i5)>3 let $i6=$right($i5,1)
    let $i5=$left($i5,1)
    let $d="Unknown modem response ("+$i1+")"
    if $i1 = "0" let $d="No service"
    if $i1 = "1" let $d="Restricted service"
    if $i1 = "2" let $d="Valid service"
    if $i1 = "3" let $d="Restricted regional service"
    if $i1 = "4" let $d="Power-saving and deep sleep state"
    print $x+"- service state: "+$d+"\n"
    let $d="Unknown modem response ("+$i2+")"
    if $i2 = "0" let $d="No service"
    if $i2 = "1" let $d="Only CS service"
    if $i2 = "2" let $d="Only PS service"
    if $i2 = "3" let $d="PS+CS service"
    if $i2 = "4" let $d="CS and PS not registered, searching"
    print $x+"- domain: "+$d+"\n"    
    let $d="Unknown modem response ("+$i3+")"
    if $i3 = "0" let $d="Non roaming state"
    if $i3 = "1" let $d="Roaming state"
    print $x+"- roaming: "+$d+"\n"
    let $d="Unknown modem response ("+$i4+")"
    if $i4 = "0" let $d="No service"
    if $i4 = "1" let $d="AMPS"
    if $i4 = "2" let $d="CDMA"
    if $i4 = "3" let $d="GSM/GPRS"
    if $i4 = "4" let $d="HDR"
    if $i4 = "5" let $d="WCDMA"
    if $i4 = "6" let $d="GPS"
    if $i4 = "7" let $d="GSM/WCDMA"
    if $i4 = "8" let $d="CDMA/HDR HYBRID"
    if $i4 = "15" let $d="TD-SCDMA"
    print $x+"- mode: "+$d+"\n"
    let $d="Unknown modem response ("+$i5+")"
    if $i5 = "0" let $d="Invalid USIM card state or pin code locked"
    if $i5 = "1" let $d="Valid USIM card state"
    if $i5 = "2" let $d="USIM is invalid in case of CS"
    if $i5 = "3" let $d="USIM is invalid in case of PS"
    if $i5 = "4" let $d="USIM is invalid in case of either CS or PS"
    if $i5 = "255" let $d="USIM card is not existent"
    print $x+"- SIM: "+$d+"\n"
    let $d="Unknown modem response ("+$i6+")"
    if $i6 = "0" let $d="No service"
    if $i6 = "1" let $d="GSM"
    if $i6 = "2" let $d="GPRS"
    if $i6 = "3" let $d="EDGE"
    if $i6 = "4" let $d="WCDMA"
    if $i6 = "5" let $d="HSDPA"
    if $i6 = "6" let $d="HSUPA"
    if $i6 = "7" let $d="HSDPA and HSUPA"
    if $i6 = "8" let $d="TD_SCDMA"
    if $i6 = "9" let $d="HSPA+"
    if $i6 = "17" let $d="HSPA+(64QAM)"
    if $i6 = "18" let $d="HSPA+(MIMO)"
    print $x+"- sub mode: "+$d+"\n"
    # Invalid state do finish
    if $i2 = "1" goto abort
    if $i5 = "0" goto abort
    if $i5 = "3" goto finish
    if $i5 = "4" goto finish
    if $i5 = "255" goto finish
    # Invalid state do restart_modem
    if $i1 = "0" goto restart_modem
    if $i1 = "4" goto restart_modem
    if $i2 = "0" goto restart_modem
    if $i2 = "4" goto restart_modem
    if $i4 = "0" goto restart_modem
:end_sysinfo

# Getting network registration status
    print $x+"Getting network registration status\n"
    let $i2=""
    send "AT+CGREG=2; +CGREG?^m"
    waitfor 2 "+CGREG: ","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while getting network registration status\n" goto end_cgreg
    if % = 2 gosub cme_error print $x+"Error "+$e+" while getting network registration status\n" goto end_cgreg
    if % = 3 print $x+"Command not supported\n" goto end_cgreg
    get 1 "," $i1
    if % != 0 goto comm_timeout
    get 1 "^m^mOK^m" $i4
    if % != 0 goto comm_timeout
    let $i2=$left($i4,1)
    if len($i4)>2 let $i3=$mid($i4,2,len($i4)-2)
    let $d="Unknown modem response ("+$i2+")"
    if $i2 = "0" let $d="Not registered. The MS is not searching the new operators to be registered"
    if $i2 = "1" let $d="Local network is registered"
    if $i2 = "2" let $d="Not registered. But the MS is searching the new operators to be registered"
    if $i2 = "3" let $d="Registration rejected"
    if $i2 = "4" let $d="Unknown reasons"
    if $i2 = "5" let $d="Roaming network is registered"
    print $x+"- status: "+$d+"\n"
    print $x+"- lac, ci: "+$i3+"\n"
    send "AT+CGREG=0^m"
    waitfor 1 "OK","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 2 waitquiet 1 0.5
:end_cgreg

# Disable CME error report
    send "AT+CMEE=0^m"
    waitfor 5 "OK","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout

# Verify if the modem is connected to APN
    print $x+"Verify if the modem is connected to APN\n"
    send "AT\^DHCP?^m"
    waitfor 5 "\^DHCP:","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 0 print $x+"Modem is already connected\n" goto do_disconnect
    if % = 3 print $x+"Command not supported\n" goto abort
    print $x+"No connection detected\n"

# Disconnecting from current APN
goto end_disconnect
:do_disconnect
    print $x+"Disconnecting from current APN\n"
    send "AT\^NDISDUP=1,0^m"
    waitfor 5 "OK","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while disconnecting from current APN\n" goto abort
    if % = 2 gosub cme_error print $x+"Error "+$e+" while disconnecting from current APN\n" goto abort
    if % = 3 print $x+"Command not supported\n" goto abort
    print $x+"Disconnected successfully\n"
    waitquiet 1 0.5
:end_disconnect    

# Setting mode
    if $m = "" goto end_mode_set
    print $x+"Setting mode "+$m+"\n"
    send $m+"^m"
    waitfor 5 "OK","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while setting mode error\n" goto abort
    if % = 2 gosub cme_error print $x+"Error "+$e+" while setting mode error\n" goto abort
    if % = 3 print $x+"Command not supported\n" goto abort
    print $x+"Mode set successfully\n"
:end_mode_set

# Establishing connection
    print $x+"Try to establish connection via APN "+$a+"\n"
    send "AT\^NDISDUP=1,1,\""+$a+"\"^m" 
    waitfor 5 "OK","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 print $x+"Error while connecting\n" goto abort
    if % = 2 gosub cme_error print $x+"Error "+$e+" while connecting\n" goto abort
    if % = 3 print $x+"Command not supported\n" goto abort
    print $x+"Waiting for establish connection\n"
    let r3=0
:wait_for_connection    
    let r3=r3+1
    if r3>30 goto restart_modem
    send "AT\^DHCP?^m"
    waitfor 5 "\^DHCP:","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 0 print $x+"Connection established\n" goto finish
    if % = 1 waitquiet 1 1 goto wait_for_connection
    if % = 2 waitquiet 1 1 goto wait_for_connection
    if % = 3 print $x+"Command not supported\n" goto abort

# In case of normal exit
:finish
    print $x+"Done.\n"
    exit 0

# In case of occurred an error
:abort
    print $x+"Done!\n"
    exit 1

# Error CME routine
:cme_error
    get 1 "^m" $e
    let $e="'"+$e+"'"
    return

# Restarting modem and start all
:restart_modem
    let r1=r1+1
    if r1>5 print $x+"Number of restart retries was exhausted\n" goto abort
    print $x+"Restarting modem\n"
    waitquiet 2 2
    send "AT\^NDISDUP=1,0^m"
    waitquiet 2 1
    send "ATZ0^m"
    waitquiet 2 1
    send "AT&F^m"
    waitquiet 2 1
    send "AT+CFUN=1^m"
    waitquiet 2 1
    goto start

# Timeout detected
:comm_timeout
    print $x+"Modem is not responding, timeout detected\n"
    goto restart_modem
# Done
install.sh - Aktualizacja systemu, sysinfo.sh - Info.o systemie, openvpn-auth.sh - Login dla OpenVPN
Tu moje skrypty na GitHub

41 (edytowany przez komprez 2012-10-17 10:49:50)

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

Mam Huawei E3131 oraz E173 ... ten drugi wstał bez problemów ale E3131 coś nie bangla wink

Oct 17 10:33:30 OpenWrt user.info sysinit: ndisup:ttyUSB2 Again try to communicate with modem (5)
Oct 17 10:33:31 OpenWrt user.info sysinit: ndisup:ttyUSB2 Getting device information
Oct 17 10:33:32 OpenWrt user.info sysinit: ndisup:ttyUSB2 - modem: HUAWEI E3131
Oct 17 10:33:32 OpenWrt user.info sysinit: ndisup:ttyUSB2 - firmware: 21.157.11.00.264
Oct 17 10:33:32 OpenWrt user.info sysinit: ndisup:ttyUSB2 - IMEI: 8627320XXXXXXXX
Oct 17 10:33:32 OpenWrt user.info sysinit: ndisup:ttyUSB2 Checking modem for NDIS support
Oct 17 10:33:33 OpenWrt user.info sysinit: ndisup:ttyUSB2 - NDIS mode is supported by this modem
Oct 17 10:33:34 OpenWrt user.info sysinit: ndisup:ttyUSB2 Checking for password input request
Oct 17 10:33:34 OpenWrt user.info sysinit: ndisup:ttyUSB2 - state: MT without password input request
Oct 17 10:33:34 OpenWrt user.info sysinit: ndisup:ttyUSB2 Getting system information
Oct 17 10:33:34 OpenWrt user.info sysinit: ndisup:ttyUSB2 - service state: Valid service
Oct 17 10:33:34 OpenWrt user.info sysinit: ndisup:ttyUSB2 - domain: PS+CS service
Oct 17 10:33:34 OpenWrt user.info sysinit: ndisup:ttyUSB2 - roaming: Roaming state
Oct 17 10:33:34 OpenWrt user.info sysinit: ndisup:ttyUSB2 - mode: WCDMA mode
Oct 17 10:33:34 OpenWrt user.info sysinit: ndisup:ttyUSB2 - SIM: Valid USIM card state
Oct 17 10:33:34 OpenWrt user.info sysinit: ndisup:ttyUSB2 - sub mode: WCDMA mode
Oct 17 10:33:34 OpenWrt user.info sysinit: ndisup:ttyUSB2 Getting received signal strength
Oct 17 10:33:34 OpenWrt user.info sysinit: ndisup:ttyUSB2 - signal strength: (12), -89 dBm, 38%
Oct 17 10:33:34 OpenWrt user.info sysinit: ndisup:ttyUSB2 - signal strength: [#######-------------]
Oct 17 10:33:34 OpenWrt user.info sysinit: ndisup:ttyUSB2 Getting network registration status
Oct 17 10:33:35 OpenWrt user.info sysinit: ndisup:ttyUSB2 - status: Roaming network is registered
Oct 17 10:33:35 OpenWrt user.info sysinit: ndisup:ttyUSB2 - lac, ci: "C352","42FA"
Oct 17 10:33:35 OpenWrt user.info sysinit: ndisup:ttyUSB2 Verify if the modem is connected
Oct 17 10:33:40 OpenWrt user.info sysinit: ndisup:ttyUSB2 Modem is not responding, timeout detected
Oct 17 10:33:40 OpenWrt user.info sysinit: ndisup:ttyUSB2 Number of retries exhausted
Oct 17 10:33:40 OpenWrt user.info sysinit: ndisup:ttyUSB2 Done!

42

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

E3131 nigdy nie działał w tym trybie. Mój też nie działa.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

43

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

A ciekawe bo NDIS-a obsługuje ... chciałem potestować Aero na 2 modemach jako multiwan z tym że właśnie tylko takie
modemy mam obecnie ... znasz jakiś inny sposób Cezary ?

44

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

Że obsługuje to wiem. Ale nie reaguje tutaj na żadne próby działania w ndis. Nie znam żadnego sposobu na niego. Mimo wydania różnych poleceń po prostu się nie łączy.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

45

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

Próbuję wg instrukcji z eko uruchomić E367 w NDIS na WR-703N i utknąłem na  /etc/config/network

config 'interface' 'wan'
        option 'auto' '0'
        option 'proto' 'dhcp'
        option ifname usb0
        option macaddr 00:01:02:03:04:05

-nie wiem jak dodać to z konsoli do Gargoyle (kiedyś na MR3420 ze starą wersją systemu miałem podobny problem-posiłkowałem się Google, znalazłem linka jak to dopisać przez vi i uruchomiłem połączenie w NDIS), teraz przekopałem i nic???

46

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

uci set network.wan.auto=0
uci set network.wan.proto=dhcp
uci set network.wan.ifname=usb0
uci set network.wan.macaddr='00:01:02:03:04:05'
uci commit network

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

47 (edytowany przez Rafciq 2012-12-16 21:22:44)

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

Witam,
dodałem do skryptu 3gtester.sh opcjonalny reboot routera, gdy upłynie zadany czas od ostatniego poprawnie wysłanego ICMP przez dany interfejs.

Jeżeli w network dodamy opcję rebootafter z ilością sekund:

uci set network.wan2=interface
uci set network.wan2.ifname=usb0
uci set network.wan2.proto=dhcp
uci set network.wan2.comm=/dev/ttyUSB2
uci set network.wan2.mode="AT^SYSCFG=2,2,3FFFFFFF,2,4"
uci set network.wan2.pincode=
uci set network.wan2.apn=darmowy
uci set network.wan2.username=
uci set network.wan2.password=
uci set network.wan2.macaddr=00:01:02:03:04:05
uci set network.wan2.auto=0
uci set network.wan2.defaultroute=0
uci set network.wan2.peerdns=0
uci set network.wan2.dns='8.8.8.8 8.8.4.4'
uci set network.wan2.rebootafter=900

to skrypt będzie reboot-ował router, gdy tylko przez wskazany czas nieuka się wysłać pinga przez ten właśnie interfejs.

Nowa wersja pliku 3gtester.sh:

#!/bin/sh
# Establishing 3G modem connection in dialup or NDIS mode
# Script version 1.07 Rafal Drzymala 2012
#
# Changelog
#    1.00    RD    First stable code
#    1.01    RD    Prevent from parallel comgt/gcom execution
#    1.02    RD    Added logger priority, redirect comgt/gcom to logger
#    1.03    RD    Changed ICMP monitoring, use device, multiwan or default dns
#    1.04    RD    Changed ICMP data size to 1 byte
#    1.05    RD    Changed log messages, added wwan interface detection (frutis suggestion)
#    1.06    RD    Added router auto-reboot after connection timeout detected (if rebootafter option in network present)
#    1.07    RD    Added reboots log
#
SCR=$(basename $0)
DEF_ICMP="8.8.8.8 8.8.4.4"
COMGT_APP="gcom"
NDISUP="/etc/gcom/ndisup.gcom"
FPATH="/usr/data/"
WANS=$(uci show network | awk -F[.=] '{if (($3=="proto" && $4=="3g") || ($3=="ifname" && (match($4,"usb[0-9]") || match($4,"wwan[0-9]")))) print $2}')
for WAN in $WANS; do
    NDIS="N"
    UPTIME=$(cut -d "." -f1 /proc/uptime)
    NOW=$(date -u +"%Y.%m.%d-%H:%M:%S %s")
    [ $(uci -q get network.$WAN.proto) != "3g" ] && NDIS="Y"
    DEV_IFNAME=$(uci -q get network.$WAN.ifname)
    DEV_APN=$(uci -q get network.$WAN.apn)
    DEV_PINCODE=$(uci -q get network.$WAN.pincode)
    DEV_MODE=$(uci -q get network.$WAN.mode)
    DEV_REBOOTAFTER=$(uci -q get network.$WAN.rebootafter)
    [ "$NDIS" == "Y" ] && DEV_COMM=$(uci -q get network.$WAN.comm)
    [ "$NDIS" == "N" ] && DEV_COMM=$(uci -q get network.$WAN.device)
    DEV_AUTO="1"
    [ "$NDIS" == "N" ] && DEV_AUTO=$(uci -q get network.$WAN.auto)
    DEV_ICMP=$(uci -q get network.$WAN.dns)
    [ "$DEV_ICMP" == "" ] && DEV_ICMP=$(uci -q get multiwan.$WAN.dns)
    [ "$DEV_ICMP" == "" ] && DEV_ICMP=$DEF_ICMP
    logger -p user.notice -t $SCR "Checking for active connection $WAN ($DEV_IFNAME) attempting to ping $DEV_ICMP"
    if [ "$DEV_AUTO" == "1" ]; then
        if [ -e $DEV_COMM ]; then
            echo "$NOW $UPTIME" >$FPATH$SCR.$WAN.check
            for ICMP in $DEV_ICMP; do
                if ping -q -c 1 -W 2 -s 1 -I $DEV_IFNAME $ICMP &>/dev/null; then
                    ICMP_OK=$ICMP
                    break
                fi
            done
            if [ "$ICMP_OK" != "" ]; then
                logger -p user.notice -t $SCR "ICMP successfully sent via $WAN ($DEV_IFNAME) to $ICMP_OK"
                echo "$NOW $UPTIME" >$FPATH$SCR.$WAN.ok
            else
                logger -p user.notice -t $SCR "Restarting connection $WAN ($DEV_IFNAME) using device $DEV_COMM and apn $DEV_APN"
                [ "$DEV_MODE" != "" ] && logger -t $SCR "Using additional modem command $DEV_MODE"
                if [ "$NDIS" == "N" ]; then
                    (ifdown $WAN; sleep 2; ifup $WAN) &
                else
                    COMGT_DEV="-d $DEV_COMM"
                    COMGT_SCR="-s $NDISUP"
                    if pgrep -l -f "$COMGT_APP $COMGT_DEV $COMGT_SCR"> /dev/null; then
                        logger -p user.notice -t $SCR "Connection $WAN ($DEV_IFNAME) is already restarted"
                    elif pgrep -l -f "$COMGT_APP $COMGT_DEV"> /dev/null; then
                        logger -p user.notice -t $SCR "Device $DEV_COMM used by another instance of $COMGT_APP"
                    elif ([ "$DEV_COMM" == "/dev/ttyUSB2" ] || [ "$DEV_COMM" == "/dev/noz2" ] || [ "$DEV_COMM" == "/dev/modem" ]) && pgrep -l -f  "$COMGT_APP" | grep -q -v "\-d"> /dev/null; then
                        logger -p user.notice -t $SCR "Device $DEV_COMM used by another instance of $COMGT_APP"
                    else
                        (ifdown $WAN; PINCODE=$DEV_PINCODE APN=$DEV_APN MODE=$DEV_MODE $COMGT_APP $COMGT_DEV $COMGT_SCR | logger -p user.notice -t $COMGT_APP; sleep 2; ifup $WAN) &
                    fi
                fi
            fi
            if [ "$DEV_REBOOTAFTER" != "" ] && [ "$UPTIME" -ge "$DEV_REBOOTAFTER" ]; then
                LAST_ICMP_CHK=$(cut -d " " -f3 $FPATH$SCR.$WAN.check)
                LAST_ICMP_OK=$(cut -d " " -f3 $FPATH$SCR.$WAN.ok)
                if [ "$LAST_ICMP_CHK" != "" ] && [ "$LAST_ICMP_OK" != "" ] && [ "$(($UPTIME-$LAST_ICMP_OK))" -ge "$DEV_REBOOTAFTER" ]; then
                    logger -p user.notice -t $SCR "Device $WAN ($DEV_IFNAME) reboot timeout detected, rebooting router..."
                    echo "$NOW $UPTIME $WAN" >>$FPATH$SCR.reboots
                    reboot
                fi
            fi
        else
            logger -p user.error -t $SCR "Device $DEV_COMM for $WAN not exist"
        fi
    fi
done
# Done

Do funkcjonowania nowej opcji potrzebny jest katalog /usr/data/

install.sh - Aktualizacja systemu, sysinfo.sh - Info.o systemie, openvpn-auth.sh - Login dla OpenVPN
Tu moje skrypty na GitHub

48

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

Hej,

A jaki jest cel restartów routera?

W skrypcie ndisup.gcom jest jeden błąd i modemy obsługujące komendę AT^SYSCFGEX nie działają. Sekcja ta powinna wyglądać następująco:

# Getting system information
    print $x+"Getting system information\n"
:do_sysinfoex
    send "AT\^SYSINFOEX^m"
    waitfor 5 "\^SYSINFOEX:","ERROR","+CME ERROR: ","COMMAND NOT SUPPORT"
    if % = -1 goto comm_timeout
    if % = 1 goto end_sysinfoex
    if % = 2 gosub cme_error goto end_sysinfoex
    if % = 3 goto end_sysinfoex
    get 1 "," $i1
    if % != 0 goto comm_timeout
    get 1 "," $i2
    if % != 0 goto comm_timeout
    get 1 "," $i3
    if % != 0 goto comm_timeout
    get 1 "," $i4
    if % != 0 goto comm_timeout
    get 1 "," $i5
    if % != 0 goto comm_timeout
    get 1 "," $i6
    if % != 0 goto comm_timeout
    get 1 "," $i7
    if % != 0 goto comm_timeout
    get 1 "^mOK^m" $i8
    if % != 0 goto comm_timeout
    let $d="Unknown modem response ("+$i1+")"
    if $i1 = "0" let $d="No service"
    if $i1 = "1" let $d="Restricted service"
    if $i1 = "2" let $d="Valid service"
    if $i1 = "3" let $d="Restricted regional service"
    if $i1 = "4" let $d="Power-saving and deep sleep state"
    print $x+"- service state: "+$d+"\n"
    let $d="Unknown modem response ("+$i2+")"
    if $i2 = "0" let $d="No service"
    if $i2 = "1" let $d="Only CS service"
    if $i2 = "2" let $d="Only PS service"
    if $i2 = "3" let $d="PS+CS service"
    if $i2 = "4" let $d="CS and PS not registered, searching"
    print $x+"- domain: "+$d+"\n"    
    let $d="Unknown modem response ("+$i3+")"
    if $i3 = "0" let $d="Non roaming state"
    if $i3 = "1" let $d="Roaming state"
    print $x+"- roaming: "+$d+"\n"
    let $d="Unknown modem response ("+$i4+")"
    if $i4 = "0" let $d="Invalid USIM card state or pin code locked"
    if $i4 = "1" let $d="Valid USIM card state"
    if $i4 = "2" let $d="USIM is invalid in case of CS"
    if $i4 = "3" let $d="USIM is invalid in case of PS"
    if $i4 = "4" let $d="USIM is invalid in case of either CS or PS"
    if $i4 = "240" let $d="ROMSIM"
    if $i4 = "255" let $d="USIM card is not existent"
    print $x+"- SIM: "+$d+"\n"
    let $d="Unknown modem response ("+$i5+")"
    if $i6 != "" let $d=$i6 let $i5=""
    if $i5 = "0" let $d="No service"
    if $i5 = "1" let $d="GSM"
    if $i5 = "2" let $d="CDMA"
    if $i5 = "3" let $d="WCDMA"
    if $i5 = "4" let $d="TD-SCDMA"
    if $i5 = "5" let $d="WIMAX"
    if $i5 = "6" let $d="LTE"
    print $x+"- mode: "+$d+"\n"
    let $d="Unknown modem response ("+$i7+")"
    if $i8 != "" let $d=$i8 let $i7=""
    if $i7 = "0" let $d="No service"
    if $i7 = "1" let $d="GSM"
    if $i7 = "2" let $d="GPRS"
    if $i7 = "3" let $d="EDGE"
    if $i7 = "21" let $d="IS95A"
    if $i7 = "22" let $d="IS95B"
    if $i7 = "23" let $d="CDMA2000 1X"
    if $i7 = "24" let $d="EVDO Rel0"
    if $i7 = "25" let $d="EVDO RelA"
    if $i7 = "26" let $d="EVDO RelB"
    if $i7 = "27" let $d="HYBRID (CDMA2000 1X)"
    if $i7 = "28" let $d="HYBRID (EVDO Rel0)"
    if $i7 = "29" let $d="HYBRID (EVDO RelA)"
    if $i7 = "30" let $d="HYBRID (EVDO RelB)"
    if $i7 = "41" let $d="WCDMA"
    if $i7 = "42" let $d="HSDPA"
    if $i7 = "43" let $d="HSUPA"
    if $i7 = "44" let $d="HSPA"
    if $i7 = "45" let $d="HSPA+"
    if $i7 = "46" let $d="DC-HSPA+"
    if $i7 = "61" let $d="TD-SCDMA"
    if $i7 = "62" let $d="HSDPA"
    if $i7 = "63" let $d="HSUPA"
    if $i7 = "64" let $d="HSPA"
    if $i7 = "65" let $d="HSPA+"
    if $i7 = "81" let $d="802.16e"
    if $i7 = "101" let $d="LTE"
    print $x+"- sub mode: "+$d+"\n"
    # Invalid state do finish
    if $i2 = "1" goto abort
    if $i4 = "0" goto abort
    if $i4 = "3" goto finish
    if $i4 = "4" goto finish
    if $i4 = "255" goto finish
    # Invalid state do restart_modem
    if $i1 = "0" goto restart_modem
    if $i1 = "4" goto restart_modem
    if $i2 = "0" goto restart_modem
    if $i2 = "4" goto restart_modem
    if $i5 = "0" goto restart_modem
    goto end_sysinfo
:end_sysinfoex

49

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

Witaj,
sprawdzę kod.
A co do automatycznego restartu router-a, to raz na jakiś czas występują problemy z nawiązaniem połączenia (słaby sygnał, przez który często zrywa się połączenie) i żadne soft-resety modemu nie pomagają. Dzięki reboot-owi odzyskuję połączenie i władzę nad ruoterem, który pracuje kilkaset kilometrów ode mnie.

install.sh - Aktualizacja systemu, sysinfo.sh - Info.o systemie, openvpn-auth.sh - Login dla OpenVPN
Tu moje skrypty na GitHub

50

Odp: Modemy 3G w trybie NDIS/CDC i multiwan inaczej

Pytałem o to ponieważ restart routera nie powoduje restartu modemu. Ja używam zazwyczaj komendy AT+CFUN=1,1. Ale to też nie jest pełny reset. Najlepiej byłoby mieć router lub hub z możliwością sterowania zasilaniem portu usb.