Thursday, September 04, 2008

Bluetooth GPRS with Mandriva 2008.1

Well, took me a little while to writing up about how to get Bluetooth GPRS working with Mandriva 2008.1, although I did actually get it working only a couple of days after getting it working on the Eee PC with Xandros.

First thing I’ve discovered with Mandriva 2008.1, is that it does in fact have quite a nice wizard to get bluetooth dial up networking going. You go to the Mandriva control panel, choose Setup a new network interface, and select “Bluetooth dial up networking”. Then wait. In the background, it’s running:

sdptool search "DUN"

and then,

hcitool name [mac address]

However, I discovered this does not always work. I’ve been working in Vodafone recently, where there are around 15 bluetooth devices visible. sdptool search did not find my phone, although “hcitool scan” showed up my phone just fine, and sdptool browse [mac address] shows my phone has DUN.

So, I’ll be logging a bug/patch to suggest /usr/lib/libDrakX/network/connection/ be changed, to use hcitool scan, then, after the use has selected their device, check that it supports DUN.

Next, the wizard prompts for my provider information. Vodafone, New Zealand, is not in the list, so I manually enter, as the access point name (APN). No username or password are needed, as the billing is tied to your phone account.

I choose to start the connection, the wizard says it worked. Except it didn’t. One of the reasons for this is, that it fails to bond to my phone. However, /etc/bluetooth/rfcomm.conf is correct, and it does create the appropriate chat-ppp0 and ifcfg-ppp0 files in /etc/sysconfig/network-scripts. It does not however, enable the bluetooth service, which needs to be on for this to work.

The is two issues here. First, my phone already has a bonded connection with my bluetooth adapter, as I used the same adapter on a different laptop, so that’s easy, just delete the device from my phone.

Now, before you can use Dial up networking, you need to get the laptop to bond with the phone, and this can be much more difficult that expected.

Mandriva 2008.0 used to use a system to prompt for a pin, called bluez-pin. This package is available for Mandriva 2008, but not 2008.1. It was removed, as it’s not needed by the KDE bluetooth tools, but, the dial up networking stuff still tries to use it, to prompt for a pin, (I think), as bluez-pin provides /bin/bluepin.

However, I’ve found a work around for this. Start kbluetooth, and browse to your phone’s file transfer. Your phone will prompt you for a pin. Enter a random pin. Then, you kbluetooth will ask you for the same pin you just entered into your phone. If all goes well, your phone will then ask you to allow file transfer.

Browing bluetooth devices, launched from kbluetooth

Pairing with a phone

Now, check you have paired with your phone successfully. This is critical for getting dial up working. You should see it as paired in Paided/Trusted Deices, and in your phone, it should show the name of your laptop, and that it’s currently paired with it..

Example trusted devices.

It does not seem to have to have “Trust this device” ticked, as it can be configured to ask every time your laptop wants to use the phones internet connection.

Next, check a few command line options

[nelg@laptop ~]$ rfcomm
rfcomm0: 00:1A:75:A5:54:C8 channel 7 clean

Then try to bring up the interface, from the command line.

[nelg@laptop ~]$ /sbin/ifup ppp0

This can take a few seconds. All going well, your phone should ask you if you wish to allow your laptop to use it’s internet connection, then the connection should be established.

[nelg@laptop ~]$ /sbin/ifconfig ppp0
ppp0      Link encap:Point-to-Point Protocol
          inet addr:  P-t-P:  Mask:

You can close the connection from net_applet, but you can’t start it from the applet.


  • Phone’s are stupid. Sometimes, turning it off, taking the battery out, then starting it agian helps
  • It’s sometimes hard to restart the bluetooth service, as it does not want to unload modules. rfcomm release rfcomm0, rmmod hidp, rmmod l2cap and rmmod hidp
  • Don’t run the mandriva wizard more than once, or you will end up with rfcomm1,.. etc etc.
  • Deleting the contents of /var/lib/bluetooth/ can make bluetooth forget stuff if you need it to forget stuff.
  • if /sbin/ifup ppp0 fails, with an error like “Device ppp0: The serial port could not be (opened|locked)”, then try again.  I think that the is some slowness in the phone being ready to do DUN, which can cause this.

No comments: