Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v1 10/27] doc: Add btvirt documentation
Date: Thu, 22 Oct 2026 11:46:43 -0400	[thread overview]
Message-ID: <20261022154701.3959500-11-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20261022154701.3959500-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Document the btvirt options, the ways it exposes the emulated
controllers and which of them share the emulated air interface.

Assisted-by: Claude:claude-opus-5-5
---
 Makefile.am    |   1 +
 doc/btvirt.rst | 153 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 154 insertions(+)
 create mode 100644 doc/btvirt.rst

diff --git a/Makefile.am b/Makefile.am
index f742458d113e..26884a54ea06 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -494,6 +494,7 @@ EXTRA_DIST += SECURITY.md
 EXTRA_DIST += doc/assigned-numbers.rst doc/supported-features.txt \
 				doc/test-coverage.txt \
 				doc/test-runner.rst \
+				doc/btvirt.rst \
 				doc/test-functional.rst \
 				doc/functional-testing.rst \
 				doc/functional-a2dp.rst \
diff --git a/doc/btvirt.rst b/doc/btvirt.rst
new file mode 100644
index 000000000000..2e016406a4fc
--- /dev/null
+++ b/doc/btvirt.rst
@@ -0,0 +1,153 @@
+======
+btvirt
+======
+
+-----------------------------
+Bluetooth controller emulator
+-----------------------------
+
+:Version: BlueZ
+:Copyright: Free use of this software is granted under the terms of the GNU
+            Lesser General Public Licenses (LGPL).
+:Date: October 2026
+:Manual section: 1
+:Manual group: Linux System Administration
+
+SYNOPSIS
+========
+
+**btvirt** [*OPTIONS*]
+
+DESCRIPTION
+===========
+
+**btvirt(1)** emulates Bluetooth controllers in software. It is used to test
+the kernel Bluetooth subsystem and BlueZ without real hardware, most notably
+by **test-runner(1)** and **test-functional(1)**.
+
+The controllers are implemented by the BlueZ emulator (``emulator/btdev.c``)
+and speak HCI. They can be exposed to a Bluetooth stack in several ways:
+
+- as local virtual controllers through ``/dev/vhci`` (**-l**), which then
+  appear as ``hciN`` on the machine running btvirt;
+- as H:4 streams on Unix socket servers (**-s**) or a TCP server (**-t**),
+  one controller per client connection;
+- as an H:4 stream on a pseudo terminal (**-S**).
+
+All controllers created by one btvirt process share an emulated air
+interface: they can discover, connect to and exchange data with each other,
+regardless of how each one is exposed. Controllers in different btvirt
+processes cannot see each other, except for the test LE controllers created
+with **-U**, see below.
+
+btvirt runs until it receives **SIGINT** or **SIGTERM**.
+
+OPTIONS
+=======
+
+At least one of **-l**, **-s**, **-t**, **-S** or **-U** must be given.
+Optional arguments must be attached to the option, as in **-l2**,
+**-t45551** or **--server=/tmp/bt**.
+
+-l[num], --local[=num]      Create *num* local virtual controllers through
+                            ``/dev/vhci`` (default: 1). Requires access to
+                            ``/dev/vhci``. The controller type is selected
+                            with **-L**, **-B**, **-A** or **-C**.
+
+-s[path], --server[=path]   Create Unix socket servers in the directory
+                            *path* (default: ``/tmp``). Each client that
+                            connects gets a new controller of the server's
+                            type, attached as an H:4 stream. The following
+                            sockets are created:
+
+                            ``bt-server-bredrle``
+                                BR/EDR/LE controllers, of the version given
+                                with **-C**
+                            ``bt-server-bredr``
+                                BR/EDR-only controllers
+                            ``bt-server-le``
+                                LE-only controllers
+                            ``bt-server-amp``
+                                AMP controllers
+                            ``bt-server-mon``
+                                monitor socket, no controller is created
+
+-t[port], --tcp[=port]      Create a TCP server on *port* (default: 45550).
+                            Each client that connects gets a new BR/EDR/LE
+                            controller, of the version given with **-C**,
+                            attached as an H:4 stream. The server listens on
+                            127.0.0.1 only.
+
+-S, --serial                Create a pseudo terminal with a BR/EDR/LE
+                            controller attached as an H:4 stream. The path of
+                            the terminal is printed on startup; attach it
+                            with **btattach(1)**.
+
+-U[num], --letest[=num]     Create *num* test LE controllers (default: 1)
+                            through ``/dev/vhci``. Unlike the other
+                            controllers, these exchange radio traffic with
+                            test LE controllers in other btvirt processes,
+                            using UDP broadcasts on port 45023.
+
+-L, --le                    Make the controllers created with **-l** LE-only.
+
+-B, --bredr                 Make the controllers created with **-l**
+                            BR/EDR-only.
+
+-A, --amp                   Make the controllers created with **-l** AMP
+                            controllers.
+
+-C version, --core=version  Core Specification version of the BR/EDR/LE
+                            controllers created with **-l**, **-s** (on
+                            ``bt-server-bredrle``) and **-t**. Supported
+                            values are ``5.0``, ``5.2``, ``6.0`` and ``6.2``
+                            (default).
+
+-d, --debug                 Enable debug output for the **-l** and **-s**
+                            controllers.
+
+-v, --version               Show version.
+
+-h, --help                  Show help options.
+
+VENDOR COMMANDS
+===============
+
+Controllers created with **-l** answer two vendor commands, so the kernel
+treats them as supporting the corresponding extensions:
+
+- opcode ``0xfc10``: emulator-specific vendor command;
+- opcode ``0xfc1e``: Microsoft vendor extension (MSFT).
+
+EXAMPLES
+========
+
+Create two local controllers, which show up as ``hciN`` and can connect to
+each other::
+
+    $ sudo btvirt -l2
+
+Serve controllers to virtual machines, one per connecting VM, the way
+**test-functional(1)** does::
+
+    $ btvirt --server=/tmp/bt
+    $ test-runner -u/tmp/bt/bt-server-bredrle -k bzImage -- ...
+
+Emulate a Bluetooth 5.2 controller over TCP::
+
+    $ btvirt -C 5.2 -t
+
+RESOURCES
+=========
+
+http://www.bluez.org
+
+REPORTING BUGS
+==============
+
+linux-bluetooth@vger.kernel.org
+
+SEE ALSO
+========
+
+**test-runner(1)**, **test-functional(1)**, **btattach(1)**
-- 
2.56.0


  parent reply	other threads:[~2026-10-22 15:47 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 15:46 [PATCH BlueZ v1 00/27] Run the testers under User Mode Linux with time travel Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 01/27] tools/test-runner: Do not report filesystems already mounted Luiz Augusto von Dentz
