-
Notifications
You must be signed in to change notification settings - Fork 33
bluetooth: Fix the issue where disabling does not disconnect the AVRC… #457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -88,7 +88,6 @@ static void zblue_on_ct_passthrough_rsp(struct bt_avrcp_ct* ct, uint8_t tid, bt_ | |||||||||||||
| static void zblue_on_ct_notification_rsp(struct bt_avrcp_ct* ct, uint8_t tid, uint8_t status, uint8_t event_id, struct bt_avrcp_event_data* data); | ||||||||||||||
| static void zblue_on_ct_get_element_attrs_rsp(struct bt_avrcp_ct* ct, uint8_t tid, uint8_t status, struct net_buf* buf); | ||||||||||||||
| static void zblue_on_ct_get_play_status_rsp(struct bt_avrcp_ct* ct, uint8_t tid, uint8_t status, struct net_buf* buf); | ||||||||||||||
| static bt_status_t avrcp_control_disconnect(bt_controller_id_t id, bt_address_t* bd_addr, void* user_data); | ||||||||||||||
| #endif | ||||||||||||||
|
|
||||||||||||||
| #ifdef CONFIG_BLUETOOTH_AVRCP_ABSOLUTE_VOLUME | ||||||||||||||
|
|
@@ -147,6 +146,8 @@ static struct bt_avrcp_tg_cb avrcp_tg_cbks = { | |||||||||||||
| }; | ||||||||||||||
| #endif /* CONFIG_BLUETOOTH_AVRCP_TARGET || CONFIG_BLUETOOTH_AVRCP_ABSOLUTE_VOLUME */ | ||||||||||||||
|
|
||||||||||||||
| static bt_status_t bt_sal_avrcp_disconnect(bt_controller_id_t id, bt_address_t* bd_addr, void* user_data); | ||||||||||||||
|
|
||||||||||||||
| #ifdef AVRCP_SDP_BY_APP | ||||||||||||||
| #if defined(CONFIG_BLUETOOTH_AVRCP_CONTROL) || defined(CONFIG_BLUETOOTH_AVRCP_ABSOLUTE_VOLUME) | ||||||||||||||
| static struct bt_sdp_attribute avrcp_ct_attrs[] = { | ||||||||||||||
|
|
@@ -733,7 +734,7 @@ static void zblue_on_ct_connected(struct bt_conn* conn, struct bt_avrcp_ct* ct) | |||||||||||||
| msg->data.conn_state.reason = PROFILE_REASON_UNSPECIFIED; | ||||||||||||||
| bt_sal_avrcp_control_event_callback(msg); | ||||||||||||||
| bt_sal_cm_profile_connected_callback(&avrcp_info->bd_addr, PROFILE_AVRCP_CT, CONN_ID_DEFAULT); | ||||||||||||||
| bt_sal_profile_disconnect_register(&avrcp_info->bd_addr, PROFILE_AVRCP_CT, CONN_ID_DEFAULT, PRIMARY_ADAPTER, avrcp_control_disconnect, NULL); | ||||||||||||||
| bt_sal_profile_disconnect_register(&avrcp_info->bd_addr, PROFILE_AVRCP_CT, CONN_ID_DEFAULT, PRIMARY_ADAPTER, bt_sal_avrcp_disconnect, NULL); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| static void zblue_on_ct_disconnected(struct bt_avrcp_ct* ct) | ||||||||||||||
|
|
@@ -1052,6 +1053,9 @@ static void zblue_on_tg_connected(struct bt_conn* conn, struct bt_avrcp_tg* tg) | |||||||||||||
| msg->data.conn_state.conn_state = PROFILE_STATE_CONNECTED; | ||||||||||||||
| msg->data.conn_state.reason = PROFILE_REASON_UNSPECIFIED; | ||||||||||||||
| bt_sal_avrcp_target_event_callback(msg); | ||||||||||||||
|
|
||||||||||||||
| bt_sal_cm_profile_connected_callback(&avrcp_info->bd_addr, PROFILE_AVRCP_TG, CONN_ID_DEFAULT); | ||||||||||||||
| bt_sal_profile_disconnect_register(&avrcp_info->bd_addr, PROFILE_AVRCP_TG, CONN_ID_DEFAULT, PRIMARY_ADAPTER, bt_sal_avrcp_disconnect, NULL); | ||||||||||||||
| #endif | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
|
|
@@ -1073,6 +1077,8 @@ static void zblue_on_tg_disconnected(struct bt_avrcp_tg* tg) | |||||||||||||
| msg->data.conn_state.conn_state = PROFILE_STATE_DISCONNECTED; | ||||||||||||||
| msg->data.conn_state.reason = PROFILE_REASON_UNSPECIFIED; | ||||||||||||||
| bt_sal_avrcp_target_event_callback(msg); | ||||||||||||||
|
|
||||||||||||||
| bt_sal_cm_profile_disconnected_callback(&avrcp_info->bd_addr, PROFILE_AVRCP_TG, CONN_ID_DEFAULT); | ||||||||||||||
| #endif | ||||||||||||||
|
Comment on lines
+1080
to
1082
|
||||||||||||||
| bt_sal_cm_profile_disconnected_callback(&avrcp_info->bd_addr, PROFILE_AVRCP_TG, CONN_ID_DEFAULT); | |
| #endif | |
| #endif | |
| bt_sal_cm_profile_disconnected_callback(&avrcp_info->bd_addr, PROFILE_AVRCP_TG, CONN_ID_DEFAULT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The connection-manager integration for TG connect/disconnect is wrapped in
#ifdef CONFIG_BLUETOOTH_AVRCP_TARGET. However,BLUETOOTH_AVRCP_ABSOLUTE_VOLUMEcan be enabled withoutBLUETOOTH_AVRCP_TARGET(see root Kconfig), and this file still registers TG callbacks in that configuration. In that case the TG connection will still not be registered for disconnect handling, so disabling Bluetooth may continue to leave the TG connection up. Consider widening the preprocessor guard to includeCONFIG_BLUETOOTH_AVRCP_ABSOLUTE_VOLUME(or moving these CM calls outside the TARGET-only guard) so any configuration that brings up a TG link registers/unregisters it with the connection manager.