# rfcomm blues

## CoderMan

Hi. I've got this robotics project where I send commands to the robot via a D-Link DBT-120 bluetooth adapter on the computer side and an eb500 EmbeededBlue bluetooth card on the robot side. This works great on a Fedora box in our lab using rfbind, so we just send and receive characters to /dev/rfcomm* in order to communicate with the robots internal program.

However, I am trying to set up the same thing on my Gentoo netbook (Dell Mini 10v, Intel Atom dual-core 32 bit). However when I try to use the rfcomm created device file, I get this, even running as root:

```

$ rfcomm bind rfcomm0

$ cat /dev/rfcomm0 

cat: /dev/rfcomm0: Permission denied

```

Permissions on the file:

```
crw-rw---- 1 root uucp 216, 0 2009-10-16 15:06 /dev/rfcomm0
```

Nothing changes even if I set the file to root:root.

D-Link adapter is detected:

```
$ hcitool dev

Devices:

   hci0   00:1E:58:3F:5C:85

```

Robot bluetooth card is detected (eb500 is the card, other names are computers):

```
$ hcitool scan

Scanning ...

   00:23:6C:BA:C5:19   belmont

   00:0C:84:00:45:A9   eb500

   00:0D:93:11:7B:B3   bootes

```

So I haven't been able to figure out why this is working on the Fedora box but not on the Gentoo netbook.

Here is the rfcomm config file:

```
$ cat /etc/bluetooth/rfcomm.conf

rfcomm0 {

        # Automatically bind the device at startup

        bind no;

#

        # Bluetooth address of the device

        device 00:0C:84:00:45:A9;

#

        # RFCOMM channel for the connection

        channel 1;

#

        # Description of the connection

        comment "Alpha Robot";

}

rfcomm1 {

        # Automatically bind the device at startup

        bind no;

#

        # Bluetooth address of the device

        device 00:0C:84:00:44:2F;

#

        # RFCOMM channel for the connection

        channel 1;

#

        # Description of the connection

        comment "Beta Robot";

}
```

----------

## gordon_freeman

try chmodd'ing it to 777, if that helps then it was a permissions problem (+x?)

----------

## CoderMan

 *gordon_freeman wrote:*   

> try chmodd'ing it to 777, if that helps then it was a permissions problem (+x?)

 

Thanks, but that didn't seem to have any effect.

----------

## CoderMan

I've been looking into this some more. I think the problem is that I am not transmitting the PIN number that is needed. The Fedora box was set up by someone else and I think it uses gnome-passkey or some gnome utility to transmit the pin automatically. My Dell mini uses Xfce4 and so I don't have that installed. Still not sure exactly how to go about fixing this (without installing gnome) but I think I'm headed in the right direction. (I know the correct PIN number I believe, just need to figure out how to transmit it.)

----------

## CoderMan

Let me hear ya say, Yeah! Yeah!

I figured out the problem. The issue was, as I mentioned before, that I was not transmitting the PIN number of the eb500. Consequently, the eb500 wasn't allowing me to establish a connection. The Fedora box was using gnomes bluez-passkey utility to send this automatically. But my Gentoo netbook uses just the net-wireless/bluez-utils package. In order to get this pin to be sent, I had to create a file in the /var/lib/bluetooth directory.

```
adler usr # cd /var/lib/bluetooth/

adler bluetooth # ls

00:1E:58:3F:5C:85
```

00:1E:58:3F:5C:85 is the address of the D-Link Bluetooth Adapter connected to my netbook.

```
adler bluetooth # cd 00:1E:58:3F:5C:85

adler bluetooth # echo "00:0C:84:00:45:A9 0000" >> pincodes
```

So I create the file "pincodes" at /var/lib/bluetooth/<local-mac-address>/pincodes and put the mac address and PIN number into this file. This tells bluez-utils that when I connect to remote device 00:0C:84:00:45:A9 from local device 00:1E:58:3F:5C:85, the pin code 0000 is sent automatically in order to establish the connection.

Now I can bind the device with "rfcomm bind rfcomm0" and then whenever I start to use /dev/rfcomm0 a connection is automatically set up with the eb500.

This info is in the hcid man page, but unfortunately I didn't know to look there and found the solution only after many hours of google searching.

----------

## mikb

Unfortunately, none of this is working for me....

hcidump tells me I still have an authentication failure: http://kambe.pastebin.ca/1674163

Here's my hcid.conf:

```
# HCId options                               

options {                                    

        # Automatically initialize new devices

        autoinit yes;                         

        # Security Manager mode

        #   none - Security manager disabled

        #   auto - Use local PIN for incoming connections

        #   user - Always ask user for a PIN

        #

        security auto;

        # Pairing mode

        pairing multi;

        # PIN helper

        #pin_helper /etc/bluetooth/pin-helper;

        passkey 0000;

}

# Default settings for HCI devices

device {

        # Local device name

        #   %d - device id

        #   %h - host name

        name "BlueZ at %h (hci%d)";

        # Local device class

        class 0x3e0100;

        # Inquiry and Page scan

        iscan enable; pscan enable;

        # Default link mode

        lm accept;

        # Default link policy

        lp rswitch,hold,sniff,park;

        # Authentication and Encryption (Security Mode 3)

        #auth enable;

        #encrypt enable;

}

```

And my rfcomm.conf:

```
rfcomm0 {

        bind yes;

        device 02:22:FD:01:55:C8;

        channel 2;

        comment "Mike's Phone";

}

```

And the pincodes file: (/var/lib/bluetooth/00:02:72:0D:BE:12/pincodes):

```
02:22:FD:01:55:C8 0000
```

Does anyone have any suggestions?

----------

