Skip to content

Commit a652410

Browse files
LundinJohannvlsianpu
authored andcommitted
[nrf fromtree] Bluetooth: Adds preprocessor to L2CAP tester app
Adds preprocessor ifdefs to reconfigure() in L2CAP tester application depending on the KConfig option CONFIG_BT_L2CAP_ECRED Fixes issue #40456 Signed-off-by: Johan Lundin <[email protected]> (cherry picked from commit 403fbfc)
1 parent c13b3fe commit a652410

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/bluetooth/tester/src/l2cap.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ static void disconnected_cb(struct bt_l2cap_chan *l2cap_chan)
139139
CONTROLLER_INDEX, (uint8_t *) &ev, sizeof(ev));
140140
}
141141

142+
#if defined(CONFIG_BT_L2CAP_ECRED)
142143
static void reconfigured_cb(struct bt_l2cap_chan *l2cap_chan)
143144
{
144145
struct l2cap_reconfigured_ev ev;
@@ -155,13 +156,16 @@ static void reconfigured_cb(struct bt_l2cap_chan *l2cap_chan)
155156
tester_send(BTP_SERVICE_ID_L2CAP, L2CAP_EV_RECONFIGURED,
156157
CONTROLLER_INDEX, (uint8_t *)&ev, sizeof(ev));
157158
}
159+
#endif
158160

159161
static const struct bt_l2cap_chan_ops l2cap_ops = {
160162
.alloc_buf = alloc_buf_cb,
161163
.recv = recv_cb,
162164
.connected = connected_cb,
163165
.disconnected = disconnected_cb,
166+
#if defined(CONFIG_BT_L2CAP_ECRED)
164167
.reconfigured = reconfigured_cb,
168+
#endif
165169
};
166170

167171
static struct channel *get_free_channel()
@@ -282,6 +286,7 @@ static void disconnect(uint8_t *data, uint16_t len)
282286
status);
283287
}
284288

289+
#if defined(CONFIG_BT_L2CAP_ECRED)
285290
static void reconfigure(uint8_t *data, uint16_t len)
286291
{
287292
const struct l2cap_reconfigure_cmd *cmd = (void *)data;
@@ -331,6 +336,7 @@ static void reconfigure(uint8_t *data, uint16_t len)
331336
tester_rsp(BTP_SERVICE_ID_L2CAP, L2CAP_RECONFIGURE, CONTROLLER_INDEX,
332337
status);
333338
}
339+
#endif
334340

335341
#if defined(CONFIG_BT_EATT)
336342
void disconnect_eatt_chans(uint8_t *data, uint16_t len)
@@ -541,7 +547,9 @@ static void supported_commands(uint8_t *data, uint16_t len)
541547
tester_set_bit(cmds, L2CAP_DISCONNECT);
542548
tester_set_bit(cmds, L2CAP_LISTEN);
543549
tester_set_bit(cmds, L2CAP_SEND_DATA);
550+
#if defined(CONFIG_BT_L2CAP_ECRED)
544551
tester_set_bit(cmds, L2CAP_RECONFIGURE);
552+
#endif
545553
tester_set_bit(cmds, L2CAP_CREDITS);
546554
#if defined(CONFIG_BT_EATT)
547555
tester_set_bit(cmds, L2CAP_DISCONNECT_EATT_CHANS);
@@ -569,9 +577,11 @@ void tester_handle_l2cap(uint8_t opcode, uint8_t index, uint8_t *data,
569577
case L2CAP_LISTEN:
570578
listen(data, len);
571579
return;
580+
#if defined(CONFIG_BT_L2CAP_ECRED)
572581
case L2CAP_RECONFIGURE:
573582
reconfigure(data, len);
574583
return;
584+
#endif
575585
case L2CAP_CREDITS:
576586
credits(data, len);
577587
return;

0 commit comments

Comments
 (0)