#!/bin/bash #.Y / 70 83 / / / / 105 / / / / / / ;A4_QUER.Y #.YT 3 2 0 0 3 3 1 / / / #.H!a!0:linux//io/com/net/dsl/THIS!0.!c # # copyright : (C) 2012 by Thomas Bruecker =: tbrue # email : public0x05bf@bluewin.ch # # tbrue 13jan2012 # # io com net THIS : dsl-functions # +++++++++++++++++++++++++++++++ # # MyHash("linux//io/com/net/dsl/THIS") = ???0x084F # # * for every function: # * if returned result is not commented, the function returns 0 on no-error. SCRIPTS=root/bin . /$SCRIPTS/io/usb/THIS . /$SCRIPTS/string_/THIS dsl_isModemConnected() # checks if the dsl modem is connected to the usb-port; # returns # * "0" if the dsl-modem is connected, # * "1" if not. { usb_isDevice 100d 3342 # return result of } # "usb_isDevice ...". dsl_IsReady() # checks if dsl is ready during check-time seconds; # $1 : check-time, check-time=0: wait infinitely. # returns # * "0" if dsl is ready, # * "1" if not. { local CheckTime CheckTime="$1" if ! dsl_isModemConnected ; then return 1 fi # else if ! dsl_WaitForAtm0 $CheckTime 2 ; then return 1 fi # else dsl_WaitForDsl $CheckTime 2 # return result of } # "dsl_WaitForDsl ...". dsl_WaitForAtm0() # checks if atm0 is ready during check-time seconds; # $1 : check-time, check-time = 0: wait infinitely; # $2 : # spaces to print before the message; # returns # * "0" if atm0 is ready, # * "1" if not. { local CheckTime I Result CheckTime="$1" # pass # * if 0 == $CheckTime : 0 # * else : $CheckTime = $CheckTime + 1 if [ 0 != $CheckTime ]; then (( CheckTime++ )) fi string_Spaces $2 ; echo -n "wait for atm : " Result=1 # still no atm. for(( I = 1; I != CheckTime; I++ )); do if [ -f /proc/net/atm/cxacru:0 ]; then Result=0 break fi echo -n "." # 'entertainment'. sleep 1 done echo "" return $Result } dsl_WaitForDsl() # checks if dsl is ready during check-time seconds; # $1 : check-time, check-time = 0: wait infinitely; # $2 : # spaces to print before the message; # returns # * "0" if dsl is ready, # * "1" if not. { local CheckTime I Result CheckTime="$1" # pass # * if 0 == $CheckTime : 0 # * else : $CheckTime = $CheckTime + 1 if [ 0 != $CheckTime ]; then (( CheckTime++ )) fi string_Spaces $2 ; echo -n "wait for dsl : " Result=1 # still no dsl. for(( I = 1; I != CheckTime; I++ )); do if grep -q "Line up" /proc/net/atm/cxacru:0 ; then Result=0 break fi echo -n "." # 'entertainment'. sleep 1 done echo "" return $Result }