Skip to content

Notification enabled before connection #13316

@pdunaj

Description

@pdunaj

Describe the bug
Bond peripheral device to Moto G5 (Android 8.1.0). Reboot device which will reconnect.
On the log I observe that before connection callback is received I get callback about notification being enabled.

CCC changes are notified from channel ops callback called from bt_l2cap_connected. This last function is called from bt_conn_set_state on BT_CONN_CONNECTED state. Now note that notify_connected is called from the same place but after bt_l2cap_connected. This explains why information about callback is sent to application after information about notification being enabled.

To Reproduce
Described above.

Impact
Application does not know which connection ccc change relates to as there is no conn argument in the callback.

Screenshots or console output

[00009340] <inf> ble_adv: Advertising started
[00065351] <err> bt_hci_core: PDUNAJ enh_conn_complete 839
[00065355] <err> bt_hci_core: PDUNAJ enh_conn_complete 958 conn=0x20002554
[00065356] <err> bt_gatt: PDUNAJ bt_gatt_connected 2429 conn 0x20002554
[00065357] <err> bt_gatt: PDUNAJ connected_cb 1078
[00065357] <err> bt_gatt: PDUNAJ gatt_ccc_changed 644
[00065357] <err> ble_gatt_hids: PDUNAJ hids_input_report_ccc_changed 440
[00065358] <err> hids: PDUNAJ mouse_notif_handler 135
[00065358] <err> hids: PDUNAJ notif_handler 125
[00065358] <err> hids: PDUNAJ broadcast_subscription_change 72 conn=0x00000000
[00065359] <inf> hids: Notifications enabled
[00065359] <err> bt_gatt: PDUNAJ connected_cb 1078
[00065359] <err> bt_gatt: PDUNAJ gatt_ccc_changed 644
[00065360] <err> ble_gatt_hids: PDUNAJ hids_boot_mouse_inp_rep_ccc_changed 494
[00065360] <err> hids: PDUNAJ boot_mouse_notif_handler 142
[00065360] <err> hids: PDUNAJ notif_handler 125
[00065361] <err> bt_conn: PDUNAJ notify_connected 136 conn=0x20002554 cb=0x00003f01
[00065363] <inf> ble_state: Connected to 80:58:f8:56:19:ce (public)
[00065364] <inf> ble_state: Set security level
[00065368] <inf> event_manager: e: hid_report_subscription_event MOUSE report notification enabled by 0x00000000
[00065370] <inf> event_manager: e: ble_peer_event id=0x20002554 CONNECTED

Environment (please complete the following information):
ncs zephyr 236ec2d2553536835c76dff84adcb188309eaf90
zephyr dee63e20

Additional context
I this it worked in the past... although I see no changes related to this done recently. Maybe something else changed or this was overlooked...

Metadata

Metadata

Labels

area: BluetoothbugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bug

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions