Tethering my centro cellphone to my linux laptop

I needed to figure out how to tether my (Sprint) Centro to my laptop.  ("Tethering" being the cool way to say use the phone to provide network connectivity.)

After looking around, specifically at this page, I purchased the Mobile Stream USB Modem software.  (I use their Card Reader software already and it works great.)  I followed the directions on the ubuntu tutorials site and was able to get network connectivity right away.

Of course, I had to do a few more things (get name service set up, etc.)  Being the script compulsive person I am, I wrote the script below (also attached as file) to facilitate this system.  Now all I gotta' do is get connection sharing working and I'll be golden.

Before the script tho, some other links:
           June Fabrics 'PdaNet' software, according to reports on the 'net, works well; but is Winders only, so a no-go.
           A page on getting DUN working w/ bluetooth on the Mac.  Has some interesting words about getting a Vision password.  I found it wasn't necessary as did the person who wrote the Ubuntu tutorial.


#!/bin/bash

# Uses my Centro for bandwidth.
#
# Requires the USBModem Palm app from:
# http://www.mobile-stream.com/usbmodem.html
# The application must be installed and activated
# when connecting the Centro to the machine.
#
# For this to work (with Sprint Power Vision bandwidth)
# Follow the directions on this site:
# http://ubuntu-tutorials.com/2007/06/07/dialup-networking-via-treo-700p-and-ubuntu-usb-connection
# Namely:
#    1 - install the 'visor' module
#         # modprobe visor
#    2 - copy the usbmodem 'edvo' script template to the ppp 'peers' dir
#         # cp {path to usbmodem files}/drivers/linux/ppp-script-evdo-template /etc/ppp/peers/ppp-script-centro
#    3 - enable the ppp connection
#         # pppd /dev/ttyACM0 call ppp-script-centro
#
# This script assumes that step 2 is complete.  
#
# On enable:
# NetworkManager is stopped to prevent interference.
# Steps 1 and 2 are performed.  The nameservers are set up.
#
# On disable:
# The visor module is removed and the pppd connetion is killed.
# NetworkManager is then restarted.
#


printUsage() {
	echo -e "Usage: $0 ( enable | disable )"
	echo -e "\tenable - sets up the PPP using the Centro for bandwidth"
	exit
}

echo " "
if [ $# -eq 0 ]; then
	printUsage
fi
if [ $# -ne 1 ]; then
	echo "Wrong number of parameters"
	echo ""
	printUsage
fi

case "$1" in
enable )
	# Quick check
	if [ ! -c /dev/ttyACM0 ]; then 
		echo "/dev/ttyACM0 device does not exist. "
		echo "Is phone attached and the usbmodem app running/active?  ...Aborting."
		echo " "
		exit
	fi

	echo "Enabling...."
	/sbin/service NetworkManager stop
	sleep 2
	/sbin/modprobe visor
	/usr/sbin/pppd /dev/ttyACM0 call ppp-script-centro 2>&1 > /dev/null
	/bin/cp /var/run/ppp/resolv.conf /etc/resolv.conf
	echo "....done."
	;;

disable )
	echo "Disabling...."
	kill `cat /var/run/ppp0.pid`
	/sbin/rmmod visor
	/sbin/service NetworkManager start
	echo "....done."
	echo "You can now disable the usbmodem app."
	;;

* )
	echo "Incorrect parameter"
	echo ""
	printUsage
esac



 

AttachmentSize
centroModem.sh1.98 KB