From ccecfaac6ace64a2e2fd37c72c362df751513f64 Mon Sep 17 00:00:00 2001 From: Sathish Narasimman Date: Fri, 27 Jan 2017 12:05:17 +0530 Subject: [PATCH] Bluetooth: HFP HF: Disconnect rfcomm on SLC error If found error during service level connection disconnect rfcomm. Change-Id: Ida425375975b8d60ab1024d07a8ffe7745ae0b54 Signed-off-by: Sathish Narasimman --- subsys/bluetooth/host/hfp_hf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/subsys/bluetooth/host/hfp_hf.c b/subsys/bluetooth/host/hfp_hf.c index d9258609847..28ffe30d9dc 100644 --- a/subsys/bluetooth/host/hfp_hf.c +++ b/subsys/bluetooth/host/hfp_hf.c @@ -50,7 +50,14 @@ static const struct { void hf_slc_error(struct at_client *hf_at) { + struct bt_hfp_hf *hf = CONTAINER_OF(hf_at, struct bt_hfp_hf, at); + int err; + BT_ERR("SLC error: disconnecting"); + err = bt_rfcomm_dlc_disconnect(&hf->rfcomm_dlc); + if (err) { + BT_ERR("Rfcomm: Unable to disconnect :%d", -err); + } } int hfp_hf_send_cmd(struct bt_hfp_hf *hf, at_resp_cb_t resp,