From a03e068b036fad290e61470d91d9fdcd9cb2d0e6 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 26 Apr 2017 13:00:13 +0300 Subject: [PATCH] Bluetooth: shell: Don't attempt to reuse channel If the channel is already in use don't attempt to connect it a second time. Change-Id: I87bdaeadbe866b59c1a7975002699d9ef7a90c61 Signed-off-by: Luiz Augusto von Dentz --- tests/bluetooth/shell/src/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/bluetooth/shell/src/main.c b/tests/bluetooth/shell/src/main.c index d1a8e9f961b..68dc2b26590 100644 --- a/tests/bluetooth/shell/src/main.c +++ b/tests/bluetooth/shell/src/main.c @@ -2130,6 +2130,11 @@ static int cmd_l2cap_connect(int argc, char *argv[]) return -EINVAL; } + if (l2cap_chan.chan.conn) { + printk("Channel already in use\n"); + return -EINVAL; + } + psm = strtoul(argv[1], NULL, 16); err = bt_l2cap_chan_connect(default_conn, &l2cap_chan.chan, psm);