Auto reconnect heartrate LE device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.

Talked to jhe on IRC regarding this some days ago. I have a Polar heart rate monitor, and with the latest code it work well enough. However when the device goes out of range, it is disconnected from bluetoothd and does not reconnect when coming back into range:

bluetoothd[2898]: src/adapter.c:dev_disconnected() Device 00:22:D0:00:00:64 disconnected, reason 0
...
bluetoothd[2898]: src/device.c:attrib_disconnected_cb() Automatic connection disabled

I wanted to add auto reconnection, and this 1 line fix is what I came up with. It works in most cases, but sometimes bluetoothd fals into a loop.

...
"src/adapter.c:adapter_set_discovering() hci0 restarting discovery: disc_sessions 2"
"src/adapter.c:start_discovery_complete() Busy (0x0a)"
"src/adapter.c:adapter_set_discovering() hci0 restarting discovery: disc_sessions 2"
...

Still looking into that part, could also be unrelated. Here is the patch.

Best,
Damjan
---
Set auto connect for heartrate device.

diff --git a/profiles/heartrate/heartrate.c b/profiles/heartrate/heartrate.c
index 5c56d3f..1788d4f 100644
--- a/profiles/heartrate/heartrate.c
+++ b/profiles/heartrate/heartrate.c
@@ -801,6 +801,8 @@ static int heartrate_device_register(struct btd_device *device,
        hr->attioid = btd_device_add_attio_callback(device, attio_connected_cb,
                                                attio_disconnected_cb, hr);

+       device_set_auto_connect(device, TRUE);
+
        return 0;
 }

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux