Tuesday 9 June 2009

Connecting to the Internet from Ubuntu using bluetooth to a Nokia E65

Having just set this up for about the 4th time, I thought it was about time to record what I actually do - rather than working it out each time!

First off, I get the phone and laptop paired - easy enough using the bluetooth icon on the gnome panel.

Then, edit /etc/bluetooth/rfcomm.conf to look like:

#
# RFCOMM configuration file.
#

rfcomm0 {
# # Automatically bind the device at startup
bind yes;
#
# # Bluetooth address of the device
device 00:AA:BB:CC:DD:EE;
#
# # RFCOMM channel for the connection
channel 2;
#
# # Description of the connection
comment "Nokia E65";

}

using the appropriate device MAC. If you don't know this then
hcitool scan

will reveal devices that are visible in your locality and then
sdptool browse

will let you find the channel number for Dialup Networking.

Restart bluetooth after this change.

Next create /etc/ppp/peers/orange

noauth
#change this if you move the path to your connect script
connect "/usr/sbin/chat -v -f /etc/chatscripts/orange-connect"
#change this if you move the path to your disconnect script
disconnect "/usr/sbin/chat -v -f /etc/chatscripts/orange-disconnect"
#I found that I needed this to remove problems with loopback on connecting
silent
#remove this if you don't want lots of information going to /var/log/messages
debug
#this is the device specified in your rfcomm.conf file
/dev/rfcomm0
#speed at which to connect - might be worth trying higher...
115200
#this is needed so that a default route is added to your routing table
defaultroute
#this is needed so that you pick up Orange's DNS settings
usepeerdns

lcp-echo-failure 0
lcp-echo-interval 0
nomagic
noccp


And /etc/chatscripts/orange-connect:

TIMEOUT 5
ECHO ON
ABORT '\nBUSY\r'
ABORT '\nERROR\r'
ABORT '\nNO ANSWER\r'
ABORT '\nNO CARRIER\r'
ABORT '\nNO DIALTONE\r'
ABORT '\nRINGING\r\n\r\nRINGING\r'
'' \rAT
TIMEOUT 12

OK ATE1
#here's the magic bit!
OK 'AT+CGDCONT=1,"IP","orangeinternet"'
OK ATD*99***1#
TIMEOUT 30
CONNECT ""


And /etc/chatscripts/orange-disconnect

ABORT "BUSY"
ABORT "ERROR"
ABORT "NO DIALTONE"
SAY "\nSending break to the modem\n"
"" "\K"
"" "\K"
"" "\K"
"" "+++ATH"
"" "+++ATH"
"" "+++ATH"
SAY "\nPDP context detached\n"


With all this in place, sudo pon orange should make the connection and sudo poff orange should break it.

No comments: