- AVRCP SDP record updates for browsing channel
- L2CAP setup for AVCTP browsing channel, and add connect/disconnect
- Add SetBrowsedPlayer browsing command handling
Signed-off-by: Make Shi <make.shi@nxp.com>
- This patch refactors the AVCTP layer to support multiple L2CAP PSMs
- Introduced bt_avctp_server structure for dynamic L2CAP server
registration and new server register apis
- Added k_sem protected server list to support multiple AVCTP servers
Signed-off-by: Make Shi <make.shi@nxp.com>
Since the broadcast ID is generated at runtime, it is nice
to get it printed so that it can be shared.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Since the broadcast ID is generated at runtime, it is nice
to get it printed so that it can be shared.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When scanning, the broadcast_scan_recv now prints the broadcast ID
and the broadcast name (if found). Without this, it is not possible
to use the shell to scan for an unknown broadcast ID or broadcast
name.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Previously, the Kconfig option `NET_GPTP_CLOCK_ACCURACY_2_5MS` had a
incorrect description "1.5ms".
Signed-off-by: Jonas Spinner <jonas.spinner@burkert.com>
From avdtp spec, the get_all_capablities should be used if the avdtp
version is v1.3, otherwise the get_capabilities should be used.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
In bt_gatt_write_without_response_cb there is a check for
write != length. However since the call to bt_att_create_pdu
should ensure that this is possible, this should never happen.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Since there is a retry mechanism implement, this is not something
that the user needs to be warned about.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When an API function returns an appropriate error code,
LOG_DBG is better suited than LOG_WRN or LOG_ERR as the
caller can handle the return value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
For user-initiated requests like notifications, read and write
requests, there will be an error code, so there does not need to be
a generic LOG_ERR if these fail to be allocated.
However if the response or (indication) confirmation PDUs fail
to be allocated, these should still be logged as errors.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Use LOG_DBG rather than LOG_WRN, as that is an expected
scenario when using K_NO_WAIT (e.g. when sending
GATT notifications), and it is better for higher layers
to determine if this is indeed an error.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
`bt_att_recv`, which parses ATT PDUs, already contains code that
responds with `BT_ATT_ERR_NOT_SUPPORTED` if a given handler is not
implemented.
Therefore, `att_prepare_write_req` and `att_exec_write_req` handlers do
not need to explicitly return `BT_ATT_ERR_NOT_SUPPORTED` when
`CONFIG_BT_ATT_PREPARE_COUNT` is set to 0 and can be completely removed.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Adds a context pool that can be used when a number of threads may be
dynamically created to use with RTIO. While the pool has a small cost to
it, the cost of verifying a statically declared kobject likely makes it
worth avoiding dynamically allocating these with the typical
kobject_alloc method. Instead this arena style pool of objects can be
used where the kobject validation uses the gperf hash created at build
time.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
It was observed in a project that when an error transaction occurs,
printing the error message can delay resetting the SHI state machine and
initializing the output buffer, which may cause the subsequent
transaction to fail, especially during stress tests involving heavy host
command communication.
This commit changes some error log level from ERR to DBG to prevent the
condition above from happening.
Also change the default debug level for the SHI driver to LOG_LEVEL_ERR.
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
If the range of the service search attribute request is set and the
start of the range is not 0x0000, the response data of the request is
not valid. It is caused by the data element sequence has not be added
to response data. The client cannot parse the response data properly.
The root cause of this issue is that the total length of service
record will be added only when adding the first attribute of service
record.
Fix the issue by reset the `state.last_att` and `state.last_att_index`
if the index of current record is not same with `state.current_svc`.
And do not update `state.last_att`, `state.last_att_index`, and
`state.current_svc` in the function `select_attrs()`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In current implementation, the received buffer is incorrectly used for
other SDP discover requests.
Release the RX buffer when the SDP discovery is done. And allocate the
new RX buffer from the pool of the new SDP discovery request.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Updates the implementation of the osEventFlags APIs to use
Zephyr kernel events instead of polling.
Fixes#92899
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Closes#94549
Removed vestigial d and d_len variables from le_adv_update()
and replaced them with a single bt_ad wrapper. This simplifies
the function while maintaining identical functionality.
Signed-off-by: Ayman Elfayoumi <aelfayoumi2@gmail.com>
To generate the GATT Database Hash characteristic, the function
`db_hash_setup` is called. It allocates an entry for the AES key that will
be used in the CMAC calculation. Next, `db_hash_update` is called to feed
all GATT database entries into the hash. Finally, `db_hash_finish`
produces the resulting hash.
However, the AES key entry allocated in `db_hash_setup` was not being
destroyed after the hash generation completed. This caused a memory
leak, eventually leading to the error `PSA_ERROR_INSUFFICIENT_MEMORY`
(`-134`).
This commit fixes the issue by destroying the allocated AES key after
the GATT Database Hash calculation is complete, by calling
`psa_destroy_key` in `db_hash_finish`.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Fix assertion on BIG terminate sync and due to not receiving
terminate control procedure when there are no free buffers.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Switch the selects on `LORAWAN_FRAG_TRANSPORT` to `depends on`. `select`
should only be used for simple symbols without dependencies themselves.
Mixing `depends on X` and `select X` on different symbols is the primary
cause of Kconfig dependency loops.
Signed-off-by: Jordan Yates <jordan@embeint.com>
The loop condition is not the count of the actual tries since the
continue or breaks can occur on the loop and thus a failure count
can falsely match a loop count even when a query is outstanding.
This can be seen when a dual stack resolve is used for IPv4 and IPv6
that has two fds to be used and the interface has only gotten an
IPv6 address. The failures on the IPv4 will indicate a 1 and the break
on the tried attempt on the IPv6 will break the loop on a 1.
Signed-off-by: Charles Hardin <ckhardin@gmail.com>
Not all combinations of main mode and sub mode are valid, so to make it
harder to select incorrect parameters, the main mode and sub mode
enums are combined into one.
Now the user chooses any valid option in enum bt_conn_le_cs_mode.
Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
Modify the struct bt_bap_stream to have a direct reference to the
bt_iso_chan, rather than having a reference to the parent
bt_bap_iso.
This change will allow users to more easily and directly access
the bt_iso_chan, instead of getting the reference via
bt_bap_ep_get_info.
Additionally, this allows users to access the bt_iso_chan for
streams that are not codec configured, and thus not have a
bt_bap_ep reference.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Expose the IDs, handles and numbers of CIGs, BIGs, CISes and BISes
via the ISO info struct. This information may be needed by higher
layer (such as the Basic Audio Profile (BAP)) or used as indexes
for arrays in the application layer.
The location of the CIG_ID, CIS_ID, BIG_Handle and BIS_Number
are moved to the location struct inside of struct bt_conn_iso
instead of being stored directly in it.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify the bis_id in struct bt_conn_iso to be bis_number
and correctly initialize it for both the broadcaster and
the sync receiver.
The field is currently unused and the term bis_id does not
exist in the core spec. The BIS Index was renamed to BIS
Number in Core 6.1, and thus the Zephyr code base will
reflect that.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The interrupt-driven UART API is emulated via polling on native_sim,
which introduces additional overhead. Defaulting to poll mode improves
performance by avoiding this emulation cost.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Suppress many LOG_ERR() messages from LwM2M registry
that are not necessary runtime errors.
Libraries and applications should be able to do following
without causing LOG_ERR to be produced:
* Checking existence of object, resource or resource instance
using lwm2m_engine_get_res(), lwm2m_engine_get_res_inst()
or path_to_objs(). These are only exposed in internal header.
* Delete object instance or resource instance without checking
if it exits.
As there is no public API to check existence of some path,
application is much easier to write in a way that it directly
calls just lwm2m_get...(), lwm2m_set...(), lwm2m_delete...()
and trust the return code of -ENOENT.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
UDP multicast uploads did not produce zperf-compatible server stats,
so the client waited for and tried to decode a non-existent reply,
causing “Unexpected response flags” and misleading
“LAST PACKET NOT RECEIVED!!!” output.
This change treats multicast as client-only: after sending
the negative-id FIN it does not wait for or decode server stats,
Instead transmits the FIN a few times to help receivers detect test end.
The shell prints a clear “Statistics (client only)” summary for multicast
and suppresses the error when client stats are valid.
Unicast behavior is unchanged.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
bt_cap_initiator_started did not have a check for aborted like
all the other callbacks, which could cause the procedure to
continue even if it was aborted.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
With the dictionary feature enabled, the RTT backend would still print
the "messages dropped" message as a string instead of the binary format.
Fix that by calling the correct process function when dictionary mode
is enabled.
Signed-off-by: Tamás Kiss <tmik@demant.com>
On arm64, GCC feels free to use floating point registers for essentially
anything unless we build with -mgeneral-regs-only. After the FPU gets used
in an interrupt handler, interrupts are disabled as there's no place to
save the registers during a nested exception. As the C library may be built
separately without this flag, we cannot use any of its functions or risk
having nested exceptions fail.
Switch printk usage to k_str_out and stick to (mostly) Zephyr internal
functions to ensure nested interrupts work correctly.
Signed-off-by: Keith Packard <keithp@keithp.com>
A public API call that sends ACL data — for example, `bt_gatt_notify` —
can be invoked from a preemptive thread context. This API, in turn,
calls the `raise_data_ready` function, which adds an L2CAP channel to
the `l2cap_data_ready` list.
The atomic variable used to create a critical section around
`l2cap_data_ready` did not work, because a preemptive thread can be
pre-empted at any time. This means that regardless of the `atomic_set`
result, we cannot trust it — the thread could be preempted after the
call, and the atomic variable state could be changed (specifically by
the TX processor in this case). The same issue applies to
`bt_conn_data_ready`, which is called next.
When making an L2CAP channel ready for sending data, we need to use a
critical section when appending a channel to the `l2cap_data_ready`
list. The same applies to the `conn_ready` list.
Since cooperative threads can only be rescheduled explicitly, we must
ensure there are no rescheduling points when accessing either the
`l2cap_data_ready` or `conn_ready` lists.
For `l2cap_data_ready`, this occurs in `get_ready_chan`, which is called
from `l2cap_data_pull`, which in turn is called by the TX processor. For
`conn_ready`, it occurs in `get_conn_ready`, which is also called from
the TX processor. Both functions have no rescheduling points when
working with their respective lists, so they do not require a critical
section.
This change removes the atomic variables previously used to create a
critical section for both lists, as they were ineffective. Instead,
`k_sched_lock`/`k_sched_unlock` are used where code may be executed from
a preemptive thread context. The `sys_slist_find` function is used to
check whether a channel or connection is already in the corresponding
list.
Fixes#89705
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
In current implementation, the attribute of the registered SDP record
will not be included in responding packet if the attribute data length
is more than the MAX payload size(`MIN(SDP_MTU, sad->sdp->chan.tx.mtu)
- sizeof(struct bt_sdp_hdr)`). And it causes the failure of ssa or sa
discovery.
Improve the SDP server to support the case by extending the
continuation state length. A 4 bytes space is extended to store the
attribute offset.
In this way, the attribute can be transmitted in segments according
to the reaming space of the responding buffer.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>