Commit graph

10,429 commits

Author SHA1 Message Date
Emil Gydesen
257e1eb2e3 Bluetooth: VCP: REND: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:42:24 -06:00
Emil Gydesen
c5061b76ab Bluetooth: VCP: CTLR: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:42:07 -06:00
Emil Gydesen
c6562e70d7 Bluetooth: TMAP: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:41:49 -06:00
Emil Gydesen
8c29bb0b62 Bluetooth: TBS: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:41:28 -06:00
Emil Gydesen
50d57b2cee Bluetooth: TBS: Client: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:41:06 -06:00
Emil Gydesen
8d63fa7eea Bluetooth: PBP: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:40:43 -06:00
Emil Gydesen
ef0726fbc0 Bluetooth: PACS: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:40:21 -06:00
Emil Gydesen
833e3cbbae Bluetooth: MICP: MIC: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:40:03 -06:00
Emil Gydesen
a0eeb3400a Bluetooth: MICP: CTLR: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:39:21 -06:00
Emil Gydesen
4766ca1576 Bluetooth: MCC: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:38:56 -06:00
Emil Gydesen
66a7da33f7 Bluetooth: HAS: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:38:38 -06:00
Emil Gydesen
b1d8341b07 Bluetooth: HAS: Client: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:38:08 -06:00
Emil Gydesen
29cd613a7b Bluetooth: GMAP: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:37:44 -06:00
Emil Gydesen
48ec3217df Bluetooth: CSIP: Member: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:37:14 -06:00
Emil Gydesen
38301cd1b0 Bluetooth: CSIP: Coordinator: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:36:46 -06:00
Emil Gydesen
b0a78bb87c Bluetooth: Audio: Codec: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:36:20 -06:00
Emil Gydesen
03868cc875 Bluetooth: CCP: Server: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:35:35 -06:00
Emil Gydesen
9a80dd1bfc Bluetooth: CCP: Client: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:34:54 -06:00
Emil Gydesen
52b6138b03 Bluetooth: CAP: Stream: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:33:51 -06:00
Emil Gydesen
55e671781d Bluetooth: CAP: Initiator: Fix bad return values in param checks
Some parameter check return paths returned -EINVAL for
a boolean function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:32:35 -06:00
Emil Gydesen
527d969786 Bluetooth: CAP: Initiator: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:32:35 -06:00
Emil Gydesen
05440203c1 Bluetooth: CAP: Commander: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:31:41 -06:00
Emil Gydesen
cb6bd5b023 Bluetooth: CAP: Commander: Remove invalid check
start_param->subgroups is an array, so it is always
non-NULL.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:31:41 -06:00
Emil Gydesen
7f5c9892f1 Bluetooth: CAP: Acceptor: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:31:03 -06:00
Emil Gydesen
f4ae52137e Bluetooth: BAP: US: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:29:24 -06:00
Emil Gydesen
33a1b4fa62 Bluetooth: BAP: UC: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:29:01 -06:00
Emil Gydesen
449b63ec3e Bluetooth: BAP: Stream: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:28:38 -06:00
Emil Gydesen
0ee0fb838f Bluetooth: BAP: SD: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:28:13 -06:00
Emil Gydesen
b2c19b3ae5 Bluetooth: BAP: Broadcast Source: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:27:53 -06:00
Emil Gydesen
13e00454ff Bluetooth: BAP: Broadcast Sink: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:27:27 -06:00
Emil Gydesen
7005ee0054 Bluetooth: BAP: BA: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:27:04 -06:00
Emil Gydesen
0dc8f915f3 Bluetooth: BAP: BASE: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:26:33 -06:00
Emil Gydesen
4a30f7f27c Bluetooth: ASCS: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:26:12 -06:00
Emil Gydesen
654a2a2105 Bluetooth: Audio: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:25:39 -06:00
Emil Gydesen
9778c5bcc9 Bluetooth: AICS: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:25:23 -06:00
Emil Gydesen
a65c3fb171 Bluetooth: BAP: SD: Refactor use of mutex
This commit does the following 2 changes:
1) The return value of k_mutex_lock has been modified to
be treated as a fatal error instead of a simple runtime error.
The reason for this is to avoid having to handle those cases,
and to treat those cases a fatal errors. The timeout for the
mutex should be long enough for any operation within the lock,
and if it isn't, then that should be treated as something that
needs to be fixed, as it is likely a bug. This is also the reason
why the timeout was kept, instead of using K_FOREVER.

2) Ensure that all log statements are done while the log isn't
locked.

