Bluetooth (bluez4) and bluetooth serial port

Al Johnson openmoko at
Tue Sep 15 16:48:28 CEST 2009

On Tuesday 15 September 2009, RANJAN wrote:
> Hi,
> I have been trying to get the FR and my laptop paired up using Bluetooth
> (Bluez4).I could not?
> Questions:
> 1)Is there a way via script that I can keep FR bluetooth in "discoverable
> mode"?

You need to set the DiscoverableTimeout property of the Adapter to 0, and the 
Discoverable property to True, or at least that's the theory. I've tried this 
from python, and Discoverable sets just fine, but with DiscoverableTimeout I 
get a dbus error InvalidArguments. I haven't been able to work out what's 
invalid yet though. The general idea would be something like:

mdbus -s org.bluez /org/bluez/`pidof bluetoothd`/hci0 

mdbus -s org.bluez /org/bluez/`pidof bluetoothd`/hci0 
org.bluez.Adapter.SetProperty DiscoverableTimeout 0

mdbus -s org.bluez /org/bluez/`pidof bluetoothd`/hci0 
org.bluez.Adapter.SetProperty Discoverable True

I assume you can set this through a config file too, but I've not checked.

> 2)Also FR scans and gets the MAC of my laptop.

I've got some python code that can do discovery and pairing.

> But what after this to finish the pairing and have a bluetooth serial port
> link between the two.

I've not tried this bit for serial, but once you have a pairing it should work 
something like:

mdbus -s org.bluez /org/bluez/`pidof bluetoothd`/hci0/dev_AA_BB_CC_DD_EE_FF 
org.bluez.Serial.Connect somestring

The spec says the string is one of:
	UUID 128Bit as string
	Profile short name e.g: spp, dun
	RFCOMM channel as string, 1-30

More information about the devel mailing list