Diff between 32d740d87970fa476644aeea267663ea3c74644a and b0db5e1c330ade4cfa188105468aa6fd60293ab3

Changed Files

File Additions Deletions Status
src/shared/hfp.c +34 -2 modified
unit/test-hfp.c +1 -0 modified

Full Patch

diff --git a/src/shared/hfp.c b/src/shared/hfp.c
index bc81a07..2342c24 100644
--- a/src/shared/hfp.c
+++ b/src/shared/hfp.c
@@ -1996,7 +1996,7 @@ static void clip_cb(struct hfp_context *context, void *user_data)
 							hfp->callbacks_data);
 }
 
-static void clip_resp(enum hfp_result result, enum hfp_error cme_err,
+static void cmee_resp(enum hfp_result result, enum hfp_error cme_err,
 	void *user_data)
 {
 	struct hfp_hf *hfp = user_data;
@@ -2004,7 +2004,7 @@ static void clip_resp(enum hfp_result result, enum hfp_error cme_err,
 	DBG(hfp, "");
 
 	if (result != HFP_RESULT_OK) {
-		DBG(hfp, "hf: CLIP error: %d", result);
+		DBG(hfp, "hf: CMEE error: %d", result);
 		goto failed;
 	}
 
@@ -2020,6 +2020,38 @@ failed:
 						hfp->callbacks_data);
 }
 
+static void clip_resp(enum hfp_result result, enum hfp_error cme_err,
+	void *user_data)
+{
+	struct hfp_hf *hfp = user_data;
+
+	DBG(hfp, "");
+
+	if (result != HFP_RESULT_OK) {
+		DBG(hfp, "hf: CLIP error: %d", result);
+		goto failed;
+	}
+
+	if (!(hfp->features & HFP_AG_FEAT_EXTENDED_RES_CODE)) {
+		/* Jump to next setup state */
+		cmee_resp(HFP_RESULT_OK, cme_err, user_data);
+		return;
+	}
+
+	if (!hfp_hf_send_command(hfp, cmee_resp, hfp, "AT+CMEE=1")) {
+		DBG(hfp, "hf: Could not send AT+CMEE=1");
+		result = HFP_RESULT_ERROR;
+		goto failed;
+	}
+
+	return;
+
+failed:
+	if (hfp->callbacks->session_ready)
+		hfp->callbacks->session_ready(result, cme_err,
+						hfp->callbacks_data);
+}
+
 static void cops_resp(enum hfp_result result, enum hfp_error cme_err,
 	void *user_data)
 {
diff --git a/unit/test-hfp.c b/unit/test-hfp.c
index 3973df5..fc9fb18 100644
--- a/unit/test-hfp.c
+++ b/unit/test-hfp.c
@@ -762,6 +762,7 @@ static void test_hf_robustness(gconstpointer data)
 	raw_pdu('\r', '\n', '+', 'C', 'O', 'P', 'S', ':', ' ', '0', ',', \
 		'0', ',', '\"', 'T', 'E', 'S', 'T', '\"', '\r', '\n'), \
 	frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
+	raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
 	raw_pdu('\r', '\n', 'O', 'K', '\r', '\n')
 
 static void hf_cmd_complete(enum hfp_result res, enum hfp_error cme_err,