All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olivier MARTIN <olivier@labapart.com>
To: linux-bluetooth@vger.kernel.org
Subject: btvirt with two virtual controllers: Cannot connect to GATT server
Date: Tue, 7 Apr 2020 00:45:03 +0200	[thread overview]
Message-ID: <638ce0f7-3075-c7d2-57c4-55392f8f5e0a@labapart.com> (raw)
In-Reply-To: <6cf0d3da-a7d0-c820-3343-3f3722bae9a4@labapart.com>

Hi all,

I am trying to test BLE connection between two virtual controllers 
(created with 'btvirt'). But when trying to connect to the GATT server 
running on the first virtual controller, I have the error 
"src/device.c:att_connect_cb() connect error: Transport endpoint is not 
connected (107)"


To test my test case, I am using the head of Bluez (2a7df9323e, Sunday 
5th April).

Here is the test case:

1. Start btvirt for BLE: sudo ./emulator/btvirt -L -U2 (you will need my 
patch to fix command line parsing I sent a couple of minutes ago)

2. Start bluetoothctl to initialize the Virtual Controller that would 
play the role of GATT Server:

    $ bluetoothctl
    [NEW] Controller DB:E3:2A:E8:90:C4 olivier-ThinkPad-T480 #2 [default]
    [NEW] Device E3:01:36:88:4C:DE TestAdvertisement
    [NEW] Controller E3:01:36:88:4C:DE olivier-ThinkPad-T480
    [NEW] Device DB:E3:2A:E8:90:C4 TestAdvertisement

    [bluetooth]# list
    Controller DB:E3:2A:E8:90:C4 olivier-ThinkPad-T480 #2 [default]
    Controller E3:01:36:88:4C:DE olivier-ThinkPad-T480

    [bluetooth]# power on
    Changing power on succeeded
    [CHG] Controller DB:E3:2A:E8:90:C4 Powered: yes

    [bluetooth]# discoverable on
    Changing discoverable on succeeded
    [CHG] Controller DB:E3:2A:E8:90:C4 Discoverable: yes

    [bluetooth]# advertise on
    [CHG] Controller DB:E3:2A:E8:90:C4 SupportedInstances: 0x04
    [CHG] Controller DB:E3:2A:E8:90:C4 ActiveInstances: 0x01
    Advertising object registered


3. Use './test/example-gatt-server' to simulate GATT server. I confirm 
the server is started on DB:E3:2A:E8:90:C4 (first virtual controller)

4. Return to bluetoothctl to switch to second virtual controller and 
connect to the first one

    [bluetooth]# select E3:01:36:88:4C:DE
    Controller E3:01:36:88:4C:DE olivier-ThinkPad-T480 [default]

    [bluetooth]# power on
    Changing power on succeeded
    [CHG] Controller E3:01:36:88:4C:DE Powered: yes

    [bluetooth]# scan on
    Discovery started
    [CHG] Controller E3:01:36:88:4C:DE Discovering: yes
    [NEW] Device DB:E3:2A:E8:90:C4
    [bluetooth]# scan off
    Discovery stopped
    [CHG] Controller E3:01:36:88:4C:DE Discovering: no

    [bluetooth]# connect DB:E3:2A:E8:90:C4
    Attempting to connect to DB:E3:2A:E8:90:C4
    Failed to connect: org.bluez.Error.Failed
    [CHG] Controller DB:E3:2A:E8:90:C4 Discoverable: no


And in the bluetoothd log:

    bluetoothd[15175]: src/adapter.c:start_discovery() sender :1.6483
    bluetoothd[15175]: src/adapter.c:update_discovery_filter()
    bluetoothd[15175]: src/adapter.c:discovery_filter_to_mgmt_cp()
    bluetoothd[15175]: src/adapter.c:trigger_start_discovery()
    bluetoothd[15175]: src/adapter.c:cancel_passive_scanning()
    bluetoothd[15175]: src/adapter.c:start_discovery_timeout()
    bluetoothd[15175]: src/adapter.c:start_discovery_timeout() adapter->current_discovery_filter == 0
    bluetoothd[15175]: src/adapter.c:start_discovery_complete() status 0x00
    bluetoothd[15175]: src/adapter.c:discovering_callback() hci0 type 6 discovering 1 method 0
    bluetoothd[15175]: src/adapter.c:device_found_callback() hci0 addr DB:E3:2A:E8:90:C4, rssi 0 flags 0x0000 eir_len 3
    bluetoothd[15175]: src/device.c:device_set_legacy() legacy 0
    bluetoothd[15175]: src/device.c:device_set_flags() flags 6
    bluetoothd[15175]: src/adapter.c:stop_discovery() sender :1.6483
    bluetoothd[15175]: src/adapter.c:stop_discovery_complete() status 0x00
    bluetoothd[15175]: src/adapter.c:trigger_passive_scanning()
    bluetoothd[15175]: src/adapter.c:discovery_remove() owner :1.6483
    bluetoothd[15175]: src/adapter.c:discovering_callback() hci0 type 6 discovering 0 method 0
    bluetoothd[15175]: src/device.c:device_connect_le() Connection attempt to: DB:E3:2A:E8:90:C4
    bluetoothd[15175]: src/device.c:att_connect_cb() connect error: Transport endpoint is not connected (107)


       reply	other threads:[~2020-04-06 23:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <6cf0d3da-a7d0-c820-3343-3f3722bae9a4@labapart.com>
2020-04-06 22:45 ` Olivier MARTIN [this message]
2020-04-07  0:26   ` btvirt with two virtual controllers: Cannot connect to GATT server Luiz Augusto von Dentz
2020-04-07  6:30     ` Olivier MARTIN
2020-04-08 21:40       ` Olivier MARTIN
2021-01-05  8:39 Barry Byford

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=638ce0f7-3075-c7d2-57c4-55392f8f5e0a@labapart.com \
    --to=olivier@labapart.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.