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

Naga Bhavani Akella
2026-04-16T04:20:26Z

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 v9:
- src/shared/hci.c: Remove unused functions bt_hci_get_index
and bt_hci_get_fd
- profiles/ranging/rap_hci.c: Remove unused function
cs_is_procedure_active

Changes in v8:
- profiles/ranging/rap_hci.c: Add static for cs_state_machine_init,
cs_set_state, cs_get_current_state,
cs_is_procedure_active, rap_send_hci_def_settings_command

Changes in v7:
- src/main.c: Add second const to bcs_options array,
updated group_table and check_options to use const char * const *
- Move endptr to start of the function parse_cs_role

- profiles/ranging/rap.c: Move hci_index declaration to
start of function for C90 compliance
-Replace inefficient loop (0x0001-0x0EFF)
with single bt_hci_get_conn_handle call in rap_accept

- src/shared/rap.h: Add forward declarations for
struct gatt_db and struct bt_gatt_client

- src/shared/hci.h: Add bt_hci_get_conn_handle, bt_hci_get_fd,
bt_hci_get_index declarations
-Remove bt_hci_get_conn_info declaration

- src/shared/hci.c: Implement bt_hci_get_conn_handle to find handle
by bdaddr using HCIGETCONNLIST,
Add helper functions bt_hci_get_fd and bt_hci_get_index
-Remove bt_hci_get_conn_info implementation

- profiles/ranging/rap_hci.c: Remove unnecessary fallback ioctl
debug code from resolve_handle_to_rap
- Add HCI_EVT macro to simplify subevent table entries,
- Add SIGN_EXTEND_TO_16 macro for bit manipulation,
refactored parse_i_q_sample to use util_iov_pull_le24 and sign-extend macro

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 | 52 ++
profiles/ranging/rap_hci.c | 1263 ++++++++++++++++++++++++++++++++++++
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 | 12 +
src/shared/rap.c | 50 +-
src/shared/rap.h | 176 +++++
11 files changed, 1761 insertions(+), 22 deletions(-)
create mode 100644 profiles/ranging/rap_hci.c

--