* [PATCH] Add heartrate monitoring LE device to auto connect list.
@ 2013-01-28 21:27 Damjan Cvetko
2013-01-29 23:36 ` Johan Hedberg
0 siblings, 1 reply; 4+ messages in thread
From: Damjan Cvetko @ 2013-01-28 21:27 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Damjan Cvetko
---
profiles/heartrate/heartrate.c | 2 ++
1 file changed, 2 insertions(+)
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;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Add heartrate monitoring LE device to auto connect list.
2013-01-28 21:27 [PATCH] Add heartrate monitoring LE device to auto connect list Damjan Cvetko
@ 2013-01-29 23:36 ` Johan Hedberg
2013-02-01 13:39 ` Damjan Cvetko
0 siblings, 1 reply; 4+ messages in thread
From: Johan Hedberg @ 2013-01-29 23:36 UTC (permalink / raw)
To: Damjan Cvetko; +Cc: linux-bluetooth
Hi Damjan,
On Mon, Jan 28, 2013, Damjan Cvetko wrote:
> ---
> profiles/heartrate/heartrate.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> 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;
> }
This patch isn't needed anymore since btd_device_add_attio_callback was
fixed to enable the auto connecting. Please verify that latest git works
for you.
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] Add heartrate monitoring LE device to auto connect list.
2013-01-29 23:36 ` Johan Hedberg
@ 2013-02-01 13:39 ` Damjan Cvetko
2013-02-01 16:11 ` Johan Hedberg
0 siblings, 1 reply; 4+ messages in thread
From: Damjan Cvetko @ 2013-02-01 13:39 UTC (permalink / raw)
To: Johan Hedberg; +Cc: linux-bluetooth@vger.kernel.org
> This patch isn't needed anymore since btd_device_add_attio_callback was fixed to enable the auto connecting. Please verify that latest git works for you.
Hi Johan.
Sorry, could not get back earlier.
Generally the latest code works, but not always. Every so often the reconnect would not happen. Here a snip from output when the reconnection does not happen (or fails somehow):
bluetoothd[4628]: src/attrib-server.c:channel_handler() op 0x1b
bluetoothd[4628]: src/adapter.c:dev_disconnected() Device 00:22:D0:00:00:64 disconnected, reason 0
bluetoothd[4628]: src/adapter.c:adapter_remove_connection()
bluetoothd[4628]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e
bluetoothd[4628]: src/device.c:device_bonding_failed() status 14
bluetoothd[4628]: src/adapter.c:resume_discovery()
bluetoothd[4628]: attrib/gattrib.c:g_attrib_unref() 0x1f9eda8: ref=4
bluetoothd[4628]: profiles/heartrate/heartrate.c:attio_disconnected_cb()
bluetoothd[4628]: attrib/gattrib.c:g_attrib_unref() 0x1f9eda8: ref=3
bluetoothd[4628]: attrib/gattrib.c:g_attrib_unref() 0x1f9eda8: ref=2
bluetoothd[4628]: g_attrib_unregister: invalid id
bluetoothd[4628]: attrib/gattrib.c:g_attrib_unref() 0x1f9eda8: ref=1
bluetoothd[4628]: src/adapter.c:adapter_connect_list_add() /org/bluez/hci0/dev_00_22_D0_00_00_64 added to BlueZ 5.1's connect_list
bluetoothd[4628]: src/adapter.c:trigger_passive_scanning()
bluetoothd[4628]: attrib/gattrib.c:g_attrib_unref() 0x1f9eda8: ref=0
bluetoothd[4628]: src/adapter.c:passive_scanning_complete() status 0x00
bluetoothd[4628]: src/adapter.c:discovering_callback() hci0 type 6 discovering 1
bluetoothd[4628]: src/adapter.c:device_found_callback() hci0 addr 00:22:D0:00:00:64, rssi -91 flags 0x0000 eir_len 17
bluetoothd[4628]: src/device.c:device_set_legacy() legacy 0
bluetoothd[4628]: src/adapter.c:stop_passive_scanning()
bluetoothd[4628]: src/device.c:device_connect_le() Connection attempt to: 00:22:D0:00:00:64
bluetoothd[4628]: src/adapter.c:discovering_callback() hci0 type 6 discovering 0
bluetoothd[4628]: src/adapter.c:connected_callback() hci0 device 00:22:D0:00:00:64 connected eir_len 0
bluetoothd[4628]: src/adapter.c:dev_disconnected() Device 00:22:D0:00:00:64 disconnected, reason 0
bluetoothd[4628]: src/adapter.c:adapter_remove_connection()
bluetoothd[4628]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e
bluetoothd[4628]: src/device.c:device_bonding_failed() status 14
bluetoothd[4628]: src/adapter.c:resume_discovery()
bluetoothd[4628]: src/device.c:att_connect_cb() connect error: Function not implemented (38)
bluetoothd[4628]: src/device.c:att_error_cb() Enabling automatic connections
bluetoothd[4628]: src/adapter.c:adapter_connect_list_add() ignoring already added device /org/bluez/hci0/dev_00_22_D0_00_00_64
(end)
And for reference a situation where reconnection works:
bluetoothd[4628]: src/attrib-server.c:channel_handler() op 0x1b
bluetoothd[4628]: src/adapter.c:dev_disconnected() Device 00:22:D0:00:00:64 disconnected, reason 0
bluetoothd[4628]: src/adapter.c:adapter_remove_connection()
bluetoothd[4628]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e
bluetoothd[4628]: src/device.c:device_bonding_failed() status 14
bluetoothd[4628]: src/adapter.c:resume_discovery()
bluetoothd[4628]: attrib/gattrib.c:g_attrib_unref() 0x1fa33e8: ref=4
bluetoothd[4628]: profiles/heartrate/heartrate.c:attio_disconnected_cb()
bluetoothd[4628]: attrib/gattrib.c:g_attrib_unref() 0x1fa33e8: ref=3
bluetoothd[4628]: attrib/gattrib.c:g_attrib_unref() 0x1fa33e8: ref=2
bluetoothd[4628]: g_attrib_unregister: invalid id
bluetoothd[4628]: attrib/gattrib.c:g_attrib_unref() 0x1fa33e8: ref=1
bluetoothd[4628]: src/adapter.c:adapter_connect_list_add() /org/bluez/hci0/dev_00_22_D0_00_00_64 added to BlueZ 5.1's connect_list
bluetoothd[4628]: src/adapter.c:trigger_passive_scanning()
bluetoothd[4628]: attrib/gattrib.c:g_attrib_unref() 0x1fa33e8: ref=0
bluetoothd[4628]: src/adapter.c:passive_scanning_complete() status 0x00
bluetoothd[4628]: src/adapter.c:discovering_callback() hci0 type 6 discovering 1
bluetoothd[4628]: src/adapter.c:device_found_callback() hci0 addr 00:22:D0:00:00:64, rssi -87 flags 0x0000 eir_len 17
bluetoothd[4628]: src/device.c:device_set_legacy() legacy 0
bluetoothd[4628]: src/device.c:device_set_rssi() rssi -87 delta 10
bluetoothd[4628]: src/adapter.c:stop_passive_scanning()
bluetoothd[4628]: src/adapter.c:device_found_callback() hci0 addr 00:22:D0:00:00:64, rssi -87 flags 0x0000 eir_len 17
bluetoothd[4628]: src/device.c:device_set_legacy() legacy 0
bluetoothd[4628]: src/adapter.c:stop_passive_scanning()
bluetoothd[4628]: src/device.c:device_connect_le() Connection attempt to: 00:22:D0:00:00:64
bluetoothd[4628]: src/adapter.c:discovering_callback() hci0 type 6 discovering 0
bluetoothd[4628]: Stopping passive scanning failed: Rejected
bluetoothd[4628]: src/adapter.c:connected_callback() hci0 device 00:22:D0:00:00:64 connected eir_len 0
bluetoothd[4628]: attrib/gattrib.c:g_attrib_ref() 0x1f9eda8: ref=1
bluetoothd[4628]: attrib/gattrib.c:g_attrib_ref() 0x1f9eda8: ref=2
bluetoothd[4628]: src/adapter.c:adapter_connect_list_remove() /org/bluez/hci0/dev_00_22_D0_00_00_64 removed from BlueZ 5.1's connect_list
bluetoothd[4628]: src/adapter.c:stop_passive_scanning()
bluetoothd[4628]: profiles/heartrate/heartrate.c:attio_connected_cb()
bluetoothd[4628]: attrib/gattrib.c:g_attrib_ref() 0x1f9eda8: ref=3
bluetoothd[4628]: attrib/gattrib.c:g_attrib_ref() 0x1f9eda8: ref=4
bluetoothd[4628]: attrib/gattrib.c:g_attrib_ref() 0x1f9eda8: ref=5
(goes on)
I did not have time yet to look into this, will try to do it next week. With the old solution this did not happen in the window of one week when constantly testing this.
Best regards,
Damjan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add heartrate monitoring LE device to auto connect list.
2013-02-01 13:39 ` Damjan Cvetko
@ 2013-02-01 16:11 ` Johan Hedberg
0 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2013-02-01 16:11 UTC (permalink / raw)
To: Damjan Cvetko; +Cc: linux-bluetooth@vger.kernel.org
Hi Damjan,
On Fri, Feb 01, 2013, Damjan Cvetko wrote:
> Generally the latest code works, but not always. Every so often the
> reconnect would not happen. Here a snip from output when the
> reconnection does not happen (or fails somehow):
>
> bluetoothd[4628]: src/attrib-server.c:channel_handler() op 0x1b
> bluetoothd[4628]: src/adapter.c:dev_disconnected() Device 00:22:D0:00:00:64 disconnected, reason 0
> bluetoothd[4628]: src/adapter.c:adapter_remove_connection()
> bluetoothd[4628]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e
> bluetoothd[4628]: src/device.c:device_bonding_failed() status 14
> bluetoothd[4628]: src/adapter.c:resume_discovery()
> bluetoothd[4628]: attrib/gattrib.c:g_attrib_unref() 0x1f9eda8: ref=4
> bluetoothd[4628]: profiles/heartrate/heartrate.c:attio_disconnected_cb()
> bluetoothd[4628]: attrib/gattrib.c:g_attrib_unref() 0x1f9eda8: ref=3
> bluetoothd[4628]: attrib/gattrib.c:g_attrib_unref() 0x1f9eda8: ref=2
> bluetoothd[4628]: g_attrib_unregister: invalid id
> bluetoothd[4628]: attrib/gattrib.c:g_attrib_unref() 0x1f9eda8: ref=1
> bluetoothd[4628]: src/adapter.c:adapter_connect_list_add() /org/bluez/hci0/dev_00_22_D0_00_00_64 added to BlueZ 5.1's connect_list
> bluetoothd[4628]: src/adapter.c:trigger_passive_scanning()
> bluetoothd[4628]: attrib/gattrib.c:g_attrib_unref() 0x1f9eda8: ref=0
> bluetoothd[4628]: src/adapter.c:passive_scanning_complete() status 0x00
> bluetoothd[4628]: src/adapter.c:discovering_callback() hci0 type 6 discovering 1
> bluetoothd[4628]: src/adapter.c:device_found_callback() hci0 addr 00:22:D0:00:00:64, rssi -91 flags 0x0000 eir_len 17
> bluetoothd[4628]: src/device.c:device_set_legacy() legacy 0
> bluetoothd[4628]: src/adapter.c:stop_passive_scanning()
> bluetoothd[4628]: src/device.c:device_connect_le() Connection attempt to: 00:22:D0:00:00:64
> bluetoothd[4628]: src/adapter.c:discovering_callback() hci0 type 6 discovering 0
> bluetoothd[4628]: src/adapter.c:connected_callback() hci0 device 00:22:D0:00:00:64 connected eir_len 0
> bluetoothd[4628]: src/adapter.c:dev_disconnected() Device 00:22:D0:00:00:64 disconnected, reason 0
> bluetoothd[4628]: src/adapter.c:adapter_remove_connection()
> bluetoothd[4628]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e
> bluetoothd[4628]: src/device.c:device_bonding_failed() status 14
> bluetoothd[4628]: src/adapter.c:resume_discovery()
> bluetoothd[4628]: src/device.c:att_connect_cb() connect error: Function not implemented (38)
It's hard to say exactly why the connection is failing here without the
HCI logs. Could you run btmon simultaneously and let me know the output.
Also please update to latest bluez.git since there might be some fixes
that you have missed.
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-02-01 16:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-28 21:27 [PATCH] Add heartrate monitoring LE device to auto connect list Damjan Cvetko
2013-01-29 23:36 ` Johan Hedberg
2013-02-01 13:39 ` Damjan Cvetko
2013-02-01 16:11 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).