OpenWrt connect to UMTS with Huawei E620 3G USB Modem

# install packages
opkg update
opkg install usbutils
opkg install kmod-usb-serial kmod-usb2 kmod-usb-uhci kmod-usb-ohci
opkg install ppp kmod-ppp
opkg install huaweiaktbbo
opkg install comgt
opkg install usb-modeswitch usb-modeswitch-data

# OPTIONAL, webgui support for 3g
opkg install luci-proto-3g

# list USB devices

Bus 001 Device 002: ID 12d1:1520 Huawei Technologies Co., Ltd. K3765 HSPA

# load serial module on boot
VENDOR=$(lsusb | grep Huawei | cut -d" " -f6 | cut -d":" -f1)
PRODUCT=$(lsusb | grep Huawei | cut -d" " -f6 | cut -d":" -f2)
echo "usbserial vendor=0x${VENDOR} product=0x${PRODUCT}" > /etc/modules.d/60-usb-serial

# remove "***1" from ATD command
cp /etc/chatscripts/ /etc/chatscripts/
sed -i "s|\*\*\*1||g" /etc/chatscripts/
sed -i 's/ \+/ /g' /etc/chatscripts/

# create umts interface
uci del network.umts
uci set network.umts=interface
uci set network.umts.proto=3g
uci set network.umts.service=umts
uci set network.umts.device=/dev/ttyUSB0
uci set
#uci set network.umts.username=''
#uci set network.umts.password=''
uci set firewall.@zone[1].network='wan umts'
uci commit network
#ifup umts

# ann new network to firewall
vi /etc/config/firewall
config 'zone'
option 'network' 'wan ppp0'

# reboot openwrt

# connect to 3g network
ifup ppp0

# config files

# view logs

# switch usb storrage to modem device
usb_modeswitch -c /etc/usb_modeswitch.d/12d1:1001

# Info / Debug
gcom -d /dev/ttyUSB0 info

# view log
logread -f

# check modem
gcom -d /dev/ttyUSB0 info

# connect to 3G network (O2 Germany)
cat <> /etc/config/network
config 'interface' 'ppp0'
option 'ifname' 'ppp0'
#option 'pincode' '1234'
option 'device' '/dev/ttyUSB0'
option 'apn' ''
option 'service' 'umts'
option 'proto' '3g'

usb_modeswitch -v 12d1 -p 1465 -c /etc/usb_modeswitch.d/12d1:1520

# download packages offline
wget -O /tmp/

PACKAGES="chat_2.4.5-8 comgt_0.32-21 huaweiaktbbo_1 kmod-atm_3.3.8-1 kmod-pppoa_3.3.8-1 kmod-ppp-synctty_3.3.8-1 kmod-usb2_3.3.8-1 kmod-usb-ohci_3.3.8-1 kmod-usb-serial-ark3116_3.3.8-1 kmod-usb-uhci_3.3.8-1 librt_0.9.33.2-1 libusb_0.1.12-3 libusb-1.0_1.0.9-1 linux-atm_2.5.2-4 luci-proto-3g_0.11.1-1 ppp-mod-pppoa_2.4.5-8 usb-modeswitch_1.2.3-2 usb-modeswitch-data_20120120-1 usbutils_005-1"

for FILE in ${PACKAGES}; do
# fixme
IPK=$(grep "\"${FILE}" /tmp/ | cut -d ">" -f2 | cut -d "<" -f1 )

# Links