#!/bin/bash # Company: PowerCraft Technology # Author: Copyright Jelle de Jong # Note: Please send me an email if you enhanced the script # Version: 0.0.1 # Date: 2008-03-31 # System: Ubuntu/Debian GNU/Linux # Description: Detect HSDPA USB Huawei E220 Modem before connecting # 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. #~ check=$(lsmod | grep option) #~ [ -n "$check" ] && sudo rmmod option #~ check=$(lsmod | grep usbserial) #~ [ -n "$check" ] && sudo rmmod usbserial #~ #~ sudo modprobe usbserial vendor=0x12d1 product=0x1003 unset ready maximum=15 count=0 while [ -z "$ready" ] && [ "$count" -lt "$maximum" ] do count=$(($count+1)) cd /dev/ for interface in ttyUSB* do if [ "$interface" = "ttyUSB0" ] then ready="true" fi done if [ -z "$ready" ] then /bin/sleep 1 && /bin/echo -ne "...device not detected, trial: $count/$maximum \r" fi done if [ -n "$ready" ] then echo "device detected, continuing now..." exit 0 else fallback="true" if [ -n "$fallback" ] then echo "device detection failed, reverting to backup" /usr/bin/pct-hsdpa-3g-huawei-e220-vodafone-disable else echo "device detection failed, shutdown now" exit 1 fi fi exit