0

I'm trying to connect to a Parrot Drone (BLE device) through Bluez in C, but the connection always fails with:

Connection timed out

hcidump says:

< HCI Command: LE Create Connection (0x08|0x000d) plen 25
    bdaddr 78:BD:BC:0F:17:D8 type 0
    interval 4 window 4 initiator_filter 0
    own_bdaddr_type 0 min_interval 15 max_interval 15
    latency 0 supervision_to 3200 min_ce 1 max_ce 1
> HCI Event: Command Status (0x0f) plen 4
    LE Create Connection (0x08|0x000d) status 0x00 ncmd 1

The relevant portion of code:

uint16_t handle;

startBTHost();

if(hci_le_create_conn(
        bte_params.dd,
        htobs(0x0004),
        htobs(0x0004),
        0x00,
        LE_PUBLIC_ADDRESS,
        device->addr,
        LE_PUBLIC_ADDRESS,
        htobs(0x000F),
        htobs(0x000F),
        htobs(0x0000),
        htobs(0x0C80),
        htobs(0x0001),
        htobs(0x0001),
        &handle,
        25000
) < 0) {
    writelog(LOG_ERROR, "Can not connect: %s", strerror(errno));
}

uint8_t reason;
bte_params.err = hci_disconnect(bte_params.dd, handle, reason, 25000);


stopBTHost();

It is almost a 1:1 copy from the hcitool (lecc option) source code: http://code.metager.de/source/xref/linux/bluetooth/bluez/tools/hcitool.c#cmd_lecc

I think the crucial information comes from dmesg. Everytime a connection timeout happens, the following error is reported:

[52106.588813] Bluetooth: hci1 hardware error 0x41
[52252.305876] Bluetooth: hci1 hardware error 0x41
[52292.853491] Bluetooth: hci1 hardware error 0x41
[52477.116149] Bluetooth: hci1 hardware error 0x41

Anyone knows where hardware error 0x41 comes from? I get the same results when using hcitool lecc directly:

cehrig-tpgnome parrot-drone-c # hcitool -i hci1 lecc 78:BD:BC:0F:17:D8
Could not create connection: Connection timed out

I'm running Gentoo kernel 4.4.6 with built-in BLE features.

thx in advance

  • Which bluetooth controller do you have? Is it a usb adapter? It seems like a buggy one. Try to change your different parameters up and down if that might help. – Emil Jun 05 '16 at 12:18
  • The problem was solved by changing LE_PUBLIC_ADDRESS for the remote device to LE_RANOM_ADDRESS –  Jun 06 '16 at 13:33

0 Answers0