# Bluez and serial communcations

## abduct

Hi, I have a piece of bluetooth hardware that uses serial communications to deliver data to and from the device.

I have successfully discovered, paired, and trusted the device, but when I attempt to connect I get the following log:

```
[bluetooth]# connect 00:13:43:42:D6:8B

Attempting to connect to 00:13:43:42:D6:8B

[CHG] Device 00:13:43:42:D6:8B Connected: yes

[CHG] Device 00:13:43:42:D6:8B ServicesResolved: yes

Failed to connect: org.bluez.Error.NotAvailable

[CHG] Device 00:13:43:42:D6:8B ServicesResolved: no

[CHG] Device 00:13:43:42:D6:8B Connected: no

[CHG] Device 00:13:43:42:D6:8B LegacyPairing: yes

[CHG] Device 00:13:43:42:D6:8B LegacyPairing: no

[CHG] Device 00:13:43:42:D6:8B LegacyPairing: yes

[CHG] Device 00:13:43:42:D6:8B LegacyPairing: no

[CHG] Device 00:13:43:42:D6:8B LegacyPairing: yes

[CHG] Device 00:13:43:42:D6:8B LegacyPairing: no
```

I have googled this and it appears I may be missing a serial profile (SPP), but I can't find any concrete ways to enable this. Likewise I no longer have utilities such as RFCOMM. I have tried emerging with depreciated and extra-tools useflags, but I still am missing a lot of tools. I have enabled all kernel related bluetooth options.

How can I get bluez to connect to this device, as well as give me utilities such as RFCOMM.

Thanks.

Edit:: After a little more digging I edited `/etc/init.d/bluetooth` to run the bluetoothd command with -C compatibility mode, and It seems to connect, but after removing the bluetooth device (untrust, remove) and repairing and attempting to connect again, I get `Failed to connect: org.bluez.Error.NotAvailable` after pairing and attempting to connect.

Edit2:: I seem to be getting a lot of `[ 4323.138748] Bluetooth: hci0: last event is not cmd complete (0x0f)` in my dmesg. Not sure what it means.

Edit3:: I got the rfcomm tool installed, I must of typod the depreciated use flag. Although when trying to pair now via bluetoothctl I get `Failed to pair: org.bluez.Error.AuthenticationCanceled` after about 10 seconds of it being "connected"

Edit4:: After a bit of digging this piece of hardware uses the createInsecureRfcommSocket method in Android, Is there a way to mimic this connection standard? I am not positive, but I think I need to authenticate using a UUID? Might explain the reason for the AuthenticationCanceled error?

----------

## abduct

No idea why, but it seems to be working now.

I had to manually launch 

```
/usr/libexec/bluetooth/bluetoothd -C
```

 to get compatibility mode. Afterwards I ran 

```
hciconfig hci0 up

rfcomm -i hci0 connect /dev/rfcomm0 addr 5

```

Meanwhile `bluetoothctl` was running in the background and seemed to automatically pair and connect when the rfcomm command is ran.

----------

