#!/bin/sh # Company: PowerCraft Technology # Author: Copyright Jelle de Jong # Note: Please send me an email if you enhanced the script # Version: 0.0.2 # Date: 2008-03-31 / 2008-12-12 # System: Ubuntu/Debian GNU/Linux # Description: Closing HSDPA USB Huawei E220 Modem monitoring # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more de/usr/bin/tails. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. # set -x # exec 2>/var/log/pct-hsdpa-3g-huawei-e220-vodafone-init.log sudo /etc/init.d/networking stop && sleep 3 [ -e /etc/network/interfaces ] && [ ! -e /etc/network/interfaces.huawei.backup ] && sudo mv --verbose /etc/network/interfaces /etc/network/interfaces.huawei.backup [ -e /etc/network/interfaces ] && sudo mv --verbose /etc/network/interfaces /etc/network/interfaces.backup echo "vodafone * vodafone" | sudo tee /etc/ppp/pap-secrets echo "vodafone * vodafone" | sudo tee /etc/ppp/chap-secrets echo 'TIMEOUT 3 ABORT "BUSY" ABORT "NO CARRIER" ABORT "VOICE" ABORT "NO DIALTONE" ABORT "NO DIAL TONE" ABORT "NO ANSWER" ABORT DELAYED "" ATZ OK ATQ0&FEV1X1S0=0&C1&D2 OK AT+CGDCONT=16,"IP","live.vodafone.com" OK ATDT*99***16# CONNECT ""' | sudo tee /etc/chatscripts/pct-hsdpa-3g-huawei-e220-vodafone.chat echo '/dev/ttyUSB0 7200000 user vodafone connect "/usr/sbin/chat -v -f /etc/chatscripts/pct-hsdpa-3g-huawei-e220-vodafone.chat" noccp noauth noipdefault usepeerdns defaultroute replacedefaultroute' | sudo tee /etc/ppp/peers/pct-hsdpa-3g-huawei-e220-vodafone echo auto lo | sudo tee -a /etc/network/interfaces echo iface lo inet loopback | sudo tee -a /etc/network/interfaces echo | sudo tee -a /etc/network/interfaces echo auto ppp0 | sudo tee -a /etc/network/interfaces echo iface ppp0 inet ppp | sudo tee -a /etc/network/interfaces echo provider pct-hsdpa-3g-huawei-e220-vodafone | sudo tee -a /etc/network/interfaces echo pre-up /usr/share/pct-hsdpa-3g-huawei-e220-vodafone/pct-hsdpa-3g-huawei-e220-vodafone-detect | sudo tee -a /etc/network/interfaces echo up /usr/share/pct-hsdpa-3g-huawei-e220-vodafone/pct-hsdpa-3g-huawei-e220-vodafone-monitor | sudo tee -a /etc/network/interfaces echo pre-down /usr/share/pct-hsdpa-3g-huawei-e220-vodafone/pct-hsdpa-3g-huawei-e220-vodafone-close | sudo tee -a /etc/network/interfaces echo | sudo tee -a /etc/network/interfaces sudo /etc/init.d/networking start exit ------------------------------------------------------------------------ sudo /etc/init.d/sysklogd start sudo /etc/init.d/klogd start sudo tail -f -n 1000 /var/log/syslog sudo pppd call pct-hsdpa-3g-huawei-e220-vodafone sudo poff pct-hsdpa-3g-huawei-e220-vodafone sudo iftop -i -B ppp0 sudo ps aux | grep ppp /usr/bin/screen -d -m -S ppp-monitor /usr/bin/bwm-ng --interfaces ppp0 --output curses --unit bytes --type sum --timeout 1000 screen -x ppp-monitorig -X close ------------------------------------------------------------------------ udevinfo -a -p /class/tty/ttyUSB0 echo 'KERNEL=="ttyUSB0", ACTION=="add", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1003", RUN+="/usr/bin/pct-hsdpa-3g-huawei-e220-vodafone-enable"' | sudo tee /etc/udev/rules.d/z60_pct-hsdpa-3g-huawei-e220-vodafone.rules echo 'KERNEL=="ttyUSB0", ACTION=="remove", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1003", RUN+="/usr/bin/pct-hsdpa-3g-huawei-e220-vodafone-disable"' | sudo tee --append /etc/udev/rules.d/z60_pct-hsdpa-3g-huawei-e220-vodafone.rules sudo chmod 644 /etc/udev/rules.d/z60_pct-hsdpa-3g-huawei-e220-vodafone.rules http://www.freebsd.org/doc/en/books/handbook/ppp.html http://www.yolinux.com/HOWTO/PPP-HOWTO.html http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=445711 https://help.ubuntu.com/community/BluetoothDialup http://thinkleft.com.au/3_MobileBroadband_APN_and_PPP sudo rmmod option sudo rmmod usbserial sudo modprobe usbserial vendor=0x12d1 product=0x1003 sudo /etc/init.d/networking stop sudo wvdial --no-syslog --config $HOME/.wvdial.conf auto lo eth0 allow-hotplug eth0 iface eth0 inet dhcp iface lo inet loopback ------------------------------------------------------------------------