# bluetooth w/ bluez > 4.x + simple-agent

## pigeon768

Can anyone get this to work? I try the following: 

```
 ~ # simple-agent hci0 20:42:12:17:06:97

RequestPinCode (/org/bluez/18431/hci0/dev_20_42_12_17_06_97)

Enter PIN Code: 0000

Creating device failed: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
```

 Clicking the connect button on the keyboard in the middle of attempting to connect results in: 

```
~ # simple-agent hci0 20:42:12:17:06:97

RequestPinCode (/org/bluez/18431/hci0/dev_20_42_12_17_06_97)

Enter PIN Code: 0000

Creating device failed: org.bluez.Error.AuthenticationCanceled: Authentication Canceled
```

 The receiver and keyboard work fine in windows 7 with no additional drivers of any sort. According to this my keyboard works in linux. I have the same results using the built in bluetooth receiver on my laptop in linux. I have no other device to attempt to make work. Nothing useful appears in /var/log/messages or dmesg. 

```
 ~ # zgrep _BT_ /proc/config.gz

CONFIG_BT_L2CAP=m

CONFIG_BT_SCO=m

CONFIG_BT_RFCOMM=m

CONFIG_BT_RFCOMM_TTY=y

CONFIG_BT_BNEP=m

CONFIG_BT_BNEP_MC_FILTER=y

CONFIG_BT_BNEP_PROTO_FILTER=y

CONFIG_BT_HIDP=m

CONFIG_BT_HCIBTUSB=m

# CONFIG_BT_HCIUART is not set

# CONFIG_BT_HCIBCM203X is not set

# CONFIG_BT_HCIBPA10X is not set

# CONFIG_BT_HCIBFUSB is not set

# CONFIG_BT_HCIVHCI is not set

# CONFIG_BT_MRVL is not set

# CONFIG_BT_ATH3K is not set
```

----------

## VoidMage

Did you edit /etc/bluetooth/rfcomm.conf and add bluetooth to correct runlevel ?

Some info should be found by hcitool.

----------

## pigeon768

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

rfcomm0 {

        bind yes;

        device 20:42:12:17:06:97;

        channel 1;

}

~ $ hcitool scan

Scanning ...

        00:1A:6B:12:82:A8       BRCM BT4X

        20:42:12:17:06:97       Adesso Bluetooth Touchpad Keyboard

~ $ hcitool inq

Inquiring ...

        00:1A:6B:12:82:A8       clock offset: 0x0e0d    class: 0x00010c

        20:42:12:17:06:97       clock offset: 0x4840    class: 0x002540

~ $ /etc/init.d/bluetooth status

 * status: started

~ $ sudo hciconfig -a

hci0:   Type: BR/EDR  Bus: USB

        BD Address: 00:15:83:34:36:20  ACL MTU: 310:10  SCO MTU: 64:8

        UP RUNNING PSCAN

        RX bytes:5427 acl:37 sco:0 events:403 errors:0

        TX bytes:3341 acl:42 sco:0 commands:130 errors:0

        Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80

        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3

        Link policy: RSWITCH HOLD SNIFF PARK

        Link mode: SLAVE ACCEPT

        Name: 'moamp-0'

        Class: 0x480100

        Service Classes: Capturing, Telephony

        Device Class: Computer, Uncategorized

        HCI Version: 2.0 (0x3)  Revision: 0xc5c

        LMP Version: 2.0 (0x3)  Subversion: 0xc5c

        Manufacturer: Cambridge Silicon Radio (10)

~ $ sudo l2ping -c 5 20:42:12:17:06:97

Ping: 20:42:12:17:06:97 from 00:15:83:34:36:20 (data size 44) ...

0 bytes from 20:42:12:17:06:97 id 0 time 29.11ms

0 bytes from 20:42:12:17:06:97 id 1 time 24.75ms

0 bytes from 20:42:12:17:06:97 id 2 time 26.00ms

0 bytes from 20:42:12:17:06:97 id 3 time 23.49ms

0 bytes from 20:42:12:17:06:97 id 4 time 4.87ms

5 sent, 5 received, 0% loss

```

 In rfcomm.conf -- do I put the address of the host of the bluetooth adapter or the address of the device I want to connect to?

----------

## pigeon768

*facepalm*

On a complete whim, I typed the pin and hit enter on the keyboard while simple-auth was waiting - it works. I returned rfcomm.conf to its default, everything commented out state - apparently rfcomm either isn't necessary or is automagically set up is a sane default configuration.

Fucking wireless sucks.

----------

## pigeon768

Ok, I turned the device off and back on again to see how well it would reconnect. It turns out, it doesn't reconnect. At all. Not even by retyping any of the commands in. The lights on the receiver and the keyboard blink rapidly like they're trying to connect but then they don't.

----------

## VoidMage

What I'm trying to say is: simple-agent is AFAIK obsolete.

Also, I wasn't asking if it's started, but if it's added to default runlevel.

----------

## pigeon768

It's in the default runlevel, yes.

If not simplle-agent - what's the preferred method to manage bluetooth? I thought simple-agent was the new way to do it with bluez-4.x.

----------

## VoidMage

Actually, I'm not sure - I don't have any bluetooth devices.

Note, however, that simple-agent is not really a tool, it's one of test programs, installed only with

test-programs useflag.

So, you should probably look at bluetooth.conf and rfcomm.conf again.

----------

