health: Fix use of L2CAP modes with bt_io
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 8 Jun 2020 16:25:28 +0000 (09:25 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 12 Apr 2021 09:00:49 +0000 (14:30 +0530)
bt_io modes are no longer compatible with L2CAP modes so the later
shall not used with bt_io APIs.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
profiles/health/hdp.c
profiles/health/mcap.c

index a6de97f4958a2b71735d8b3506c86c60a0b7cc1d..9fb77f760944df0f007bb7916fcbe70554c6f628 100755 (executable)
@@ -542,9 +542,9 @@ static void hdp_get_dcpsm_cb(uint16_t dcpsm, gpointer user_data, GError *err)
        }
 
        if (hdp_chann->config == HDP_RELIABLE_DC)
-               mode = L2CAP_MODE_ERTM;
+               mode = BT_IO_MODE_ERTM;
        else
-               mode = L2CAP_MODE_STREAMING;
+               mode = BT_IO_MODE_STREAMING;
 
        if (mcap_connect_mdl(hdp_chann->mdl, mode, dcpsm, hdp_conn->cb,
                                        hdp_tmp_dc_data_ref(hdp_conn),
@@ -913,11 +913,11 @@ static gboolean check_channel_conf(struct hdp_channel *chan)
 
        switch (chan->config) {
        case HDP_RELIABLE_DC:
-               if (mode != L2CAP_MODE_ERTM)
+               if (mode != BT_IO_MODE_ERTM)
                        return FALSE;
                break;
        case HDP_STREAMING_DC:
-               if (mode != L2CAP_MODE_STREAMING)
+               if (mode != BT_IO_MODE_STREAMING)
                        return FALSE;
                break;
        default:
@@ -1056,8 +1056,8 @@ static void hdp_mcap_mdl_aborted_cb(struct mcap_mdl *mdl, void *data)
 
 static uint8_t hdp2l2cap_mode(uint8_t hdp_mode)
 {
-       return hdp_mode == HDP_STREAMING_DC ? L2CAP_MODE_STREAMING :
-                                                               L2CAP_MODE_ERTM;
+       return hdp_mode == HDP_STREAMING_DC ? BT_IO_MODE_STREAMING :
+                                                               BT_IO_MODE_ERTM;
 }
 
 static uint8_t hdp_mcap_mdl_conn_req_cb(struct mcap_mcl *mcl, uint8_t mdepid,
@@ -1088,7 +1088,7 @@ static uint8_t hdp_mcap_mdl_conn_req_cb(struct mcap_mcl *mcl, uint8_t mdepid,
                }
 
                if (!mcap_set_data_chan_mode(dev->hdp_adapter->mi,
-                                               L2CAP_MODE_ERTM, &err)) {
+                                               BT_IO_MODE_ERTM, &err)) {
                        error("Error: %s", err->message);
                        g_error_free(err);
                        return MCAP_MDL_BUSY;
index b8522c2ab3b33faf4ae71a07c417b45fe7330e0b..677980a467f070f444c0bf5d286e8e7fd8d1b843 100755 (executable)
@@ -1739,7 +1739,7 @@ gboolean mcap_connect_mdl(struct mcap_mdl *mdl, uint8_t mode,
                return FALSE;
        }
 
-       if ((mode != L2CAP_MODE_ERTM) && (mode != L2CAP_MODE_STREAMING)) {
+       if ((mode != BT_IO_MODE_ERTM) && (mode != BT_IO_MODE_STREAMING)) {
                g_set_error(err, MCAP_ERROR, MCAP_ERROR_INVALID_ARGS,
                                                "Invalid MDL configuration");
                return FALSE;
@@ -1931,7 +1931,7 @@ gboolean mcap_create_mcl(struct mcap_instance *mi,
                                BT_IO_OPT_PSM, ccpsm,
                                BT_IO_OPT_MTU, MCAP_CC_MTU,
                                BT_IO_OPT_SEC_LEVEL, mi->sec,
-                               BT_IO_OPT_MODE, L2CAP_MODE_ERTM,
+                               BT_IO_OPT_MODE, BT_IO_MODE_ERTM,
                                BT_IO_OPT_INVALID);
        if (!mcl->cc) {
                mcl->ctrl &= ~MCAP_CTRL_CONN;
@@ -2109,7 +2109,7 @@ struct mcap_instance *mcap_create_instance(const bdaddr_t *src,
                                BT_IO_OPT_PSM, ccpsm,
                                BT_IO_OPT_MTU, MCAP_CC_MTU,
                                BT_IO_OPT_SEC_LEVEL, sec,
-                               BT_IO_OPT_MODE, L2CAP_MODE_ERTM,
+                               BT_IO_OPT_MODE, BT_IO_MODE_ERTM,
                                BT_IO_OPT_INVALID);
        if (!mi->ccio) {
                error("%s", (*gerr)->message);