# BT serial device though BlueDevil [SOLVED]

## paulj

Good evening all!

I am trying to set up my bluetooth on a Toshiba Satellite R830 laptop to connect to a . I have followed the wiki to the letter, and as a result I am able to connect to my phone without any problems. However, I am trying to connect to a bluetooth adaptor on a micro-controller device with less luck. I am using bluedevil in kde.

When following the instructions, I get to the bluez-test-input command and get the following error message:

 *Quote:*   

>  ~ $ bluez-test-input connect 00:13:03:14:11:70
> 
> Traceback (most recent call last):
> 
>   File "/usr/bin/bluez-test-input", line 42, in <module>
> ...

 

If I connect (as root) using "rfcomm connect 0", it connects correctly, and the desktop application communicates with the microcontroller board correctly.

I have a few ideas as to why I am struggling:

I have a permissions issue. My user account is in group uucp, but perhaps I am missing something else.

There is something I am missing with the dbus setup

The device is so simple, and isn't being seen by bluedevil. If I add new device in bluedevil, it sees the device, allows connection and gives me a message to confirm successful pairing, but then drops the connection immediately. The message in /var/log/messages is normally:

 *Quote:*   

> May 27 18:36:26 localhost bluetoothd[1896]: Discovery session 0x7f6654c8ea80 with :1.73 activated
> 
> May 27 18:36:31 localhost bluetoothd[1896]: Stopping discovery
> 
> 

 

Occasionally the following error message comes up:

 *Quote:*   

> 
> 
> May 25 07:04:54 localhost bluetoothd[1896]: Discovery session 0x7f8e913b0550 with :1.50 activated
> 
> May 25 07:05:01 localhost bluetoothd[1896]: Stopping discovery
> ...

 

I would appreciate any help I can get. For information, rfcomm configurations files:

/etc/bluetooth/main.conf:

```

[General]

# List of plugins that should not be loaded on bluetoothd startup

#DisablePlugins = network,input

# Default adaper name

# %h - substituted for hostname

# %d - substituted for adapter id

Name = %h-%d

# Default device class. Only the major and minor device class bits are

# considered.

Class = 0x000100

# How long to stay in discoverable mode before going back to non-discoverable

# The value is in seconds. Default is 180, i.e. 3 minutes.

# 0 = disable timer, i.e. stay discoverable forever

DiscoverableTimeout = 0

# How long to stay in pairable mode before going back to non-discoverable

# The value is in seconds. Default is 0.

# 0 = disable timer, i.e. stay pairable forever

PairableTimeout = 0

# Use some other page timeout than the controller default one

# which is 16384 (10 seconds).

PageTimeout = 8192

# Automatic connection for bonded devices driven by platform/user events.

# If a platform plugin uses this mechanism, automatic connections will be

# enabled during the interval defined below. Initially, this feature

# intends to be used to establish connections to ATT channels.

AutoConnectTimeout = 60

# What value should be assumed for the adapter Powered property when

# SetProperty(Powered, ...) hasn't been called yet. Defaults to true

InitiallyPowered = true

# Remember the previously stored Powered state when initializing adapters

RememberPowered = true

# Use vendor id source (assigner), vendor, product and version information for

# DID profile support. The values are separated by ":" and assigner, VID, PID

# and version.

# Possible vendor id source values: bluetooth, usb (defaults to usb)

#DeviceID = bluetooth:1234:5678:abcd

# Do reverse service discovery for previously unknown devices that connect to

# us. This option is really only needed for qualification since the BITE tester

# doesn't like us doing reverse SDP for some test cases (though there could in

# theory be other useful purposes for this too). Defaults to true.

ReverseServiceDiscovery = true

# Enable name resolving after inquiry. Set it to 'false' if you don't need

# remote devices name and want shorter discovery cycle. Defaults to 'true'.

NameResolving = true

# Enable runtime persistency of debug link keys. Default is false which

# makes debug link keys valid only for the duration of the connection

# that they were created for.

DebugKeys = false

# Enable the GATT functionality. Default is false

EnableGatt = false

```

/etc/bluetooth/input.conf

```
# Configuration file for the input service

# This section contains options which are not specific to any

# particular interface

[General]

# Set idle timeout (in minutes) before the connection will

# be disconnect (defaults to 0 for no timeout)

#IdleTimeout=30

```

/etc/ bluetooth/rfcomm.conf:

```
#

# RFCOMM configuration file.

#

rfcomm0 {

        # Automatically bind the device at startup

        bind no;

        # Bluetooth address of the device

        device 00:13:03:14:11:70;

        # RFCOMM channel for the connection

        channel 1;

        # Description of the connection

        comment "OpenPilot Bluetooth Connection";

}

```

The other files are as installed.

Versions of other programs installed:

kde*-4.10.3, bluedevil-1.3, bluez-4.101-r5

Thanks in advance for your help!Last edited by paulj on Mon May 27, 2013 8:40 pm; edited 2 times in total

----------

## paulj

Looks like I have found a gap in bluedevil capability:

https://bugs.kde.org/show_bug.cgi?id=306632

I'll leave the thread in case anyone else has the same problem.

UPDATE: I actually had it working all along, but I didn't realise it. The connection is made through rfcomm only when a client program calls for it. The one change in the rfcomm.conf file above is to change to line:

```
bind no;
```

 to 

```
bind yes;
```

Once the client program accesses the port - /dev/rfcomm0 in this case - the connection is made and information can be transmitted. I don't need to use bluedevil to make the connection before accessing it through the client.

Hopefully this will save someone else the hassle of digging though pages of old messages on google!

----------

