summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@codecoup.pl>2017-02-14 18:31:45 +0100
committerAnas Nashif <anas.nashif@intel.com>2017-02-28 07:07:51 -0500
commitc3c5ae1279cd9d1e94584759ecf57d486cfb877a (patch)
tree68f350672843f0a321451cd1ae0aade36e16c4f6
parent8c4d0a5ee1bf6329d02d42a4c01e8e780c202758 (diff)
Bluetooth: shell: Don't echo LE CoC data
Don't echo data from received callback as this can cause deadlock. Just dump incoming data instead. Change-Id: Iedbbafd0406ad46ba2c9d26fd8a70fff59de8143 Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
-rw-r--r--tests/bluetooth/shell/src/main.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/tests/bluetooth/shell/src/main.c b/tests/bluetooth/shell/src/main.c
index 807c6281b..84aac31aa 100644
--- a/tests/bluetooth/shell/src/main.c
+++ b/tests/bluetooth/shell/src/main.c
@@ -1915,16 +1915,38 @@ static int cmd_clear(int argc, char *argv[])
}
#if defined(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL)
-static void l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
+static void hexdump(const uint8_t *data, size_t len)
{
- int ret;
+ int n = 0;
+
+ while (len--) {
+ if (n % 16 == 0) {
+ printk("%08X ", n);
+ }
+
+ printk("%02X ", *data++);
+
+ n++;
+ if (n % 8 == 0) {
+ if (n % 16 == 0) {
+ printk("\n");
+ } else {
+ printk(" ");
+ }
+ }
+ }
+
+ if (n % 16) {
+ printk("\n");
+ }
+}
+static void l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
+{
printk("Incoming data channel %p len %u\n", chan, buf->len);
- /* loopback the data */
- ret = bt_l2cap_chan_send(chan, buf);
- if (ret < 0) {
- printk("Unable to send: %d\n", -ret);
+ if (buf->len) {
+ hexdump(buf->data, buf->len);
}
}