#!/bin/sh myid=`echo $$` sdptool search "DUN" > $myid found="SIGH" chan=`cat $myid | grep Channel | sed -e "s/\(.*Channel.\)\(.*\)/\2/g" | sed -e "s/ //g"` echo "Chan is $chan" found=`egrep "Channel.*" $myid` if [ -z "$found" ]; then echo "I did sdptool search "DUN" and didn't see anything on channel 4. Sorry." else echo "Looking for MAC address..." mac=`head -2 $myid | tail -1 | awk '{print $5}'` echo "rfcomm0 {" > /etc/bluetooth/rfcomm.conf echo " bind yes;" >> /etc/bluetooth/rfcomm.conf echo " device $mac;" >> /etc/bluetooth/rfcomm.conf echo " channel $chan;" >> /etc/bluetooth/rfcomm.conf echo "}" >> /etc/bluetooth/rfcomm.conf echo "rfcomm.conf:" cat /etc/bluetooth/rfcomm.conf echo "device {" > /etc/bluetooth/hcid.conf cat << EOF >> /etc/bluetooth/hcid.conf name "%h-%d"; class 0x100 iscan enable; pscan enable; lm accept; lp hold,sniff,park; } options { autoinit yes; security user; pairing multi; pin_helper /etc/bluetooth/pin.sh; } EOF cat << EOF > /etc/bluetooth/pin.sh #!/bin/sh echo "PIN:1234" EOF cat << EOF > $myid [Modem0] Modem = /dev/rfcomm0 Baud = 115200 SetVolume = 0 Dial Command = ATDT Init1 = ATZ Init3 = ATM0 FlowControl = CRTSCTS [Dialer vzw] Username = 520XXXXXXX@vzw3g.com Password = vzw Phone = #777 Stupid Mode = 1 Init1 = ATZ Init2 = ATQ0 E1 Inherits = Modem0 EOF there=`grep rfcomm0 /etc/wvdial.conf` if [ ! -z "$there" ]; then echo "rfcomm0 already exists in /etc/wvdial.conf." echo "Make sure it looks a lot like this:" cat $myid else cat $myid >> /etc/wvdial.conf rm $myid fi chmod 755 /etc/bluetooth/pin.sh rfcomm bind /dev/rfcomm0 # echo "Use system-config-network to add a modem on device /dev/rfcomm0" # echo "and then edit /etc/wvdial.conf and remove the init2 string..." echo -n "Enter your phone number: " read phone sed -i -e "s/520XXXXXXX/$phone/g" /etc/wvdial.conf echo "use bluetooth_tether to connect." fi