linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Townsend <mtownsend1973@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: Re: Operating central and peripheral roles concurrently
Date: Fri, 9 Nov 2018 17:55:19 +0000	[thread overview]
Message-ID: <CABatt_zHbVz+cbb6Vig820W5bdXd+Cd1Jjh02MdqnBiX0WQuEg@mail.gmail.com> (raw)
In-Reply-To: <CABatt_x1aNftgFVuDxrhyZVs4bGmOZFccjPKU_BpfbGmMWTazA@mail.gmail.com>

On Fri, Nov 9, 2018 at 4:32 PM Martin Townsend <mtownsend1973@gmail.com> wrote:
>
> Hi,
>
> I see someone has already asked this question not long ago but I am
> seeing the same problem.  I have an embedded platform running 4.9
> kernel and Bluez 5.50 and the bluetooth device is the BroadCom
> BCM4343W which supports bluetooth 4.1.
>
> I can run the btgatt-server and example-gatt-server fine and connect
> to it from my phone using nRF and read the relevant attributes.  This
> I believe is where my device is in the peripheral role.  If I close
> the GATT server down I can use gatttool to query the characteristics
> of another GATT server setup on my PC, I think this is then acting as
> central role.
>
> But if I can't do both at the same time, once the GATT server is
> running and I try and query the other GATT server, I get
> root@mach-cw-rnet-ppm-1717:~# gatttool -b 5D:3C:72:B5:23:BE -t random
> --characteristics
> connect error: Connection refused (111)
>
> I've noticed that if I start bluetoothctl whilst the GATT server is
> running it looks as if it has connected to my phone
>
> root@mach-cw-rnet-ppm-1717:~# bluetoothctl
> Agent registered
> [LG K8 (2017)]#
>
> Maybe this is expected but it does look like it has made a connection
> back to the phone and I'm wondering if this is stopping it from acting
> in the central role?
>
> Not really knowing much about the bluetooth stack I was wondering if
> anyone has any pointers on how to debug this or let me know if I'm
> doing something wrong?  I'm quite comfortable putting debug code into
> the kernel and/or bluez5 and recompiling to get more information if
> required.
>
> Any help would be greatly appreciated,
> Martin.

I turned on DEBUG for a few of the hci_.c files and here's the output
of the failed connect in case it helps

These occur on connect from gatttool:
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: 00:00:00:00:00:00 ->
7b:bd:e7:6a:8a:8d
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0 orig refcnt 9
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: requesting refresh of dst_addr
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0 dst 7b:bd:e7:6a:8a:8d
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0 orig refcnt 10
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: addr 7b:bd:e7:6a:8a:8d (type 1)
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: addr 7b:bd:e7:6a:8a:8d
(type 1) auto_connect 5
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hcon 97310400 orig refcnt 0
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0 hcon 97310400
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0 cmd_cnt 1 cmd queued 2
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0 type 1 len 10
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0 Event packet
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0 opcode 0x200b
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: opcode 0x200b status 0x00
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0 opcode 0x200b
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0 cmd_cnt 1 cmd queued 1
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0 type 1 len 5
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0 Event packet
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0 opcode 0x200c
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: opcode 0x200c status 0x00
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0 opcode 0x200c
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0
Nov 09 08:03:00 mach-cw-rnet-ppm-1717 kernel: hci0 Event packet


Then just before Error: connect error: Connection refused (111) many
seconds later:
Nov 09 08:03:41 mach-cw-rnet-ppm-1717 kernel: hcon 97310400 state BT_CONNECT
Nov 09 08:03:41 mach-cw-rnet-ppm-1717 kernel: hci0 hcon 97310400
Nov 09 08:03:41 mach-cw-rnet-ppm-1717 kernel: hci0 orig refcnt 10
Nov 09 08:03:41 mach-cw-rnet-ppm-1717 kernel: hci0 hcon 97310400
Nov 09 08:03:41 mach-cw-rnet-ppm-1717 kernel: addr 7b:bd:e7:6a:8a:8d (type 1)
Nov 09 08:03:41 mach-cw-rnet-ppm-1717 kernel: hcon 97310400
Nov 09 08:03:41 mach-cw-rnet-ppm-1717 kernel: hci0 hcon 97310400 chan 97421c80
Nov 09 08:03:41 mach-cw-rnet-ppm-1717 kernel: hci0 orig refcnt 11
Nov 09 08:03:41 mach-cw-rnet-ppm-1717 kernel: hci0 cmd_cnt 1 cmd queued 1
Nov 09 08:03:41 mach-cw-rnet-ppm-1717 kernel: hci0 type 1 len 5
Nov 09 08:03:41 mach-cw-rnet-ppm-1717 kernel: hci0 orig refcnt 10
Nov 09 08:03:41 mach-cw-rnet-ppm-1717 kernel: hci0
Nov 09 08:03:41 mach-cw-rnet-ppm-1717 kernel: hci0 Event packet
Nov 09 08:03:41 mach-cw-rnet-ppm-1717 kernel: hci0 opcode 0x200c
Nov 09 08:03:41 mach-cw-rnet-ppm-1717 kernel: opcode 0x200c status 0x00
Nov 09 08:03:41 mach-cw-rnet-ppm-1717 kernel: hci0 opcode 0x200c

Regards, Martin.

  reply	other threads:[~2018-11-09 17:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09 16:32 Operating central and peripheral roles concurrently Martin Townsend
2018-11-09 17:55 ` Martin Townsend [this message]
2018-11-10 18:03   ` Luiz Augusto von Dentz
2018-11-10 18:29     ` Martin Townsend
2018-11-12 13:52       ` Martin Townsend
2018-11-12 16:17         ` Martin Townsend
2018-11-13 10:47           ` Emil Lenngren
2018-11-13 11:21             ` Luiz Augusto von Dentz
2018-11-15 16:54               ` Martin Townsend
2018-11-15 17:10                 ` Martin Townsend
2019-03-05 10:54 Martin Townsend

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABatt_zHbVz+cbb6Vig820W5bdXd+Cd1Jjh02MdqnBiX0WQuEg@mail.gmail.com \
    --to=mtownsend1973@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).