paquet binaire Debian |-- etc -- network | `-- udev `- if-down.id | | |--- usbdsl-static-updown | |---- rules.d `-- usbdsl-updown | `-- scripts `------- 1x-{modem usb}-udev.rules* |-- lib `-------- usb-adsl | `-- firmware `- usr `-{modem usb}* |-- sbin `-- [firmwares du modem] | |--- config-usbdsl | `-- ueaglediag** `-- share `-- doc `--- {modem usb}* |--- changelog |--- fai-isp.txt |--- fai-isp.html |--- install-fr.txt `-- copyright
*fonction du nom du paquet Debian **Uniquemenent paquet Debian "ueagle" &"ueagle4" (Sagem)
Exemple avec le modem Sagem f@st (ueagle) :
sudo /usr/sbin/config-dslusb -h -h -help : afficher l'aide-mémoire usage : sudo /usr/sbin/config-dslusb {KEY} Liste des FAI (ISP) pour connaître la valeur de {KEY} : /usr/share/doc/ueagle/fai-isp.html -test : simulation et information sur votre connexion -v : version
Merci de lire les scripts que vous pouvez modifier, adapter, et d'apporter vos remarques pour son amélioration.
Script /etc/udev/rules.d/1x-{modem usb}-udev.rules
(Speed Touch THOMSON)
# Speed Touch THOMSON #Si modem branché BUS=="usb", ATTRS{idVendor}=="06b9", ATTRS{idProduct}=="4061", SYMLINK+="adsl_speedtch", RUN+="/etc/udev/scripts/usb-adsl"
Script /etc/udev/scripts/usb-adsl
#!/bin/sh # modem usb if [ -e /etc/udev/scripts/state.txt ]; then exit 0 ; fi echo "up" > /etc/udev/scripts/state.txt # marqueur /sbin/ifdown --force ppp0 >/dev/null ( while ! grep -q '1' /sys/class/atm/?*/carrier ; do sleep 1 ; done ; /sbin/ifup ppp0 rm -f /etc/udev/scripts/state.txt )&
Script /usr/sbin/config-dslusb
Sagem, SpeedTouch, zte-zxdsl852
#!/bin/sh # Configuration d'une connexion internet # pour modem usb # Mode : pppoA, ppp0E, IP static # # cosmétique CYAN="\\033[1;36m" BASE="\\033[0;m" LIGNE=16 # quelques variables DOC=ueagle DOC=SpeedTouch DOC=zte-zxdsl852 MODULE=ueagle_atm MODULE=speedtch MODULE=zte-zxdsl852 ISP_LIST=/usr/share/doc/$DOC/fai-isp.txt # ISP/FAI DSL_PROV=/etc/ppp/peers/dsl-provider # config cnx PAP_SECRT=/etc/ppp/pap-secrets # login & password CHAP_SECRT=/etc/ppp/chap-secrets # login & password Encapsulation INTERFACE=/etc/network/interfaces # interface réseau DSL_UPDOWN=/etc/network/if-down.d/usbdsl-updown # pppoe, pppoA UDEV_USB=/etc/udev/scripts/usb-adsl # script udev RESOLVCONF=/etc/resolv.conf ecran() { clear # + propre :) printf "\n$CYAN \t\t\t\t\t\###/\n\t\t\t\t\t(° °)\n\t*--------------------------- oOOo-(_)-oOOo----------------------*" printf "\n\t|\tFournisseur d'accès Internet sélectionné :$BASE $KEY $CYAN| \n\t*--------------------------------------------------------------*" } erreur() # affiche erreur { echo -n "\n\t$CYAN " case "$INF_ERR" in 0) echo "Vous devez avoir les droits administrateur (root)." ;; 1) echo "sudo /usr/bin/config-dslusb -h -help" ;; 2) echo "Erreur de saisie (FAI/ISP) KEY = [A-Z]+[A-Z]+[0-9]+[0-9] \n\t Ex : Belgium Tiscali BE :$BASE BE01" ;; 3) echo "Aucune réponse pour $KEY !" ;; 4) echo "Vérifier le branchement USB du modem" ;; 5) echo "Vérifier l'installation logiciel du pilote" ;; 6) echo "Erreur : liaison téléphonique ou configuration du modem" ;; 7) echo "Vérifier ou refaire la configuration de votre connexion (FAI)" ;; 8) echo "Abandon !" ;; *) echo "Erreur script" ;; esac echo "$BASE" exit 0 } options() # affiche options { connex=0 x=0 temps=60 # compteur 60s echo -n "\n\t$CYAN" case "$INF_OPT" in h | help) echo "-h -help :\t afficher l'aide-mémoire \n\tusage : sudo /usr/sbin/config-dslusb {KEY}\n\tListe des FAI (ISP) pour connaître la valeur de {KEY} : \n\t-upgrade : copie du firmware pour mise à jour du noyau \n\t-upgrade : copie du firmware pour mise à jour du noyau \n\t/usr/share/doc/$DOC/fai-isp.html\n\t-test : simulation et information sur votre connexion\n\t-v : version";; v | V) echo "Version 0.3.0\n\tGNU General Public License version 2 \n\tCopyright (C) 2007 by Catherine Bozzi-Guerrero \n\tCopyright (C) 2006 by Matthieu CASTET\n\tCopyright (C) 2007 by Thierry VALENTE" ;; test) KEY="`grep -m 1 '#' $DSL_PROV | cut -c3-6 -`" ecran # Arret du modem killall -HUP pppd 2> /dev/null modprobe -fr $MODULE # Essai modem, pilote et cnx modprobe -Q $MODULE INF_ERR=0 for connex in 0 1 2 3 4 for connex in 0 1 2 3 for connex in 0 1 2 3 do while [ $x -lt $temps ] ; do sleep 1 ; x=$(($x+1)) ; cnx_modem # statut modem done done # Si erreur affiche message if [ $INF_ERR != 0 ] ; then erreur plog fi ;; upgrade) cp $FIRMWARE /lib/firmware/$(uname -r) printf "\t copie du firmware pour le noyau (kernel) $BASE $(uname -r)" ;; upgrade) cp $FIRMWARE /lib/firmware/$(uname -r) printf "\t copie du firmware pour le noyau (kernel) $BASE $(uname -r)" ;; *) echo "-h -help" ;; esac echo "$BASE" exit 0 } time() { tput cup 6 20 ; printf "$BASE $x" } cnx_modem() { local FILE_MODEM="/sys/bus/usb/drivers/ueagle-atm/*0/stat_human_status" local FILE_MODEM="/sys/class/atm/$MODULE*/carrier" local FILE_MODEM="/sys/class/atm/$MODULE*/carrier" tput cup 6 9 ; printf "$CYAN Compteur :$BASE $x %20b" case "$connex" in 0) # Brancher modem if [ "`lsusb | grep -o 1110`" = "1110" ] ; then break else time ; tput cup 6 23 ; printf "$CYAN Brancher le modem !" INF_ERR=4 fi ;; 1) # type drivers if [ "`lsmod | grep -m 1 -o $MODULE`" = "$MODULE" ] ; then tput cup 7 10 ; printf "$CYAN Pilote du modem :$BASE `lsmod | grep -m 1 -o $MODULE` \n\t$CYAN Srcversion: :$BASE `modinfo $MODULE | grep srcversion | cut -c17-38 -` \n\t$CYAN Description :$BASE `modinfo -d $MODULE`" # type de modem --------- Sagem uniquement ! -------------- case $(lsusb -d 1110: | cut -c31-32 -) in 0f | 10) CHIPSET="Eagle I" ;; 21 | 22) CHIPSET="Eagle II" ;; 23 | 24) CHIPSET="Eagle IIc" ;; 31 | 32) CHIPSET="Eagle III" ;; 41 | 42) CHIPSET="Eagle IV" ;; *) CHIPSET="ADI/Ikanos inconnu" ;; esac time tput cup 10 10 ; printf "$CYAN Modem de type :$BASE $CHIPSET" break else INF_ERR=5 fi ;; 2) # Statut modem while [ ! -f $FILE_MODEM ] ; do sleep 1 ; done tput cup 11 10 ; printf "$CYAN Synchronisation : $BASE" if [ "`grep "operational" $FILE_MODEM`" = "Modem is operational" ] ; then tput cup 11 29 ; printf "`cat $FILE_MODEM` " time ; break else time tput cup 11 29 ; printf "`cat $FILE_MODEM` " INF_ERR=6 fi ;; 3) # Statut connexion time tput cup 12 30 ; echo "$CYAN Connexion internet :" if [ "`ip a s | grep -o peer`" = "peer" ] ; then echo "\t$CYAN \tAdresse MAC :$BASE `cat /proc/net/atm/ueagle-atm\:* | grep MAC | sed 's/MAC: //'`" echo "\t$CYAN \tinet adr :$BASE`ip a s | grep peer | sed -e 's/inet //;s/scope global //'`" break else INF_ERR=7 fi ;; 4) # Status de la cnx --------- Sagem uniquement ! ----------- for DIR in $(ls -d /sys/bus/usb/drivers/ueagle-atm/*0 2>/dev/null) do ID=$(basename $DIR) ID=${ID%%:*} DIRM=/sys/bus/usb/devices/$ID tput cup 15 30 ; printf "$CYAN Status display :\n" printf "\t$CYAN Vendor ID :$BASE 0x%x $CYAN Product ID :$BASE 0x%x $CYAN Rev:$BASE 0x%x" "0x`cat $DIRM/idVendor`" "0x`cat $DIRM/idProduct`" "0x`cat $DIRM/bcdDevice`" if [ "$(( 0x$(cat $DIRM/bcdDevice) & 0x80 ))" = 0 ] then printf "(%s)\n" "pots" else printf "(%s)\n" "isdn" fi printf "\t$CYAN USB Bus :$BASE %03d\t\t$CYAN USB Device :$BASE %03d\t$CYAN Dbg :$BASE %d \n" ${ID%%-*} $(cat $DIRM/devnum) $(</sys/module/$MODULE/parameters/debug) if [ -e $DIR/stat_firmid ] ; then printf "\t$CYAN VID-CPE $BASE %10d $CYAN Firmware version $BASE %08x\n" 0x$(cat $DIR/stat_vidcpe) 0x$(cat $DIR/stat_firmid) else printf "\t$CYAN VID-CPE $BASE %10d\n" 0x$(cat $DIR/stat_vidcpe) fi printf "\t$CYAN Tx Rate $BASE %10d Kps $CYAN Rx Rate $BASE %10d Kps\n" 0x$(cat $DIR/stat_usrate) 0x$(cat $DIR/stat_dsrate) printf "\t$CYAN Tx Atten $BASE %10d dB $CYAN Rx Atten $BASE %10d dB\n" 0x$(cat $DIR/stat_usattenuation) 0x$(cat $DIR/stat_dsattenuation) printf "\t$CYAN Tx Margin $BASE %10d dB $CYAN Rx Margin $BASE %10d dB\n" 0x$(cat $DIR/stat_usmargin) 0x$(cat $DIR/stat_dsmargin) printf "\t$CYAN Tx Blocks $BASE %10d $CYAN Rx Blocks $BASE %10d\n" 0x$(cat $DIR/stat_txflow) 0x$(cat $DIR/stat_rxflow) printf "\t$CYAN Tx FEC $BASE %10d $CYAN Rx FEC $BASE %10d\n" 0x$(cat $DIR/stat_uscorr) 0x$(cat $DIR/stat_dscorr) printf "\t$CYAN Tx Error $BASE %10d $CYAN Rx Error $BASE %10d\n" 0x$(cat $DIR/stat_usunc) 0x$(cat $DIR/stat_dsunc) FLAGS="0x$(cat $DIR/stat_mflags)" printf "\t$CYAN Delin $BASE %5s" "$(cat $DIR/stat_delin)" printf "\t $CYAN Flags $BASE %10.10x\n" $FLAGS done break ;; esac } get_ip() { LIGNE=17 # cosmetic local COUNT=1 while [ 1 -eq 1 ] ; do tput cup 14 10 ; printf "\t$CYAN l'adresse IP" tput cup 16 0 ; printf "\t$CYAN Adresse IP ==> $BASE" ; read reponse echo $reponse | grep -Eq "^((2([0-4][0-9]|5[0-5])|[01]?[0-9]?[0-9])\.){3}(2([0-4][0-9] |5[0-5])|[01]?[0-9]?[0-9])$" if [ $? -eq 0 ] ; then IP_STATIC=$reponse tput cup 16 39 ; printf "%30b" # cosmétique return 0 else [ $COUNT -eq 3 ] ; COUNT=$(($COUNT+1)) tput cup 16 15 ; printf "%28b $CYAN adresse IP invalide !" fi done } affich_encapsul() { case "$num_encaps" in 1) ref_encap="2516, Bridged PPPoE LLC" ;; 3) ref_encap="1483/2684, Routed IP LLC-SNAP" ;; 4) ref_encap="1483/2684, Routed IP (IPoA) VCmux" ;; 5) ref_encap="2364, PPPoA LLC" ;; 6) ref_encap="2364, PPPoA VCmux" ;; *) ref_encap="" ;; esac tput cup 8 10 ; printf "$CYAN\n\t Encapsulation :$BASE $num_encaps - RFC$ref_encap" } modif_encap() # Menara Telecom { tput cup 15 0 ; printf "\t$CYAN Selectionner le type d'encapsulation : \n\t$BASE 1$CYAN PPPoE LLC,$BASE 5$CYAN PPPoA LLC,$BASE 6$CYAN PPPoA VCmux, $BASE M$CYAN Menara/PPPoE/ANSI-T1.413,\n\t Votre réponse :$BASE " read select_encap case "$select_encap" in M | m) sed "s/ueagle-atm/ueagle-atm cmv_file=CMVepMA01.bin debug=2 use_iso=0,0,0,0/g;" udev.tmp >$UDEV_USB mv -f $UDEV_USB udev.tmp num_encaps=1 affich_encapsul ;; 1 | 5 | 6) num_encaps=$select_encap affich_encapsul ;; *) INF_ERR=8 ; erreur ;; esac } ## Début if [ -z $1 ] ; then INF_ERR=1 ; erreur # Vérifier si "root" et la saisie de KEY=$1 elif [ `id -un` != "root" ]; then INF_ERR=0 ; erreur # root elif [ `echo $1 | cut -c1-1 -` = \- ] ; then INF_OPT=`echo $1 | cut -c2- -` options fi if [ ! -z `echo $1 | cut -c5 -` ] ; then INF_ERR=2 ; erreur # + de 5 caractères elif [ `echo $1 | wc -m` -ne 5 ] ; then INF_ERR=2 ; erreur # - de 4 caractères fi INF_OPT=`echo $1 | cut -c1-2 - | sed '/[0-9]/d'` # 2 caratères alpha if [ -z $INF_OPT ] ; then INF_ERR=2 ; erreur fi INF_OPT=`echo $1 | cut -c3-4 - | sed '/[a-z A-Z]/d'` # 2 caratères numériques KEY=`echo $1 | tr 'a-z' 'A-Z'` ISP_SEARCH=$(grep -m 1 $KEY $ISP_LIST) if [ -z $INF_OPT ] ; then INF_ERR=2 ; erreur elif [ -z $ISP_SEARCH ]; then INF_ERR=3 ; erreur # pas de FAI trouvé fi # clean fichiers et affiche résultat grep -B 100 modem-usb $INTERFACE >interface.tmp sed "s/cmv_file=CMVepMA01.bin debug=2 use_iso=0,0,0,0//g;" $UDEV_USB >udev.tmp sed "/br2684/d" $DSL_UPDOWN >dslupdown.tmp echo "# $KEY \n# `date`" >$DSL_PROV # FAI + date ecran SAUV_IFS=$IFS; IFS=";" # sauver, modifier séparateur champ set -a $ISP_SEARCH IFS=$SAUV_IFS printf "\n\t Nom du FAI :$BASE $2\n\t$CYAN Pays :\t$BASE$3$CYAN VPI :$BASE $4$CYAN VCI :$BASE $5$CYAN (hexa :$BASE $6 $CYAN) Connexion :$BASE $8" num_encaps=$7 affich_encapsul # affiche n° RFC if [ -n "${10}" ]; then printf "$CYAN\n\t Login/pwd :$BASE ${10}" ; fi if [ -n "${11}" ]; then printf "$CYAN\n\t DNS 1 \t: $BASE ${11}" ; fi if [ -n "${12}" ]; then printf "$CYAN\t DNS 2 \t: $BASE ${12}" ; fi if [ -n "${13}" ]; then printf "$CYAN\n\t DNS 3 \t: $BASE ${13}" ; fi if [ -n "$9" ]; then printf "\t$CYAN Chiffrage :$BASE x" ; fi if [ -n "${14}" ]; then printf "\n\t$CYAN Type de modem :$BASE ${14}" ; fi # modem Sagem if [ $7 = "?" ]; then modif_encap # Selection encapsulation MA01 & SN01 while [ $? -eq 1 ] ; do modif_encap ; done ; tput cup 15 0 ; printf "%80b\n%80b\n%30b" # cosmétique fi tput cup 14 0 ; printf "\t$CYAN Validez votre choix : O (oui) puis [Entrée] pour continuer.$BASE " read clavier case `echo ${clavier}N | cut -c1` in O | o | Y | y) # O/oui ;; *) INF_ERR=8 ; erreur ;; esac ## fichiers dsl-provider et interfaces PRE_PPP="pre-up /etc/network/if-down.d/usbdsl-updown \$IFACE" PRE_IPoA="pre-up /etc/network/if-down.d/usbdsl-static-updown \$IFACE" # pour la connexion pppoe br2684ctl="modprobe -q br2684 \n /usr/sbin/br2684ctl -b -c 0 -e 0 -a $4.$5" # login tput cup 14 0 printf "\t$CYAN Saisir l'identifiant attribué par votre FAI et [Entrée]%5b\n%70b \n%70b" tput cup 15 9 ; printf "login ==> $BASE" read login echo "user \"$login\"" >>$DSL_PROV case "$num_encaps" in 1) echo "plugin rp-pppoe.so \nnas0 \nmtu 1200" >>$DSL_PROV echo "auto nas0 \niface nas0 inet ppp" >>interface.tmp sed -e "s/ppp0/nas0/g;" udev.tmp >$UDEV_USB # ajout module br2684ctl (encaps=0 !) sed -e "s/pppoatm/pppoe/g;s/ppp0/nas0/g;/pre-up)/a\ $br2684ctl" dslupdown.tmp >$DSL_UPDOWN # mode pppoE possible ? if ! [ -e /usr/sbin/br2684ctl ]; then printf "\n\t$CYAN Avertissement : Vous devez installer le paquet Debian \n\t suivant :$BASE br2684ctl$CYAN pour votre accès internet.\n" fi ;; 6 | 5) # 6 - RFC2364, PPPoA VCmux # 5 - RFC2364, PPPoA LLC echo "plugin pppoatm.so $4.$5 \nmtu 1500" >>$DSL_PROV echo "auto ppp0 \niface ppp0 inet ppp" >>interface.tmp sed -e "s/nas0/ppp0/g;" udev.tmp >$UDEV_USB sed -e "s/pppoe/pppoatm/g;s/nas0/ppp0/g;" dslupdown.tmp >$DSL_UPDOWN ;; 4) get_ip sed -e "s/ppp0/atm0/g;s/nas0/atm0/g" udev.tmp >$UDEV_USB echo "auto atm0 \niface atm0 inet static\n$PRE_IPoA\naddress $IP_STATIC" >>interface.tmp echo "netmask 255.255.255.0 \nmtu 1500 \nvpi $4 \nvci $5" >>interface.tmp echo "nameserver ${11} \nnameserver ${12} \nnameserver ${13}" >$RESOLVCONF ;; 3 | *) echo "# $num_encaps $ref_encap" >$DSL_PROV printf "\n\t$CYAN Désolé, vous devez faire une configuration manuel. \n\t Encapsulation :$BASE $num_encaps - RFC$ref_encap\n\t valente2005[at]voila[dot]fr" exit 0 ;; esac # options communes ppp0/nas0 if [ "$num_encaps" != 4 ] ; then echo -n "provider dsl-provider\npre-up $PRE_PPP\npre-down $PRE_PPP" >>interface.tmp echo "noipdefault \nusepeerdns \ndefaultroute \npersist \nnoauth" >>$DSL_PROV fi mv -f interface.tmp $INTERFACE chmod +x $UDEV_USB # script éxecutable chmod +x $DSL_UPDOWN rm -f *.tmp # efface les "tmp" # password tput cup 14 15 printf "$CYAN le mot de passe " tput cup $LIGNE 0 printf "\t$CYAN password ==> $BASE" read password if [ "$num_encaps" -eq 5 ] ; then # 5 - RFC2364, PPPoA LLC echo "llc-encaps" >>$DSL_PROV # dsl-provider fi echo "\"$login\" * \"$password\"" >$PAP_SECRT # pap-secrets echo "\"$login\" \"*\" \"$password\"" >$CHAP_SECRT #chap-secrets # Si FAI : ES03, ES16 (Spain), LK01 (Sri Lanka), PK01 (Pakistan), TR01 (Turkey) # Mot de passe crypté (/etc/ppp/pap-secrets). case "$KEY" in ES03 | ES16 | LK01 | PK01 | TR01 ) echo "papcrypt" >>$DSL_PROV echo "\t$CYAN Authentification crypté du mot de passe.$BASE" ;; *) ;; esac # Lancer cnx ? echo -n "\t$CYAN Lancer la connextion Internet du FAI $KEY ?$BASE " read adsl case `echo ${adsl}N | cut -c1` in O | o | Y | y) # O/oui INF_OPT="test" ; options ;; *) ;; esac echo "\t$CYAN*----------------- http://forum.eagle-usb.org -----------------*\n$BASE" echo "\n\t$CYAN*----------------- http://ubuntu-fr.org -----------------*\n$BASE" echo "\n\t$CYAN*----------------- http://ubuntu-fr.org -----------------*\n$BASE" exit 0 # Fin
Source :
Site de développement et de documentation pour le pilote ueagle-atm