Sunday, September 28, 2008

Using Blackberry 8830 as a tethered modem over Bluetooth on Ubuntu

I was recently toying around trying to get my Blackberry 8830 to work as a tethered modem with my eee pc running Ubuntu 8.04 LTS. This was one of the last hurdles keeping me from switching over to Ubuntu on my eee pc completely. I had to switch over to Windows XP everytime I needed to connect to the Internet on the road. After searching high and low I found what I needed on the Ubuntu documentation website. The following is just a reproduction of the same with specific details for Sprint Blackberry 8830.

These are the details of what I have:

Device: Blackberry 8830 (World Edition)
Carrier: Sprint
Laptop: eee pc 900
OS: Ubuntu 8.04 LTS (Hardy Heron)

My laptop does not have built-in Bluetooth so I picked up one of those USB dongles.

The following is a one time setup before you can use your device as a tethered modem.

Before you get started, first make sure you have bluez-utils and ppp installed on your machine.

$sudo apt-get install bluez-utils ppp

Next, make sure your phone is discoverable and run the following:

$hcitool scan

This will give you something like:

Scanning ...
xx:xx:xx:xx:xx:xx your_device_name

where xx:xx:xx:xx:xx:xx is your device's mac address.

If you haven't paired your device with your laptop yet, do so using the following command,

$sudo hcitool cc xx:xx:xx:xx:xx:xx

On my machine this opened up the Bluetooth Preferences window where I was able to enter the shared passkey and pair the two devices.

Next, check your device to see on what channel Dial-Up Networking runs.

$sdptool search DUN xx:xx:xx:xx:xx:xx

This will return something like:

Inquiring ...
Searching for DUN on xx:xx:xx:xx:xx:xx ...
Service Name: Dialup Networking
Service RecHandle: 0x10002
Service Class ID List:
"Dialup Networking" (0x1103)
"Generic Networking" (0x1201)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 3
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100

As we can see from above the RFCOMM channel for this device is 3. This is what we use to modify our rfcomm.conf file as follows:

$sudo pico /etc/bluetooth/rfcomm.conf

and paste the following into the file.

rfcomm0 {
bind yes;
device xx:xx:xx:xx:xx:xx;
channel your-phone-rfcomm-channel;
comment "Bluetooth PPP Connection";
}

Save and close this file.

Running the following will create the rfcomm0 device:
$sudo /etc/init.d/bluetooth restart

Running rfcomm on your machine should show that it is connected to your Blackberry.

$rfcomm
rfcomm0:
xx:xx:xx:xx:xx:xx channel 3 closed

Next, we will configure PPP.

$sudo pico /etc/ppp/peers/BluetoothDialup

and paste in the following:

debug
noauth
connect "/usr/sbin/chat -v -f /etc/chatscripts/BluetoothDialup"
usepeerdns
/dev/rfcomm0 115200
defaultroute
crtscts
lcp-echo-failure 0

Save and close this file.

Next, edit the chatscript file. I found that the Verizon file in the Ubuntu documentation worked just fine for Sprint too.

$ sudo pico /etc/chatscripts/BluetoothDialup

and paste in the following

# abortstring
ABORT 'NO CARRIER' ABORT 'ERROR' ABORT 'NO DIALTONE' ABORT 'BUSY' ABORT 'NO ANSWER'
# modeminit
'' ATZ
# ispnumber
OK-AT-OKL3 ATDT#777
# ispconnect
CONNECT \d\c

Save and close the above file.

pon and poff are two commands to start and stop ppp connections. You'll use these to enable and disable Dial-Up Networking on your Blackberry everytime.

$pon BluetoothDialup

You should see "Modem Mode Enabled" now on your Blackberry. Try pinging any public website and see if it responds.

To turn off Dial-Up Networking simply type

$poff

That's it. Enjoy your tethered Blackberry modem!

btw, if you need to use your Blackberry 8830 as a modem over Windows XP, the software can be downloaded from here.