[HD2 Ubuntu Development] andboy:
Tired of clicking OK for 3G Mode

Once you've entered your apn, username and password into the 3G Mode script, it saves your entries. Next time you run it, you just need to click OK three times. If you get tired of clicking OK, here's a patch for a one-click connection with a progress dialog.

--- /usr/sbin/ppp-gtk	2010-12-26 14:07:41.000000000 -0800
+++ /usr/sbin/ppp-gtkonprogress	2011-02-21 21:44:43.000000000 -0800
@@ -1,23 +1,42 @@
#!/bin/sh

#ppp-gtk script by Lukas-David Gorris. Based on the original htc kaiser ppp.notsh script from Barry Carter ( http://www.headfuzz.co.uk ) Released under Gnu Public License v2
-
+(
#kill remaining ppp and other interfaces
rmmod bcm4329
killall pppd
killall wicd
+echo 10
ifconfig eth0 down
ifconfig eth1 down
ifconfig eth2 down
# previous usbnet connection will sometimes mess up routing so I'm killing the interface for now. it would be nice to use the host's internet. if you know how to resolve this please let me know.
ifconfig usb0 down
+sleep 3
+echo 20

# Get apn user password information
-apn=$(zenity --entry --title "3G APN" --text "Type in your 3g Access Point Name" --entry-text "$(cat /etc/ppp/apn)")
+# if apn file is newer than pap-secrets, don't ask the user again
+if [ /etc/ppp/apn -nt /etc/ppp/pap-secrets ]
+then
+ apn=$(cat /etc/ppp/apn)
+else
+ apn=$(zenity --entry --title "3G APN" --text "Type in your 3g Access Point Name" --entry-text "$(cat /etc/ppp/apn)")
+fi
echo "apn is $apn"
-user=$(zenity --entry --title "3G Username" --text "Type in your 3g username. Leave blank for none." --entry-text "$(cat /etc/ppp/user)")
+if [ /etc/ppp/user -nt /etc/ppp/pap-secrets ]
+then
+ user=$(cat /etc/ppp/user)
+else
+ user=$(zenity --entry --title "3G Username" --text "Type in your 3g username. Leave blank for none." --entry-text "$(cat /etc/ppp/user)")
+fi
echo "user is $user"
-pass=$(zenity --entry --title "3G Password" --text "Type in your 3g password. Leave blank for none." --entry-text "$(cat /etc/ppp/papsecrets)")
+if [ /etc/ppp/papsecrets -nt /etc/ppp/pap-secrets ]
+then
+ pass=$(cat /etc/ppp/papsecrets)
+else
+ pass=$(zenity --entry --title "3G Password" --text "Type in your 3g password. Leave blank for none." --entry-text "$(cat /etc/ppp/papsecrets)")
+fi
echo "pass is $pass"

# Save apn, user, password
@@ -31,28 +50,45 @@
/bin/echo -e "AT+CGDCONT=1,\"IP\",\"$apn\",\"\",0,0\r" > /dev/smd0

sleep 1
+echo 25

# Dial up the connection
/bin/echo -e 'ATD*99***1#\r' > /dev/smd0

# Start pppd
pppd /dev/smd1 debug defaultroute local usepeerdns name $user noipdefault unit 0 linkname gprs novj persist
+echo 30

# Wait for the net to come up
-sleep 8
+sleep 4
+echo 50
+sleep 4
+echo 70

# Use OpenDNS servers in case provider does not give you DNS
#/bin/echo -e "nameserver 208.67.222.222\n\r nameserver 208.67.220.220\n\r" > /etc/resolv.conf

# Update systm time
-ntpdate pool.ntp.org
+if ntpdate pool.ntp.org
+then

+echo 95
echo 75 > /sys/devices/virtual/timed_output/vibrator/enable
sleep 0.2
echo 75 > /sys/devices/virtual/timed_output/vibrator/enable

-zenity --info --text "3G Initialized"
-
+echo 100
+zenity --info --text "3G Initialized" --timeout=1
+else
+ zenity --info --text "3G Failed"
+fi
+
+) |
+zenity --progress \
+ --title="Connecting 3G" \
+ --text="Connecting..." \
+ --percentage=0 \
+ --auto-close