[PATCH BlueZ v11 0/3] Add initial Channel Sounding support for

Naga Bhavani Akella
2026-04-21T11:31:57Z

This patch series introduces initial support for Bluetooth Channel
Sounding (CS) using the raw HCI interface.
This series lays the groundwork for CS support by adding commonly required
protocol definitions, configuration parsing, and event handling for
the reflector role.

The changes include:

1) Introduction of raw HCI support structures and callbacks for Channel
Sounding procedures and events. This provides the foundational data
definitions and HCI subevent handling needed by higher-level profiles

2) Addition of Channel Sounding configuration parsing from the BlueZ
configuration file.This patch also updates the systemd
service capability bounding set to include CAP_NET_RAW, which is
required for bluetoothd to receive and process LE Channel Sounding
events when running under a constrained systemd environment

3) Implementation of HCI LE Channel Sounding event handling in the
Ranging profile for the reflector role.
This includes opening a raw HCI channel,
parsing relevant CS LE events, routing them to the RAP profile

Patch overview:
1/3 shared: rap: introduce Channel Sounding HCI raw interface support
2/3 main.conf: add Channel Sounding config parsing support
3/3 profiles: ranging: add HCI LE Channel Sounding event handling

Changes in v11:
- src/main.c - Fixed cast spacing (`(int8_t) tmp`)

- profiles/ranging/rap.c - Moved HCI state machine from adapter-level to
per-device level,
fixed cast spacing

- profiles/ranging/rap_hci.c - Fixed enum/struct naming
(removed `_t` suffix, added `CS_STATE_` prefix),
replaced indirect callback dispatch with direct function calls,
fixed cast spacing,
added blank lines before `if` statements, and removed double blank lines

Changes in v10:
- src/main.c: fixed parse_config_signed_int to use
`long` instead of `size_t` for signed ranges

- src/shared/rap.h: Updated bt_rap_attach_hci signature to
take CS options as parameters,
added bt_rap_get/set_hci_sm functions

- src/shared/rap.c: Added per-instance HCI state machine storage
with getter/setter functions

- profiles/ranging/rap.c: Updated to pass CS options directly to
bt_rap_attach_hci,
added NULL check for HCI device creation

- profiles/ranging/rap_hci.c: Converted global state machine and
cs_opt to per-instance,
added role_enable field to preserve HCI command values
separately from parsing values,
fixed C99 for-loop declarations,
made state_names and cs_callback_map static const,
replaced malloc with malloc0,
fixed off-by-one error in subevent length validation,
removed dead bt_hci_unref call

Naga Bhavani Akella (3):
shared: rap: Introduce Channel Sounding HCI raw interface support
main.conf: Add Channel Sounding config parsing support
profiles: ranging: Add HCI LE Event Handling in Reflector role

Makefile.plugins | 3 +-
profiles/ranging/rap.c | 190 +++++-
profiles/ranging/rap_hci.c | 1259 ++++++++++++++++++++++++++++++++++++
src/bluetooth.service.in | 2 +-
src/btd.h | 7 +
src/main.c | 132 +++-
src/main.conf | 24 +
src/shared/hci.c | 62 +-
src/shared/hci.h | 3 +
src/shared/rap.c | 50 +-
src/shared/rap.h | 172 +++++
11 files changed, 1881 insertions(+), 23 deletions(-)
create mode 100644 profiles/ranging/rap_hci.c

--