(R)e: [PLUTO-help] modem usb WS-AD80USG
Rex Sanna
77512746 a tiscali.it
Gio 15 Maggio 2003 01:41:56 CEST
De : " modem usb WS-AD80USG "
# > Andiamo per tentativi:
Pessima idea..
[Almeno se hai gia' uno script che ti da una mano.. ;o) ]
Esegui il tuo script modificato [puoi leggerlo tranquillamente, ti risolve molte domande..]
e vedi che cosa ti dice..
Ricorda che e' utile compilare il tutto nel kernel se utilizzi
un PC che vuoi collegare tutte le volte che lo accendi,
o se lo lasci perennemente connesso..
--
# ######################## Manuel (R)ex Sanna ############################
# I computers non servono a niente. Danno solo risposte.. -- Pablo Picasso
# ########################################################################
-------------- parte successiva --------------
# ### (R)ex Hacked Script
#
# Author : Jean-Sebastien VALETTE <jean-sebastien.valette a libertysurf.fr>
# Creation : 06/12/2001
# Licence : GPL
# 23/10/2002 wwp:
# removed ugly hardcoded pathes, used new scheme.
# 21/10/2002 wwp:
# default .bin is synch01.bin now, /etc/eciadsl/synch.bin is a symlink to this one!
# removed ugly modutils uses, added some delays.
# 03/02/2002: added a sleep 2 after loading USB controller driver, as suggested
# by Sebastien YAPO <sebastien.yapo a free.fr>.
# 07/02/2002: added the CVS Id
# CVS $Id: startmodem,v 1.52 2002/12/24 21:48:23 wwp Exp $
# Tag $Name: release-0-7 $
# 15/02/2002 Benoit PAPILLAULT
# remove "modprobe uhci" since this module never worked with this modem
# 13/06/2002 Sebastien HELLEU <flashcode a free.fr>
# new file: /etc/eciadsl/vidpid : contains vid/pid (1 & 2) for your modem
# example of content ECI: 0547 2131 0915 8000
# 03/07/2002 Sebastien HELLEU <flashcode a free.fr>
# new file: /etc/eciadsl/eci_wan.bin (created by Makefile and eciconf) :
# this is a link to your .bin
# to change your .bin file, run eciconf or type this command :
# rm /etc/eciadsl/eci_wan.bin && ln -s /path/your.bin /etc/eciadsl/eci_wan.bin
# 14/5/2003 (R)ex Sanna <77512746 a tiscali.it>
# Traduzione in italiano e modifica dei banner intermedi di connessione.
# Inserimento e commento di una configurazione.
#
function wait_for_iface()
{
echo ""
echo "# ###################################"
echo "# Imposto tabella di routing [5/5]"
echo "# ###################################"
# Attendo che ppp0 diventi disponibile
COUNTER=10
FLREADY=0
TIMES=1
while [ $TIMES -le $COUNTER ]; do
ifconfig $1> /dev/null 2>&1
if [ $? -eq 0 ]; then
FLREADY=1
break
fi
sleep 1
TIMES=$(expr $TIMES + 1)
done
echo
if [ "$FLREADY" -eq 0 ]; then
echo "# ERRORE : Dispositivo $1 non trovato.."
exit -1
else
echo "# Impostazione correttamente eseguita su $1"
fi
}
# <CONFIG>
BIN_DIR="/usr/local/bin"
ETC_DIR="/etc"
CONF_DIR="/etc/eciadsl"
PPPD_DIR="/etc/ppp"
VERSION="0.7"
# </CONFIG>
if [ "$1" == "--version" -o "$1" == "-v" ]; then
echo "$VERSION"
exit 0
fi
if [ -s "$CONF_DIR/eciadsl.conf" ]; then
vid1=`grep -E "^[ \t]*VID1[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -1 | cut -f 2 -d '=' | tr -d " \t"`
pid1=`grep -E "^[ \t]*PID1[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -1 | cut -f 2 -d '=' | tr -d " \t"`
vid2=`grep -E "^[ \t]*VID2[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -1 | cut -f 2 -d '=' | tr -d " \t"`
pid2=`grep -E "^[ \t]*PID2[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -1 | cut -f 2 -d '=' | tr -d " \t"`
mode=`grep -E "^[ \t]*MODE[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -1 | cut -f 2 -d '=' | tr -d " \t"`
firmware=`grep -E "^[ \t]*FIRMWARE[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -1 | cut -f 2 -d '=' | tr -s "\t" " "`
synch=`grep -E "^[ \t]*SYNCH[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -1 | cut -f 2 -d '=' | tr -s "\t" " "`
staticip=`grep -E "^[ \t]*STATICIP[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -1 | cut -f 2 -d '=' | tr -d " \t"`
gateway=`grep -E "^[ \t]*GATEWAY[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -1 | cut -f 2 -d '=' | tr -d " \t"`
use_staticip=`grep -E "^[ \t]*USE_STATICIP[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -1 | cut -f 2 -d '=' | tr -d " \t"`
use_dhcp=`grep -E "^[ \t]*USE_DHCP[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -1 | cut -f 2 -d '=' | tr -d " \t"`
eciload1_options=`grep -E "^[ \t]*ECILOAD1_OPTIONS[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -1 | cut -f 2 -d '=' | tr -s "\t" " "`
eciload2_options=`grep -E "^[ \t]*ECILOAD2_OPTIONS[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -1 | cut -f 2 -d '=' | tr -s "\t" " "`
pppoeci_options=`grep -E "^[ \t]*PPPOECI_OPTIONS[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -1 | cut -f 2 -d '=' | tr -s "\t" " "`
synch_attempts=`grep -E "^[ \t]*SYNCH_ATTEMPTS[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -1 | cut -f 2 -d '=' | tr -d " \t"`
else
echo ""
echo "# ###################################"
echo "# Non ho trovato il file di conf."
echo "# Imposto la configurazione di default.."
echo "# ###################################"
fi
test -z "$vid1" && vid1="0547"
test -z "$pid1" && pid1="2131"
test -z "$vid2" && vid2="0915"
test -z "$pid2" && pid2="8000"
test -z "$mode" && mode="$($BIN_DIR/pppoeci --modes 2>&1 | grep default |cut -d ' ' -f 1)"
test -z "$firmware" && firmware="$CONF_DIR/firmware00.bin"
test -z "$synch" && synch="$CONF_DIR/synch01.bin"
test -z "$synch_attempts" && synch_attempts=1
ps ax | grep pppoeci | grep -v grep > /dev/null 1>&1
if [ $? -eq 0 ]
then
echo "# ### ATTENZIONE !!! ########### "
echo "# Processo gia' in esecuzione."
echo "# Dovresti ucciderlo tu.. [pppoeci]"
echo "# ##################################"
exit -1
fi
echo "# ###################################"
echo "# Supporto USB [1/5]"
echo "# ###################################"
if [ ! -d /proc/bus/usb ]; then
modprobe usbcore > /dev/null
sleep 1
fi
# ### MODULI USB :
# Nel caso non avessi compilato il kernel per avere il supporto
# USB necessiti di caricarne il modulo.
# Se prospetti di collegare la tua macchina 24/7 ad internet,
# ti consiglio di inserire il supporto USB direttamente nel kernel.
#
if [ ! -f /proc/bus/usb/devices ]; then
mount -t usbdevfs none /proc/bus/usb
sleep 1
mount | grep usbdevfs > /dev/null
if [ $? -eq 0 ]; then
echo "# Impossibile montare il FS USB.."
else
echo "# USB dev montati correttamente."
fi
fi
# ########################################################################
# ### DABUSB : [MODULO]
# Questo script serve per controllare se il modulo dabusb e' attualmente
# caricato nel sistema.
# Procede alla rimozione dello stesso.
#lsmod | grep dabusb > /dev/null
#if [ $? -eq 0 ]; then
# echo -e "\ndabusb seems to be present trying to remove it..."
# modprobe -r dabusb
# #sleep 1
# lsmod | grep dabusb > /dev/null
# if [ $? -eq 0 ]; then
# echo "couldn't remove dabusb try to rmmod dabusb manually"
# else
# echo "dabusb removed successfully"
# fi
#fi
# ########################################################################
# ### EHCI-HDC : [MODULO]
# Rimuove il supporto EHCI-HDC
#
#lsmod | grep ehci-hcd > /dev/null
#if [ $? -eq 0 ]; then
# echo -e "\nehci-hcd seems to be present trying to remove it..."
# modprobe -r ehci-hcd
# sleep 1
# lsmod | grep ehci-hcd > /dev/null
# if [ $? -eq 0 ]; then
# echo "couldn't remove ehci-hcd try to rmmod ehci-hcd manually"
# else
# echo "ehci-hcd removed successfully"
# fi
#fi
# ########################################################################
# ### UHCI controller : [MODULO]
# Controlla se il controller UHCI e' sul sistema.
#
grep -A 4 USB /proc/pci | grep I/O > /dev/null
if [ $? -eq 0 ]; then
grep "^S: Product=USB UHCI Root Hub" /proc/bus/usb/devices > /dev/null
if [ $? -ne 0 ]; then
modprobe -l | grep usb-uhci > /dev/null
if [ $? -ne 0 ]; then
echo "# ATTENZIONE!!! Il modulo usb-uhci non esiste.. "
else
modprobe usb-uhci
sleep 2
lsmod | grep usb-uhci > /dev/null
if [ $? -ne 0 ]; then
echo "# Impossibile caricare il modulo usb-uhci."
else
echo "# Modulo usb-uhci caricato correttamente.."
fi
fi
fi
fi
# ########################################################################
# ### OHCI controller : [MODULO]
#
#grep -A 4 USB /proc/pci | grep memory > /dev/null
#if [ $? -eq 0 ]; then
# # ok, we have a OHCI controller, check if the linux driver is loaded
# grep "^S: Product=USB OHCI Root Hub" /proc/bus/usb/devices > /dev/null
# if [ $? -ne 0 ]; then
# echo -e "\nloading OHCI support"
# modprobe -l | grep usb-ohci > /dev/null
# if [ $? -ne 0 ]; then
# echo "warning: usb-ohci module doesn't exist"
# else
# modprobe usb-ohci
# sleep 2
# lsmod | grep usb-ohci > /dev/null
# if [ $? -ne 0 ]; then
# echo "couldn't load usb-ohci module"
# else
# echo "usb-ohci loaded successfully"
# fi
# fi
# fi
#fi
# ########################################################################
# ### Supporto TAP/TUN : [MODULO]
# Questo supporto e' il modo per utilizzare pppoe.
#
#case "$mode" in
#"LLC_SNAP_RFC1483_BRIDGED_ETH_NO_FCS"|"VCM_RFC_1483_BRIDGED_ETH"|"LLC_RFC1483_ROUTED_IP"|"VCM_RFC1483_ROUTED_IP")
# # load tap/tun module
# echo -e "\nloading TAP/TUN support"
# modprobe -l | grep -E "/tun\." > /dev/null
# if [ $? -ne 0 ]; then
# echo "# ATTENZIONE!!! Il modulo tun non e' presente."
# else
# modprobe tun
# sleep 2
# lsmod | grep -E "^tun[ \t]" > /dev/null
# if [ $? -ne 0 ]; then
# echo "# Impossibile caricare il supporto tun."
# else
# echo "# Modulo tun caricato correttamente."
# fi
# fi
# # verify that /dev/net/tun exists
# if [ ! -c /dev/net/tun ]; then
# echo "# ATTENZIONE!!! "
# echo "# Il dispositivo /dev/net/tun non esiste!!"
# exit -1
# fi
# ;;
#esac
# ### Controllo HDLC : [MODULO]
# Controllo se il supporto HDLC e' correttamente
# caricato sul sistema..
#
"$BIN_DIR/check-hdlc" > /dev/null
if [ $? -ne 0 ]; then
lsmod | grep n_hdlc > /dev/null
if [ $? -ne 0 ]; then
modprobe -l | grep n_hdlc > /dev/null
if [ $? -ne 0 ]; then
echo "# ATTENZIONE!!! "
echo "# Il supporto HDLC non e' presente."
else
modprobe n_hdlc
sleep 1
lsmod | grep n_hdlc > /dev/null
if [ $? -ne 0 ]; then
echo -e "# Impossibile caricare il modulo."
else
echo -e "# Modulo caricato con successo.."
fi
fi
fi
fi
echo "# ###################################"
echo "# Carico il firmware [2/5]"
echo "# ###################################"
# ### Supporto EZ-USB chip :
# Controllo la presenza del modulo necessario.
# Se non e' presente, lo considero correttamente caricato
# e procedo tranquillamente..
grep "^P: Vendor=$vid1 ProdID=$pid1" /proc/bus/usb/devices > /dev/null
if [ $? -eq 0 ]; then
"$BIN_DIR/eci-load1" $eciload1_options
if [ $? -ne 0 ]; then
echo "# Impossibile caricare il firmware."
exit -1
fi
echo "# Modulo correttamente caricato."
else
grep "^P: Vendor=$vid2 ProdID=$pid2" /proc/bus/usb/devices > /dev/null
if [ $? -eq 0 ]; then
echo "# firmware gia' presente."
else
echo "# ATTENZIONE!!! "
echo "# Impossibile trovare il modem."
echo "# "
echo "# Sei pregato di scollegare fisicamente il modem "
echo "# attendere qualche secondo [5] e ricollegarlo.."
echo "# - In particolare se hai appena riavviato "
echo "# - da un altro sistema operativo."
exit -1
fi
fi
echo "# ###################################"
echo "# Accensione del modem [3/5]"
echo "# ###################################"
echo -n "# "
CNT=1
RET=$CNT
while [ $CNT -le $synch_attempts -a $RET -ne 0 ]; do
"$BIN_DIR/eci-load2" $eciload2_options
RET=$?
sleep 1
CNT=$(expr $CNT + 1)
done
if [ $RET -eq 0 ]; then
echo "# Sincronizzazione completata."
echo ""
else
echo "# ATTENZIONE!!! "
echo "# Impossibile sincronizzare il modem."
echo "# "
echo "# Sei pregato di scollegare fisicamente il modem "
echo "# attendere qualche secondo [5] e ricollegarlo.."
echo "# - In particolare se hai appena riavviato "
echo "# - da un altro sistema operativo."
exit -1
fi
echo "# ###################################"
echo "# Attivo connessione [4/5]"
echo "# ###################################"
GW=""
case "$mode" in
"VCM_RFC2364"|"LLC_RFC2364")
nice --20 pppd call adsl updetach
if [ $? -ne 0 ]; then
echo "# Connessione impossibile."
exit -1
fi
echo "#"
echo "# Connessione avvenuta con successo."
echo "# Buona navigazione."
wait_for_iface ppp0
GW=ppp0
;;
"LLC_SNAP_RFC1483_BRIDGED_ETH_NO_FCS"|"VCM_RFC_1483_BRIDGED_ETH")
$BIN_DIR/pppoeci $pppoeci_options
if [ $? -ne 0 ]; then
echo "# Connessione impossibile."
exit -1
fi
echo "#"
echo "# Connessione avvenuta con successo."
echo "# Buona navigazione."
ifconfig tap0 up
wait_for_iface tap0
GW=tap0
;;
"LLC_RFC1483_ROUTED_IP"|"VCM_RFC1483_ROUTED_IP")
$BIN_DIR/pppoeci $pppoeci_options
if [ $? -ne 0 ]; then
echo "# Connessione impossibile."
exit -1
fi
echo "#"
echo "# Connessione avvenuta con successo."
echo "# Buona navigazione."
ifconfig tun0 up
wait_for_iface tun0
GW=tun0
;;
*) echo "# Modulo PPP ($mode), errato. Controlla la tua configurazione drivers."
;;
esac
if [ "$use_dhcp" != "yes" ]
then
DEV="$GW"
case "$GW" in
tap0|tun0)
if [ "$use_staticip" == "yes" -a -n "$staticip" -a -n "$gateway" ]
then
ifconfig $GW $staticip pointopoint $gateway
GW="gw $gateway"
else
echo "# Impossibile impostare un indirizzo IP statico o il tuo"
echo "# gateway esterno. Se non stai utilizzando PPPoE"
echo "# necessiti di ricontrollare la tua configurazione."
exit -1
fi
;;
*) GW="dev $GW"
;;
esac
if [ -n "$GW" ]
then
for IFACE in 0 1; do
route -n | grep -E "[ \t]UG[ \t][ \t0-9\+\-]+eth$IFACE$" > /dev/null
if [ $? -eq 0 ]; then
echo "# Rimozione della tabella di routing attuale. [eth$IFACE]"
route del default dev eth$IFACE
fi
done
echo "# Impostazione della tabella di routing :"
route -n | grep -E "[ \t]UG[ \t][ \t0-9\+\-]+$DEV$" > /dev/null
if [ $? -ne 0 ]; then
route add default $GW
if [ $? -ne 0 ]; then
echo "# Impossibile impostare $DEV come default route."
else
echo "# Route $DEV impostata con successo."
fi
else
echo "# Route $DEV gia' presente.."
fi
fi
fi
exit 0
More information about the pluto-help
mailing list