Hi There,

A question I have had for years and to which I have found no answer is 
how do you reset the Speedtouch 330, without resorting to unplugging it 
and plugging it back in again. I have now found a way of doing this and 
have written a script to be run by cron that keeps the machine connected.

I have attached it below. I hope the commentary is sufficient to explain 
what is going on. It is release as GPL. If you have any fixes or 
improvements I would hope you would return them to me.

Cheers

Andy M

-- 
___________________________________________________________

          Andrew Meredith BEng CEng CITP MBCS MIET
         http://www.anvil.org    and...@anvil.org
___________________________________________________________



-- Attached file included as plaintext by Listar --
-- File: ADSL-cron

#!/bin/bash
#
# Author:  Andrew Meredith <and...@anvil.org>
# Date:    1st March 2010
# Version: 1.0
#
# License Terms: GPL
# Copyright: Andrew Meredith <and...@anvil.org> (c) 1st March 2010
#
# This script works around the instability of the Speedtouch 330
# by checking for presence of a working Internet connection and
# if not present, puts the relevant USB port into hibernation
# and then brings it back out again, thus causing the firmware
# to be reloaded and the device rebooted.
#


# Check for live link by pinging two of the DNS root servers.
# The odds of both being down are pretty remote.

if ping -c 3 198.41.0.4 > /dev/null
then
        logger -t ADSL-cron "Connection OK"
        exit 0
else
        if ping -c 3 192.228.79.201 > /dev/null
        then
                logger -t ADSL-cron "Connection OK"
                exit 0
        else
                logger -t ADSL-cron "Connection DOWN"
        fi
fi

# If you have got to here, the two DNS servers are unreachable
# which almost certainly means that the device has locked up
# and the link is down. So now look for the code 4061 in the
# USB devices products and note the DEV number.

for file in /sys/bus/usb/devices/*/idProduct
do
        if grep "^4061$" $file > /dev/null
        then
                DEV=` expr $file : 
'/sys/bus/usb/devices/\([0-9][0-9\-]*\)/idProduct' `
                LEV=`cat /sys/bus/usb/devices/$DEV/power/level`
        fi
done

# Check that you've found the DEV number and if you did
# then pull down the ppp0 interface, hibernate and revive
# the USB port and then bring up ppp0.

if [ "$DEV" != "" ]
then
        logger -t ADSL-cron "Device: $DEV is $LEV"

        logger -t ADSL-cron "Dropping ppp0"

        ifdown ppp0

        logger -t ADSL-cron "Resetting USB Device"

        echo -n suspend > /sys/bus/usb/devices/$DEV/power/level

        sleep 3

        echo -n on > /sys/bus/usb/devices/$DEV/power/level

        logger -t ADSL-cron "Restarting ppp0"

        ifup ppp0
else
        logger -t ADSL-cron "Speedtouch 330 not found"
        exit 1
fi



Liste de diffusion modem ALCATEL SpeedTouch USB
Pour se désinscrire : mailto:speedtouch-requ...@ml.free.fr?subject=unsubscribe

        

Reply via email to