2026-10-22 20:02   ` Run the testers under User Mode Linux with time travel bluez.test.bot
2026-10-22 15:46 ` [PATCH BlueZ v1 02/27] shared/tester: Time out teardown Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 03/27] mgmt-tester: Wait for LL Privacy setup to complete Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 04/27] iso-tester: Fix leaking socket watches Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 05/27] l2cap-tester: Fix race in LE Client - Close socket 2 Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 06/27] iso-tester: Fix busy waiting in PAST tests Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 07/27] doc: Enable IPv6 in tester.config Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 08/27] 6lowpan-tester: Find the interface of the controller Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 09/27] emulator: Remove -T option from btvirt Luiz Augusto von Dentz
2026-10-22 15:46 ` Luiz Augusto von Dentz [this message]
2026-10-22 15:46 ` [PATCH BlueZ v1 11/27] emulator: Add vhost-user backend Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 12/27] emulator: Add vhost-user virtio server to btvirt Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 13/27] emulator: Add time travel calendar " Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 14/27] emulator: Add virtio console and time travel client " Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 15/27] tools/test-runner: Add User Mode Linux support Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 16/27] doc: Add virtio documentation Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 17/27] shared/mainloop: Add idle callbacks Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 18/27] shared/timeout: Run timeouts of 0 once idle Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 19/27] shared/tester: Remove GLib dependency Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 20/27] emulator/hciemu: " Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 21/27] tools: Build testers that do not need GLib with the mainloop Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 22/27] shared/mainloop: Add deferred callbacks Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 23/27] tools: Add socket watches for testers without GLib Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 24/27] tools: Run sco-tester, rfcomm-tester and 6lowpan-tester on the mainloop Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 25/27] tools: Run l2cap-tester and iso-tester " Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 26/27] doc/virtio: Update measurements of the testers Luiz Augusto von Dentz
2026-10-22 15:47 ` [PATCH BlueZ v1 27/27] doc: Split tester.config for QEMU and User Mode Linux Luiz Augusto von Dentz
2026-10-29 18:40 ` [PATCH BlueZ v1 00/27] Run the testers under User Mode Linux with time travel patchwork-bot+bluetooth

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=20261022154701.3959500-11-luiz.dentz@gmail.com \
    --to=luiz.dentz@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