[Touch CDMA Android Development] grktaurus83:
Woah, this turned out to be a massive post. Sorry.

So after testing all of the variations possible configurations (including all password configurations), I have found a solution.

The problem with the solution is that I don't know WHY it works, but at least it does work... right? (ugh)

The new setupmodem.sh:

===================

#!/system/bin/sh
busybox sh
export PATH=/bin:/system/bin
echo ""
echo "Initialising Modem:"
echo "==================="
echo ""
/system/bin/setprop ro.radio.use-ppp no
/system/bin/setprop ro.config.nocheckin yes
PPPUSER=`grep -o "ppp.username=.*" /proc/cmdline | cut -d" " -f1 | sed -e "s/ppp.username=//g"`
PPPPASS=`grep -o "ppp.password=.*" /proc/cmdline | cut -d" " -f1 | sed -e "s/ppp.password=//g"`
echo "$PPPUSER * $PPPPASS" > /etc/ppp/pap-secrets
echo "$PPPUSER * $PPPPASS" > /etc/ppp/chap-secrets
echo "Username=$PPPUSER"
echo "Password=$PPPPASS"
echo ""
sleep 2
cat /initmodem1 > /dev/smd0
sleep 1
cat /initmodem2 > /dev/smd0
sleep 3
/bin/pppd /dev/smd1 debug defaultroute local usepeerdns name $PPPUSER noipdefault unit 0 linkname gprs novj
echo "Sleeping for 15 seconds..."
sleep 15
echo "DONE!"
busybox ifconfig
busybox telnetd
busybox sh

The changes:

==========

1) Added "busybox sh" on the 2nd line (before the path export)

2) Added "sleep 1" immediately after modeminit1

3) Added "sleep 3" immediately after modeminit2

Comments:

========

1) I have no idea why having "busybox sh" on the 2nd line makes a difference but it does.

2) The delays were chosen randomly based on what I thought the command required (initial init of the modem should be quick, but dialing the connection should be a bit longer)

3) All of the changes need to be there for the connection to work. I've tried using just the busybox change and just the time delays (both of them at the same time). I have not tried the time delays separately, tried them in individual combinations with the busybox change, or tried varying the times.

4) These changes ONLY matter when they are saved to the "setupmodem.sh" file and run during bootup. I've tried using a setupmodem.sh file that doesn't establish a connection, then running the working script manually from the command line and it doesn't work. The script reports that it can't find the busybox command when it is run manually. Funny thing is that if it DOES find the busybox command, it ends up opening a shell (as the command should) and doesn't finish the modem connection (which makes sense). But I have no idea why this works during the bootup process. Maye because this is run with an init status during boot or under a less restricted root account (meaning that it has access to all of the proper commands, unlike our terminal emulator that has different versions of ifconfig and other commands)... Who knows...

5) My phone will almost always briefly wake up by itself a minute or two after it sends itself into power collapse due to inactivity. This seems to only happen on the first power collapse and does not seem repeat with subsequent power collapses (meaning that it does not randomly wake up again a minute or two after it goes idle from a previous random wakeup).

6) I also tried running the script without the "busybox sh" at the end and the connection worked as well.

7) I watched the logcat radio output while the connection was going (from the case in comment 5) and there are a lot of errors in the background. Haven't compared to see whether or not those errors go away if I add the "busybox sh" back in at the end. Not sure what those errors mean or if this is normal during an internet connection in Android (at our stage of things), but they probably shouldn't be there... I'll be pulling some logs when I get some time over the weekend and send them over to Martin if he's interested.

8) "mobile@jamamobile" is still hard-coded in the file "/etc/ppp/options.smd1" It shouldn't be too hard to write a script to overwrite that username with whatever is supplied by the user.

9) All in all, I must have tested at least 100 different configurations (many of them requiring a reboot, but not all). Such a waste of time with the passwords. *sigh*

10) I feel like I've barely done anything and this has taken up almost all of my time this week. I can't imagine how time management works for Martin on all this... You're intense Margin.

11) Please let me know if these changes work for you guys.

Good luck!