From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v6 00/23] Add HoG functional tests and shared/hog
Date: Mon, 28 Sep 2026 16:00:06 -0400 [thread overview]
Message-ID: <20260928200031.1209311-1-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds functional tests for HID over GATT (HoG), with bluetoothctl
registering a HID Service acting as a keyboard, with and without
Shorter Connection Interval (SCI) support, using the new
client/scripts/hog-device*.bt scripts, and the HID host:
- checking HID Information, HID SCI Mode and HID SCI Information over
GATT with gatt.select-attribute/gatt.read
- receiving a few Input Reports notified by the HID device
- with SCI support, requesting SCI Fast mode with the HID Control
Point, as specified by HOGP.TS 4.6.1, followed by the connection
rate with mgmt.conn-subrate, and receiving the notification of HID
SCI Mode from the HID device confirming the mode has been changed
The tests are documented in doc/functional-hog.rst.
The input plugin is also moved away from GAttrib: the new src/shared/hog
implements HID over GATT on top of bt_gatt_client and gatt_db, as a
drop-in replacement of profiles/input/hog-lib, which is removed along
with the GAttrib based Battery, Device Information and Scan Parameters
implementations only used by it, these services being handled by their
own plugins. src/shared/hog uses a clone of the bt_gatt_client, so its
requests are tracked on their own, caches the static values in the
gatt_db so they are not read again when reconnecting, and creates the
uHID device once the client is idle. src/shared/hog supports HID SCI, requesting a mode with
the HID Control Point and enabling the notifications of HID SCI Mode.
With that GAttrib has no users left in bluetoothd, which now creates
the bt_att of the connection directly, so GAttrib is removed along with
the deprecated gatttool, its only other user, and then the attrib
directory, moving what bluetoothd still uses to src/shared/att and
src/device.
unit/test-hog is ported to src/shared/hog, with the test cases renamed
after HOGP.TS p13 and the missing ones for the Report Host added, except
HID ISO which is not supported, including the HID SCI test cases
HGWF/BV-08-C to BV-11-C.
To support this:
- bluetoothctl can now set descriptor values from scripts, prints the
MGMT Connection Subrate event, and no longer crashes when the auto
agent is canceled
- btvirt defaults to the latest BR/EDR+LE version (6.2), so Shorter
Connection Intervals are supported by the emulated controllers,
with the new -C/--core option to emulate older versions
- the tester can expect a PDU with no response, e.g. Write Command
- unit/test-uhid tests the replies to Get Report, including through
hidraw when run as root, which requires CONFIG_HIDRAW now added to
the tester kernel config
Also, with -n auto, the number of functional test workers is now
limited by the memory available instead of one per CPU, since running
out of memory with so many VM instances made tests fail at random, and
check-functional uses -n auto by default (override with
CHECK_FUNCTIONAL_JOBS).
v6:
- shared/hog: use a clone of the bt_gatt_client, freed when detaching,
instead of tracking each request, cache HID Information, Report
Reference, External Report Reference and HID SCI Information in the
gatt_db, read the Report Map along with the other characteristics
and create the uHID device once the client is idle
- Add "shared/gatt-client: Fix calling idle callbacks again while
notifying" and "shared/gatt-client: Add bt_gatt_client_is_idle"
- unit/test-hog: drop HGCF/BV-02-C, as notifications are no longer
disabled when detaching, the requests of the clone being cancelled
when freed
v5:
- Add "attrib: Remove directory", moving att_ecode2str to src/shared/att
as bt_att_ecode2str, and struct gatt_primary and gatt_parse_record to
src/device
v4:
- Fix a use-after-free in bluetoothd introduced by "shared/gatt-client:
Fix calling destroy after unregistering notify", when enabling
notifications with StartNotify fails, and hold a reference to the
client while calling destroy
- Drop "attrib: Fix unregistering notifications registered with
bt_gatt_client", as GAttrib is now removed
- client/gatt: fix use-after-free on invalid values set from scripts,
uninitialized bytes when parsing values with consecutive separators,
and reject negative values
- Add "client/agent: Fix crash on Cancel with no pending request",
reported by TestFunctional with v3
- Add src/shared/hog, replacing hog-lib in the input plugin, and port
unit/test-hog to it with HOGP.TS p13 test cases, including HID SCI
- Change the HID SCI mode with the HID Control Point in the functional
test, HID SCI Mode being Read and Notify only as specified
- Fix the size of the reply to Get Report with a Report ID in
shared/uhid, and add unit/test-uhid Get Report tests along with
CONFIG_HIDRAW in the tester kernel config
- Add "device: Use bt_att instead of GAttrib" and "attrib: Remove
GAttrib and gatttool"
- Honour PYTEST_XDIST_AUTO_NUM_WORKERS and the CPU affinity when
limiting the functional test workers
- Add Assisted-by tags
v3:
- Add "shared/gatt-client: Fix calling destroy after unregistering
notify", fixing the heap-use-after-free in report_notify_destroy
still reported by TestFunctional on the HoG tests with v2: once
unregistered, the destroy callback of the notification was still
called later if the write of the CCC disabling it was pending, after
HoG had freed its reports.
v2:
- Add "attrib: Fix unregistering notifications registered with
bt_gatt_client", fixing the heap-use-after-free in
report_notify_destroy reported by TestFunctional on the HoG tests:
g_attrib_unregister did not unregister the notifications registered
with bt_gatt_client, so their destroy callback was called after
HoG had freed its reports.
Luiz Augusto von Dentz (23):
shared/gatt-client: Fix calling destroy after unregistering notify
client/gatt: Fix setting descriptor value from scripts
client/mgmt: Print Connection Subrate event
emulator: Default to the latest BR/EDR+LE version
client/scripts: Add HoG device scripts
doc: Add functional-hog documentation
test: functional: add HoG tests
test: functional: limit the workers by the memory available
client/agent: Fix crash on Cancel with no pending request
shared/uhid: Fix size of Get Report reply with a Report ID
shared/uhid: Keep reading when an event is not available
shared/tester: Allow expecting a PDU with no response
shared/gatt-client: Fix calling idle callbacks again while notifying
shared/gatt-client: Add bt_gatt_client_is_idle
shared/hog: Add initial implementation
unit/test-hog: Use shared/hog
test: functional: change the HoG SCI mode with the HID Control Point
input/hog: Use shared/hog
doc: Add CONFIG_HIDRAW to the tester kernel config
unit/test-uhid: Add Get Report tests
device: Use bt_att instead of GAttrib
attrib: Remove GAttrib and gatttool
attrib: Remove directory
.gitignore | 2 -
Makefile.am | 33 +-
Makefile.plugins | 4 -
Makefile.tools | 12 -
attrib/att-database.h | 30 -
attrib/att.c | 1238 -------------------
attrib/att.h | 186 ---
attrib/gatt.c | 1249 -------------------
attrib/gatt.h | 109 --
attrib/gattrib.c | 473 -------
attrib/gattrib.h | 65 -
attrib/gatttool.c | 612 ----------
attrib/gatttool.h | 17 -
attrib/interactive.c | 1020 ----------------
attrib/utils.c | 110 --
client/agent.c | 10 +-
client/gatt.c | 39 +-
client/mgmt.c | 31 +
client/scripts/hog-device-sci.bt | 49 +
client/scripts/hog-device.bt | 38 +
doc/functional-hog.rst | 204 ++++
doc/functional-testing.rst | 1 +
doc/test-functional.rst | 29 +-
doc/test-runner.rst | 5 +
doc/tester.config | 1 +
emulator/main.c | 55 +-
emulator/server.c | 15 +-
emulator/server.h | 2 +
profiles/battery/bas.c | 327 -----
profiles/battery/bas.h | 19 -
profiles/battery/battery.c | 3 +-
profiles/deviceinfo/deviceinfo.c | 5 +-
profiles/deviceinfo/dis.c | 340 ------
profiles/deviceinfo/dis.h | 27 -
profiles/input/hog-lib.c | 1966 ------------------------------
profiles/input/hog-lib.h | 28 -
profiles/input/hog.c | 31 +-
profiles/midi/midi.c | 3 +-
profiles/ranging/rap.c | 2 -
profiles/scanparam/scan.c | 3 +-
profiles/scanparam/scpp.c | 342 ------
profiles/scanparam/scpp.h | 22 -
src/adapter.c | 4 +-
src/device.c | 122 +-
src/device.h | 14 +-
src/gatt-client.c | 7 +-
src/shared/att.c | 48 +
src/shared/att.h | 2 +
src/shared/gatt-client.c | 41 +-
src/shared/gatt-client.h | 1 +
src/shared/hog.c | 1563 ++++++++++++++++++++++++
src/shared/hog.h | 67 +
src/shared/tester.c | 19 +
src/shared/uhid.c | 7 +-
test/functional/conftest.py | 58 +
test/functional/test_hog.py | 269 ++++
unit/test-gattrib.c | 552 ---------
unit/test-hog.c | 1420 +++++++++++++++------
unit/test-uhid.c | 272 +++++
59 files changed, 4019 insertions(+), 9204 deletions(-)
delete mode 100644 attrib/att-database.h
delete mode 100644 attrib/att.c
delete mode 100644 attrib/att.h
delete mode 100644 attrib/gatt.c
delete mode 100644 attrib/gatt.h
delete mode 100644 attrib/gattrib.c
delete mode 100644 attrib/gattrib.h
delete mode 100644 attrib/gatttool.c
delete mode 100644 attrib/gatttool.h
delete mode 100644 attrib/interactive.c
delete mode 100644 attrib/utils.c
create mode 100644 client/scripts/hog-device-sci.bt
create mode 100644 client/scripts/hog-device.bt
create mode 100644 doc/functional-hog.rst
delete mode 100644 profiles/battery/bas.c
delete mode 100644 profiles/battery/bas.h
delete mode 100644 profiles/deviceinfo/dis.c
delete mode 100644 profiles/deviceinfo/dis.h
delete mode 100644 profiles/input/hog-lib.c
delete mode 100644 profiles/input/hog-lib.h
delete mode 100644 profiles/scanparam/scpp.c
delete mode 100644 profiles/scanparam/scpp.h
create mode 100644 src/shared/hog.c
create mode 100644 src/shared/hog.h
create mode 100644 test/functional/test_hog.py
delete mode 100644 unit/test-gattrib.c
--
2.55.0
next reply other threads:[~2026-09-28 20:00 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 20:00 Luiz Augusto von Dentz [this message]
2026-09-28 20:00 ` [PATCH BlueZ v6 01/23] shared/gatt-client: Fix calling destroy after unregistering notify Luiz Augusto von Dentz
2026-09-28 22:26 ` Add HoG functional tests and shared/hog bluez.test.bot
2026-09-28 20:00 ` [PATCH BlueZ v6 02/23] client/gatt: Fix setting descriptor value from scripts Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 03/23] client/mgmt: Print Connection Subrate event Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 04/23] emulator: Default to the latest BR/EDR+LE version Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 05/23] client/scripts: Add HoG device scripts Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 06/23] doc: Add functional-hog documentation Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 07/23] test: functional: add HoG tests Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 08/23] test: functional: limit the workers by the memory available Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 09/23] client/agent: Fix crash on Cancel with no pending request Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 10/23] shared/uhid: Fix size of Get Report reply with a Report ID Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 11/23] shared/uhid: Keep reading when an event is not available Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 12/23] shared/tester: Allow expecting a PDU with no response Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 13/23] shared/gatt-client: Fix calling idle callbacks again while notifying Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 14/23] shared/gatt-client: Add bt_gatt_client_is_idle Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 15/23] shared/hog: Add initial implementation Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 16/23] unit/test-hog: Use shared/hog Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 17/23] test: functional: change the HoG SCI mode with the HID Control Point Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 18/23] input/hog: Use shared/hog Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 19/23] doc: Add CONFIG_HIDRAW to the tester kernel config Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 20/23] unit/test-uhid: Add Get Report tests Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 21/23] device: Use bt_att instead of GAttrib Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 22/23] attrib: Remove GAttrib and gatttool Luiz Augusto von Dentz
2026-09-28 20:00 ` [PATCH BlueZ v6 23/23] attrib: Remove directory Luiz Augusto von Dentz
2026-09-29 20:50 ` [PATCH BlueZ v6 00/23] Add HoG functional tests and shared/hog 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=20260928200031.1209311-1-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