The implementation should be reconsidered in terms of application
callbacks, as the current state, where we need to unlock and relock
the mutex so many times does not only risk resolving in cases where
wrong values are set, but is also not very readable nor performant.
Changes to the API will be done in a followup commit, as that requires
more significant changes.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 15:11:09 +01:00
Emil Gydesen
4230213f1f Bluetooth: CAP: Clear params before handover continues
When an unicast initiator procedure or a commander broadcast
procedure is completed and we have handover enabled, the
parameters used need to be cleared before continueing.
This is due to the fact that the parameters are only cleared
on completion, rather than at initialization, and that the
initiator and commander parameters are in a union.
Not clearing the parameters could set some values to an
unknown/unexpected start value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 15:10:38 +01:00
Emil Gydesen
5864564a46 Bluetooth: CCP: Add user_data to bt_ccp_call_control_client_cb
Add a user_data field to bt_ccp_call_control_client_cb. The
field is optional to enable via Kconfig. The field can be used
to provide additional context from the owner of the callback
structure, to the callbacks themselves.

This solves a memory use-after-free issue in the unit tests
where the values from the callback was accessed after they
were released, as the values were just stack allocated.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 10:51:43 +01:00
Emil Gydesen
e1ff7805de Bluetooth: VOCS: Client: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-06 11:17:19 +01:00
Mark Wang
9062679c55 bluetooth: shell: a2dp: use 'err' instead of 'ret' for error code
Rename variable 'ret' to 'err' in cmd_send_media() to align with
Zephyr coding conventions for error return values.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2026-02-05 13:01:02 +00:00
Kai Cheng
b1adf4afbc Bluetooth: Shell: add inquiry scan parameters command
Add shell command for testing BR/EDR inquiry scan parameters update.
Supports default parameter set and custom parameters via interval/
window/type arguments for inquiry scan configuration.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-02-05 10:26:46 +00:00
Kai Cheng
1a8c5875e3 Bluetooth: Classic: add inquiry scan parameters update
Implement BR/EDR inquiry scan parameters update functionality with
new API bt_br_inquiry_scan_update_param(). Adds support for setting
inquiry scan interval, window and type via HCI commands. Includes
default parameter set for standard inquiry scanning.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-02-05 10:26:46 +00:00
Kai Cheng
6af1073d1b Bluetooth: Shell: add page scan parameters command
Add shell command for testing BR/EDR page scan parameters update.
Supports predefined parameter sets (R0, R1, R2 variants) and custom
parameters via interval/window/type arguments.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-02-05 10:26:46 +00:00
Kai Cheng
8fe282374b Bluetooth: Classic: add page scan parameters update
Implement BR/EDR page scan parameters update functionality with new
API bt_br_page_scan_update_param(). Adds support for setting page scan
interval, window and type (standard/interlaced) via HCI commands.
Includes predefined parameter sets for different Bluetooth versions
and use cases.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-02-05 10:26:46 +00:00
Kai Cheng
3e065836c4 Bluetooth: Shell: add COD set/get support test shell
This commit implements Class of Device (COD) test shell
functionality for Classic Bluetooth, supporting both
setting and retrieving COD from the controller.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-02-05 10:26:46 +00:00
Kai Cheng
14158c9d02 Bluetooth: Classic: add COD set/get feature
This commit implements Class of Device (COD) functionality for
Classic Bluetooth, supporting both setting and retrieving COD
from the controller by bt_br_write_cod and bt_br_read_cod.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-02-05 10:26:46 +00:00
Benjamin Cabé
0aa07f14c7 Bluetooth: use proper essential type in bool variables assignments
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
assigned true/false values, not 1/0.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-02-05 10:20:22 +00:00
Benjamin Cabé
14b5485d57 Bluetooth: use proper essential type for boolean variables
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
initialized and used with proper essential type (true/false).

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-02-04 13:52:38 +01:00
Lyle Zhu
6e003239e5 Bluetooth: Host: GOEP: force 16-bit FCS for L2CAP ERTM
Set the FCS option to BT_L2CAP_BR_FCS_16BIT for enhanced retransmission
mode in both L2CAP accept and connect paths to work around an
interoperability issue with iPhone devices.

The issue occurs when connecting to iPhone for PBAP or MAP profiles,
where the iPhone expects the 'No FCS' option to be applied but does
not include the 'No FCS' option in its L2CAP_CONFIGURATION_REQ packet.
Forcing 16-bit FCS ensures proper configuration negotiation.

Changes include:
- Set rx.fcs to BT_L2CAP_BR_FCS_16BIT in goep_l2cap_accept()
- Set rx.fcs to BT_L2CAP_BR_FCS_16BIT in
  bt_goep_transport_l2cap_connect()

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-02-03 13:03:09 +01:00
Lyle Zhu
fe68ab16d5 Bluetooth: Classic: HFP AG: skip callback if AG is disconnected
Move state retrieval before error handling to ensure it's always
available for subsequent checks. Add a check to prevent executing
the callback when the AG connection is in a disconnected state.

This prevents potential use-after-free or invalid state access when
the callback is invoked after the AG has been disconnected, improving
the robustness of the notification work handler.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-02-03 09:39:51 +01:00