Add Kconfig configuration to select Tx buffer size, this
value will be returned in the HCI LE Read Buffer Size
command response.
This configuration will allow lower Tx RAM usage when
larger PDU sizes are desired in Rx direction only.
Change-Id: I5106a448d78a0754c4b0f6fa61fd5dcacd87a67c
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Add Kconfig configuration and conditional compilation of
RSSI measurement during a connection.
Change-id: I5a2f23f76a7cbbd9569d53d31899a472bf39d3ee
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Add Kconfig configuration to conditionally enable Data
Length Update procedure support in the Controller.
This will save CPU time, flash and RAM, if this feature is
not desired.
Change-id: I4515c0c7cf9aeb333a289397ae3c9bac04a08e4e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Add additional conditional compilation of code not needed
when LE Ping is disabled in Kconfig.
Change-id: Idab40b1371488e06a6f2009fb553f7655b7b86f3
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Adds initial handling of SDP Service Search Attribute response PDU.
Currently attributes data are not collected. Main focus was done on
proper handling PDU continuation state to be able receive whole
requested SDP record(s) if found for given UUID.
< ACL Data TX: Handle 74 flags 0x00 dlen 24
Channel: 64 len 20 [PSM 1 mode 0] {chan 3}
SDP: Service Search Attribute Request (0x06) tid 1 len 15
Search pattern: [len 5]
Sequence (6) with 3 bytes [8 extra bits] len 5
UUID (3) with 2 bytes [0 extra bits] len 3
OBEX Object Push (0x1105)
Max record count: 65535
Attribute list: [len 7]
Sequence (6) with 5 bytes [8 extra bits] len 7
Unsigned Integer (1) with 4 bytes [0 extra bits] len 5
0x0000ffff
Continuation state: 0
> HCI Event: Number of Completed Packets (0x13) plen 5
Num handles: 1
Handle: 74
Count: 1
> ACL Data RX: Handle 74 flags 0x02 dlen 68
Channel: 64 len 64 [PSM 1 mode 0] {chan 3}
SDP: Service Search Attribute Response (0x07) tid 1 len 59
Attribute bytes: 48
Continuation state: 8
cd 91 5a 58 30 00 00 00 ..ZX0...
< HCI Command: Host Number of Completed Packets (0x03|0x0035) plen 5
Num handles: 1
Handle: 74
Count: 1
< ACL Data TX: Handle 74 flags 0x00 dlen 32
Channel: 64 len 28 [PSM 1 mode 0] {chan 3}
SDP: Service Search Attribute Request (0x06) tid 2 len 23
Search pattern: [len 5]
Sequence (6) with 3 bytes [8 extra bits] len 5
UUID (3) with 2 bytes [0 extra bits] len 3
OBEX Object Push (0x1105)
Max record count: 65535
Attribute list: [len 7]
Sequence (6) with 5 bytes [8 extra bits] len 7
Unsigned Integer (1) with 4 bytes [0 extra bits] len 5
0x0000ffff
Continuation state: 8
cd 91 5a 58 30 00 00 00 ..ZX0...
> HCI Event: Number of Completed Packets (0x13) plen 5
Num handles: 1
Handle: 74
Count: 1
> ACL Data RX: Handle 74 flags 0x02 dlen 68
Channel: 64 len 64 [PSM 1 mode 0] {chan 3}
SDP: Service Search Attribute Response (0x07) tid 2 len 59
Attribute bytes: 48
Continuation state: 8
cd 91 5a 58 60 00 00 00 ..ZX`...
< HCI Command: Host Number of Completed Packets (0x03|0x0035) plen 5
Num handles: 1
Handle: 74
Count: 1
< ACL Data TX: Handle 74 flags 0x00 dlen 32
Channel: 64 len 28 [PSM 1 mode 0] {chan 3}
SDP: Service Search Attribute Request (0x06) tid 3 len 23
Search pattern: [len 5]
Sequence (6) with 3 bytes [8 extra bits] len 5
UUID (3) with 2 bytes [0 extra bits] len 3
OBEX Object Push (0x1105)
Max record count: 65535
Attribute list: [len 7]
Sequence (6) with 5 bytes [8 extra bits] len 7
Unsigned Integer (1) with 4 bytes [0 extra bits] len 5
0x0000ffff
Continuation state: 8
cd 91 5a 58 60 00 00 00 ..ZX`...
> HCI Event: Number of Completed Packets (0x13) plen 5
Num handles: 1
Handle: 74
Count: 1
> ACL Data RX: Handle 74 flags 0x02 dlen 19
Channel: 64 len 15 [PSM 1 mode 0] {chan 3}
SDP: Service Search Attribute Response (0x07) tid 3 len 10
Attribute bytes: 7
Continuation state: 0
Combined attribute bytes: 103
Attribute list: [len 99] {position 0}
Attribute: Service Record Handle (0x0000) [len 2]
0x00010001
Attribute: Service Class ID List (0x0001) [len 2]
UUID (3) with 2 bytes [0 extra bits] len 3
OBEX Object Push (0x1105)
Attribute: Protocol Descriptor List (0x0004) [len 2]
Sequence (6) with 3 bytes [8 extra bits] len 5
UUID (3) with 2 bytes [0 extra bits] len 3
L2CAP (0x0100)
Sequence (6) with 5 bytes [8 extra bits] len 7
UUID (3) with 2 bytes [0 extra bits] len 3
RFCOMM (0x0003)
Unsigned Integer (1) with 1 byte [0 extra bits] len 2
0x09
Sequence (6) with 3 bytes [8 extra bits] len 5
UUID (3) with 2 bytes [0 extra bits] len 3
OBEX (0x0008)
Attribute: Browse Group List (0x0005) [len 2]
UUID (3) with 2 bytes [0 extra bits] len 3
Public Browse Root (0x1002)
Attribute: Bluetooth Profile Descriptor List (0x0009) [len 2]
Sequence (6) with 6 bytes [8 extra bits] len 8
UUID (3) with 2 bytes [0 extra bits] len 3
OBEX Object Push (0x1105)
Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
0x0100
Attribute: Unknown (0x0100) [len 2]
OBEX Object Push [len 16]
Attribute: Unknown (0x0303) [len 2]
Unsigned Integer (1) with 1 byte [0 extra bits] len 2
0x01
Unsigned Integer (1) with 1 byte [0 extra bits] len 2
0x02
Unsigned Integer (1) with 1 byte [0 extra bits] len 2
0x03
Unsigned Integer (1) with 1 byte [0 extra bits] len 2
0x04
Unsigned Integer (1) with 1 byte [0 extra bits] len 2
0x05
Unsigned Integer (1) with 1 byte [0 extra bits] len 2
0x06
Unsigned Integer (1) with 1 byte [0 extra bits] len 2
0xff
Jira: ZEP-1112
Change-Id: Ie282782fba6ef06c6826b3e624f83c8f4c94ebbe
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
The following readings were obtained after running the peripheral and
central_hr apps in qemu combined with the controller (hci_uart) on nRF51
and nRF52:
Main Stack 380
Idle Stack: 68
ISR stack: 532
Controller RX Stack: 388
HCI TX Stack: 516
The numbers set in this change provide a safety margin from the ones
measured empirically.
Change-id: Ice7ad7f081502e0ea1accf856a7937c0bf0783b2
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
reserve parameter of bt_l2cap_create_pdu() is incorrectly passed
as timeout.
Change-Id: Ieed293f52c2e98f16f1e43c498140178703236db
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
For consistency with RX_STACK_SIZE and the rest of stack sizes, rename
to use the normal naming scheme.
Change-id: Ib8d484482466fa8d629e6329e07b927abdd6f598
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Add Kconfig configuration to conditionally enable LE Ping
feature in the Controller.
This will save CPU time, flash and RAM, if this feature is
not desired.
Change-id: I5fbbdbe8f45ac01c9b0d7b11e002a0d1db4d272e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
The data pointer and length was not updated before invoking the
write_rsp function therefore providing pointer to the handle.
Change-Id: I5c27ab7a793979dffb8f1f2c68def027c45f2376
Signed-off-by: Louis Caron <louis.caron@intel.com>
This should also have been net_buf_add_mem(). Otherwise the buffer
gets corrupted.
Change-Id: I4687584777f446d398182c3e8c2cde5946987da4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Move code that can be executed after radio tx/rx packet ptr
has been assigned in the radio h/w.
Change-id: I9c5a34ee6bb74c1265d7871bcdf93894e3e7b190
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Added code to profile radio ISR execution time and generate
an event, which can be used to populate a vendor HCI event.
This event and associated code is disabled, subsequent
patch will add kconfig to enable it.
Change-id: Ic3fa3e0f4e36829a22a25ffee039949eaae561a7
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Use BT_WARN instead of BT_ASSERT to display unknown rsp in
HCI layer.
Change-id: I63c792468d9c4768f69df73395ee026a03521704
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Peer controllers not supporting LE Ping feature will
respond with unknown response PDU, handle it internally in
the controller rather than exposing it to HCI layer.
Discovered that controller was passing the unknown rsp PDU
to HCI layer when LE Ping was send to Nexus 5.
Unknown response for slave feature request was forwarded to
HCI layer, during that implementation unknown rsp for LE
ping too was getting forwarded to HCI layer.
Change-id: I4396c482e5546d78239cf41d88728de996e48d7d
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
This call was supposed to be net_buf_add_mem().
Change-Id: I5e4a718474905c433533fd1c1d7e8e0b7ff35739
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This helps simplify code that was previously combining net_buf_add()
with memcpy().
Change-Id: If44cf9cd651aba5e544e36567869f147468663eb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Stops handle data if server responds with SDP Error PDU
Jira: ZEP-1112
Change-Id: Iaddb740f71fa86384753ab32956fc69b89faeea0
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Adds handler responsible for receiving SDP data on SDP client request.
For now simple validation are done on SDP response header data.
Jira: ZEP-1112
Change-Id: Ic6009030db34e26dfdbd57fa1b0a22f6e27b6a11
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
cid is uint16_t and L2CAP_BR_CID_DYN_END is 0xffff so doing
"cid < L2CAP_BR_CID_DYN_END" comparisong is always true resulting
in for loop not being terminated as expected. Check against cid
overflow instead. Code comment is also added for clarity.
Change-Id: I15d6d838ed8b731824e602d089d765614c96c6c1
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Resets SDP client session data on related L2CAP transport channel
disconnection state. Leave the channel itself reset to L2CAP layer.
Jira: ZEP-1112
Change-Id: I4d8a8f10908f5e599ba6506470b98508869cb21b
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Makes possible to append user UUID to context to be able later iterate
it on subsequent resolving process.
Jira: ZEP-1112
Change-Id: I193ff1cee199045c9686dc4ca200adf19db377e4
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Renames and refactors helper get_client_session to sdp_client_get_session
to follow existing naming convention and adds second helper creating
new SDP client session. Then simplifies using them the API implementation.
Jira: ZEP-1112
Change-Id: I6b919f521e6665a7117fa06208b3fa2ae5f77fda
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Peer sends Remote Port Negotiation command to set port
communication settings. Currently we accept all the settings
sent by remote.
If there is only one value byte in the request then current
port settings has to be returned for which we returns the
default settings defined in ETSI.
Note that RPN may be sent even before a dlc is opened.
> ACL Data RX: Handle 256 flags 0x02 dlen 18
Channel: 64 len 14 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
Address: 0x03 cr 1 dlci 0x00
Control: 0xef poll/final 0
Length: 10
FCS: 0x70
MCC Message type: Remote Port Negotiation Command CMD (0x24)
Length: 8
dlci 10
br 3 db 2 sb 0 p 0 pt 0 xi 0 xo 0
rtri 0 rtro 0 rtci 0 rtco 0 xon 17 xoff 19
pm 0x3f7f
< ACL Data TX: Handle 256 flags 0x00 dlen 18
Channel: 64 len 14 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
Address: 0x01 cr 0 dlci 0x00
Control: 0xef poll/final 0
Length: 10
FCS: 0xaa
MCC Message type: Remote Port Negotiation Command RSP (0x24)
Length: 8
dlci 10
br 3 db 2 sb 0 p 0 pt 0 xi 0 xo 0
rtri 0 rtro 0 rtci 0 rtco 0 xon 17 xoff 19
pm 0x3f7f
Change-Id: I73b7d8577e7e2bc3e436f4db86a91e12db440f1f
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
rfcomm_make_uih_msg() only needs session to get the role while creating
msg. This is mainly done since some commands like Test and RPN may come
even before dlc is created.
Change-Id: Ifd5a2ceaf17c20db3f00604cd2b4f1759155123e
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
l2cap_br_conn_req_reply expects valid bt_l2cap_chan pointer but this
is achieved only on accept() callback. Use l2cap_br_send_conn_rsp
instead for rejecting cases where no channel was accepted. This also
makes success path being 'primary' function path ie erros all always
handled inside if() statements.
Jira: ZEP-1405
Change-Id: I890b4fcf029afce65eba4f2ebae0b1094feb007f
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
Not all users are in an ISR context where we can't block, so give the
callers the freedom to choose if they want to block or not.
Jira: ZEP-1481
Change-Id: I19bd7e2df94c4eeb60886a17a78f872bd7bea887
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Adds validation check when 'sdp discovery' API is to be called
by client, to reuse existing connection if valid or initiate new one
if posssible to set SDP L2CAP link to remote.
Change-Id: I47ce33cb5e95cf2616f9b23712641b912ce40f37
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Added a Pending Request structure, this will keep
a track of the last sent AVDTP Singnalling Message.
This will be used to verify the response from the remote device
Memory will be allocated by the application.
Change-Id: Ic31df154b52ce9013e5039ab195a9651d1811a7a
Signed-off-by: Arun Jagadish <arun.jagadish@intel.com>
Adds for now stubs of handlers responsible for taking a connected and
disconnected state of SDP L2CAP channel.
Change-Id: I21b76b755168fb63f6cade5f6b0c0bab93d0a01f
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Adds basic functionality to be able to trigger establishing outgoing
L2CAP channel to remote using as PSM SDP channel. The number of such
outgoing connections is limited by configured pool of connections.
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Change-Id: Ie5428e5b1b5f5c57f473ee0adfd4621cd9fe6e3e
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This patch contains API's which is used to parse range of values
eg. (0,3). This patch also parses the string, reads, process and
move the buffer accordingly.
Change-Id: I8dba5b7d630f65b87967c101557c5c7ffd297dd1
Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
If more inquiry results were received during discovery than fits in
storage results with lowest RSSI will be skipped. This is to improve
API usefulness in busy environments where results with low RSSI (likely
more far away than high RSSI) could consume provided result space,
Change-Id: I1e9ca901b693f608d58575916809e8bd8bfe710f
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
at_get_number which converts the string into number now operates on
at_client to get the string buffer. This patch also improves API()
skip_whitespace to be operated on at_client. Also the the API's
get_cmd_value, get_response_string are updated to work with buf
increment.
Also in this patch the return type of the function str_has_prefix
is changed from 'int' to 'bool'.
Change-Id: Ia626e0d13212b84413cce0444349975f4abe1cf6
Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
The execution time of k_sem_give() increased slightly recently, and
since it was being called from the radio ISR this had an impact in the
deadlines not being met.
This change moves the actual call to k_sem_give() to a lower-priority
job and thus out of the ISR to avoid its execution time affecting the
ISR's timing.
Change-id: I76c82df895c6daaffef52786b0c900ee15acb0aa
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The ECC emulation synthesizes its own HCI events so we may need up to
two available priority buffers at any point in time.
Change-Id: I88b37c7e9e9f64483d80cde9243470a7f0477321
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
In preparation for the new Nordic MDK and nRF52840 IC support we switch
to using the SERIES config instead of the old "NRF52" macro that will be
deprecated in the new MDK.
JIRA: ZEP-1418
Change-Id: I563f025c9db9b7497116c5af23814d95c720f836
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
There are static initializer macros available for most kernel objects
which we should use whenever possible.
Change-Id: I496f4d05d26801eddd21fae53bdd4fcdc3246fe3
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This adds H7 function implementation and test based on sample data
from Core Specification 5.0 Vol 3. Part H. Appendix D.8.
Jira: ZEP-1431
Change-Id: I49d44ee7a352d1092f6379829d747c7e0ec5e83c
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Reduce the time limit for active clock startup and increase
the CPU usage time limit before hard real-time radio
transmit/receive.
Due to isr_wrapper overhead in ARM architectures, more time
was used before hard real-time radio transmission or
reception which was detected by controller implementation
and the controller aborted the radio transactions.
This commit permits more CPU utilization by the controller
before hard real-time radio transactions start.
Change-Id: Id976add80c70cabc753c43dfac6f6603588458d9
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
On CPUs like nRF51 which run at 16MHz, certain BLE control
procedure PDU processing take more CPU time than permitted
inside tIFS (150us). Current implementation of Data Length
Update procedure does not span over multiple connection
interval (unlike Encryption Setup, which is another control
procedure processing that would consume more CPU time)
hence taking more CPU time inside tIFS on nRF51.
During the radio ISR, the active clock and packet timer are
active and it is used to profile the CPU time taken which
is used to decide on whether there is sufficient time in
the current radio event to process the control packet.
This commit also fixes a potential bug that would cause
disconnection due to MIC failure on encrypted connections
that performed Data Length Update. Controller used to NACK
the request/response PDU if it was not in a state to resize
the receive buffers but did not reset the CCM counter. This
is now fixed by the change done to NACK control PDU based
on available CPU time in radio ISR.
Change-id: Id58322ad76a0dbc284738cdd9a7c0437c9e8c423
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
"next" is more relevant since its used to save next pointer
Change-Id: Ic0a8d543944681ba4291c5aa06125f565ab6115c
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
The function is not particularly small, and is used from several
places, so remove the inline declaration. This also prepares the way
for the possibility of having an application callback for letting the
application choose whether it's fine with the proposed parameters, and
thereby influence the response we send to the remote device.
Change-Id: I5848b179318b6fb6ee37fcbd479a919204f559f1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Now that all logging methods use printk as a backend the respective
Kconfig options should declare the right dependencies.
Change-Id: I65c759db0ec7ba6333b76d8d20aea0e374fd4947
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Since the user data size is now stored in the pool there's very little
value in storing it as well per-buffer.
Change-Id: I17a99123b232423c52a2179b4eccd813728d51b1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
In order to keep the initialization process light-weight, remove
net_buf_pool_init() and instead perform the initialization of the pool
and buffers in a "lazy" manner. This means storing more information
in the pool, and removing any 'const' members from net_buf. Since
there are no more const members in net_buf the buffer array can be
declared with __noinit, which further reduces initialization overhead.
Change-Id: Ia126af101c2727c130651b697dcba99d159a1c76
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This is only for use with custom destroy callbacks, so that the
application gets isolated away from the details of how exactly the
buffers are managed. This opens up the possibility of switching away
from k_fifo to potentially better solutions, such as k_lifo.
Change-Id: I0d8322fdec3500d8ae060ae471b9448aeaa4572a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Until now it has been necessary to separately define a k_fifo and
an array of buffers when creating net_buf pools. This has been a bit
of an inconvenience as well as blurred the line of what exactly
constitutes the "pool".
This patch removes the NET_BUF_POOL() macro and replaces it with a
NET_BUF_POOL_DEFINE() macro that internally expands into the buffer
array and new net_buf_pool struct with a given name:
NET_BUF_POOL_DEFINE(pool_name, ...);
Having a dedicated context struct for the pool has the added benefit
that we can start moving there net_buf members that have the same
value for all buffers from the same pool. The first such member that
gets moved is the destroy callback, thus shrinking net_buf by four
bytes. Another potential candidate is the user_data_size, however
right not that's left out since it would just leave 2 bytes of padding
in net_buf (i.e. not influence its size). Another common value is
buf->size, however that one is also used by net_buf_simple and can
therefore not be moved.
This patch also splits getting buffers from a FIFO and allocating a
new buffer from a pool into two separate APIs: net_buf_get and
net_buf_alloc, thus simplifying the APIs and their usage. There is no
separate 'reserve_head' parameter anymore when allocating, rather the
user is expected to call net_buf_reserve() afterwards if something
else than 0 headroom is desired.
Change-Id: Id91b1e5c2be2deb1274dde47f5edebfe29af383a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The Bluetooth thread stack sizes are optimized based on the assumption
that printk is used for logging and not printf. Using _prf() (the
printf backend) risks overflowing the stack, so use the recently
exposed _vprintk instead.
Change-Id: Ibcbe0af2994c83114d12aa27a8bc29c77bb8c4c8
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Now printk family from <misc/printk.h> already included should handle
BT_DBG() like expansion.
Change-Id: I5e03f786530e4bbbdb94a13a4cd77db580268c11
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Replace precision formatter (.) in printk with padding flag like %04x
since for now precision is not handled properly in printk family.
Change-Id: Ib63198e407ef584c5650d6452518b1767047630f
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
These should have been converted to using printk instead.
Change-Id: I62323704dad4fc51cc14ee4734acb6b325dcda14
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This will be used by the user to disconnect or cancel connect dlc.
This also defines an internal close function which will take
appropriate action based on the dlc state.
In case of user initiated disconnection if some pending packets are
there in queue then it has to be sent before sending DISC packet.
< ACL Data TX: Handle 256 flags 0x00 dlen 8
Channel: 64 len 4 [PSM 3 mode 0] {chan 0}
RFCOMM: Disconnect (DISC) (0x43)
Address: 0x2b cr 1 dlci 0x0a
Control: 0x53 poll/final 1
Length: 0
FCS: 0x6d
> ACL Data RX: Handle 256 flags 0x02 dlen 8
Channel: 64 len 4 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Ack (UA) (0x63)
Address: 0x29 cr 0 dlci 0x0a
Control: 0x73 poll/final 1
Length: 0
FCS: 0x26
Change-Id: Ie4fa3bd8f6b279fee6fb56ddce198d82c5047849
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
When PSM server doesn't have BR/EDR L2CAP resources to assign and handle
incoming request properly, local channel pointer may stay uninitialized.
This fixes such scenario. The fix refactors main connection request
reply handler to additional helper which can be used to send response
unconditionally for situation when local channel is not allocated
to setup L2CAP link between.
Jira: ZEP-1405
Change-Id: I5caedd63a59ad0d1704ac87fa51616a0770320bf
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Instead of %4.4x we need to use %04x which printk supports.
Change-Id: I0564be5531bb266b328f77231f5d00f43eabe1ed
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
If connection destination address has been changed update the addresses
stored by the time it disconnects since in case of RPA it is no longer
mapping to the same device after it has been disconnected.
Change-Id: I0ce966928f605a885125179eaa7b9093989825ab
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
The connection destination address may change if the identity address
is resolved.
Change-Id: Id6f7b6494c24ff118043ba5f4ff54e254376eddf
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
bt_conn_lookup shall work both with identity address or initial
destination address as bt_conn may change the destination address with
the identity address.
Change-Id: Ibdd19ec453c3307eb6db188196b7e57a2260b526
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
There's now snprintk available that's more light-weight on the stack
than snprintf.
Change-Id: I6b3e4409703ca92fe6b8f4146ff47c490ab826cb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Applications may want finer control of the NRPA used for
non-connectable beacons, and provide it up-front rather than letting
the stack generate one.
Change-Id: I84d459372cc85ed09a8f9cde16dbb9b98dec2a43
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Expose helpers in hci.h for setting and getting the LE random address
type.
Change-Id: I7c6437051f0b2d1f5f79e19b2616bb643ae6300b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Fix compilation issues that show up if SYS_LOG is mapped to printk
instead of printf. Unlike printf, printk is annotated so that the
compiler catches incorrect format specifiers passed to it.
Change-Id: I4d6f635a0ed61de698727028ea8767dc0ef28bb1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Instead of having custom logic for determining the minimum of two
values, use the existing min() helper from misc/util.h.
Change-Id: I9809883d4a31126329373f293897dd49eb91e9ad
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
rfcomm_dlc_drop() can be used from many places to unlink dlc
from session and destroy it. So it is better to send DM
explicitly from relevant places.
Change-Id: I9b6a31ce5bb65b90510aa483539d4a201ba12b60
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
When the Controller is configured to support less than 251
as the supported maximum data length, missing check caused
the Controller to incorrectly re-initialize its rx buffers
causing assert during the DLE procedure. This commit fixes
the procedure to correctly use the supported maximum length
if the peer requests a transmit length that exceeds the
supported receive length.
Change-id: I6ad7196e3db44b303ddf2ec06e0ae579bf2eb774
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This allows to fine tune TX stacks size depending on selected HCI
driver. If needed it can be used to tune for monitor too or other
logging mechanism used.
Change-Id: Ib501921da0b786e151083760d85ec58fe3c08b60
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
If debugs are disabled scid and dcid variables were never read.
This also fix mixed values of scid and dcid in le_disconn_req.
Change-Id: I3b435dd0640c5c65ab5fe68e33dd25e3c9e0026e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
subsys/bluetooth/host/hci_ecc.c: At top level:
subsys/bluetooth/host/hci_ecc.c:277:6: warning: no previous prototype
for 'bt_hci_ecc_init' [-Wmissing-prototypes]
void bt_hci_ecc_init(void)
^
CC subsys/bluetooth/host/conn.o
Change-Id: I920d8b6b66c82be932c579461310505c6d402c08
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Even one-line branches should have {}, and the last two return
statements can be simplified into a single one.
Change-Id: I0f65aeaba867240255eae8e1c461386700444ae6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
With k_sem API it is possible to specify maximum sempahore value
so we no longer need to track semaphore count.
Change-Id: I86744ba63bd3207051ca3466d4f81b816d24f5ad
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Applications expect service end handle as attribute value in userdata
on discovery response callback.
Jira: ZEP-1354
Change-Id: I664da4a7e054a531ad1c2c8cbc74367cb679ff03
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Security needs to be elevated based on dlc required sec_level
before creating dlc. If L2CAP connection is not created then
setting dlc required sec_level to chan would do the job.
Change-Id: I21debd3559c9ccfb79011160d676932bc2a54604
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
Correct the local LE supported features bitmap to actually "or"
together all the bits that correspond to the set of features that
are implemented at this time.
Change-Id: I0c62ec566c775514250fcf062aeef6c9656719e3
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
If the original buffer cannot be reused, either by no having enough
space for user data or if is fragmented, it can in fact be smaller than
both the segment buffer and MPS.
Change-Id: I59a537aff59c5d56b2883e9bd51f3a1a3932d348
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
The segments need to be limited by the minimun of the segment buffer
tailroom and tx MPS not the original buf length.
Change-Id: I580a3bb61aa190ac0cdd3717bc06fd6e6e668304
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Implement the 2 HCI commands that provide ECC public key
and shared secret generation:
- LE Read Local P-256 Public Key
- LE Generate DHKey
Jira: ZEP-1246
Change-Id: I79388bfdb9f2e28b9377b4bb6ee2caca25f33f3e
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Handle the scenarios like ignoring a response in non existing dlc,
correctly handle if received a command with invalid mtu etc.
Change-Id: Ib0bce9134bac3a0dead03798f859af54873a70c1
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
k_sem_take return differ from nano_sem_take since it return 0 for
successful case instead of 1.
Change-Id: Ia39cd624d56dbc1c8e7f3558244bebf765da191d
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This is no longer needed after switch to unified kernel.
Change-Id: Ie1f8dadb3f2e43ae6ccfbfaf1f754196f3237471
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
After switch to unified kernel this is no longer needed.
Change-Id: If9877d3fa038dd873011fb780c7e767e150647ae
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This fixes defect found by coverity: 152027 Pointer to local outside
scope.
Change-Id: I50f196a04363ffa6e6654b71a9a1d89034580413
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Implement the 3 missing HCI commands required to support
Data Length Extensions:
- LE Read Suggested Default Data Length
- LE Write Suggested Default Data Length
- LE Read Maximum Data Length
Note: Only octets are actually used at this time, not time.
Jira: ZEP-1246
Change-Id: Id76d8fedb5ecaf0001c8429cf22f9a3e2c910a44
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Fix Coverity, sizeof not portable, defect; by explicitly
using sizeof(void *).
suspicious_sizeof:
Passing argument mem_head of type void ** and argument 4U
/* sizeof (mem_head) */ to function memcpy is suspicious.
In this case, sizeof (void **) is equal to sizeof
(void *), but this is not a portable assumption.
Change-id: I4b4776466e16020876500feba0141985b8581017
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
External interrupts are indexed from value 16, wherein
0 to 15 are ARM cortex M exceptions. Fixed code in
_irq_is_priority_equal to fetch correct external
interrupt line ISR priority.
Change-id: I9cfd411480e78dfc9635e72d14df9d667a9d8400
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Coverity analysis discovered NULL pointer being
dereferenced when passing a auto variable. The variable is
now correctly assigned with address of a valid default
value variable. As per design, the dereferencing will not
happen as the master role does not use the passed parameter
only slave role uses it to prepare the connection parameter
request PDU.
Change-id: I3f8519b23a83cb8c50c7fba81810eff7737ff74a
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Coverity analysis discovered that observer filter policy
field was 1 bit, whereas valid range for extended scanner
filter policy feature implemented in controller is 0 to 3.
Increase the bit field size from 1 to 2.
Change-Id: Id4b2e354961dfb3b45f72fa4e0ab18de7425bbb5
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
This fix using incorrect address type for passive scanning with
privacy enabled. Controller was not reporting directed advertising
to RPA address due to public type being used for passive scan.
This was affecting TC_CONN_GCEP_BV_01_C, TC_CONN_ACEP_BV_01_C and
TC_CONN_DCEP_BV_01_C qualification test cases.
Jira: ZEP-1200
Change-Id: Icc316441fcac1a72d75f9ade27a99030efc846b9
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This might create confusions when debugging as usually the prefix is
associated with the file or layer.
Change-Id: Ibf45578c1f54a4bec896acd6042589c815216e1f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
BR/EDR code should have minimal impact on LE code so to keep it simple
just require peripheral and central to be enabled when selecting BR/EDR
support.
Fix following Kconfig warning:
warning: (NETWORKING_WITH_BT && BLUETOOTH_BREDR) selects
BLUETOOTH_L2CAP_DYNAMIC_CHANNEL which has unmet direct dependencies
(BLUETOOTH && BLUETOOTH_HCI && BLUETOOTH_HCI_HOST && BLUETOOTH_CONN
&& BLUETOOTH_SMP)
Change-Id: I7f7cb8794def0df6daaa4abfe4596df460f1a2b2
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Fix following warning:
CC subsys/bluetooth/host/monitor.o
In file included from zephyr/include/drivers/loapic.h:58:0,
from zephyr/include/drivers/ioapic.h:22,
from zephyr/include/drivers/sysapic.h:20,
from zephyr/include/arch/x86/irq_controller.h:33,
from zephyr/include/arch/x86/arch.h:28,
from zephyr/include/arch/cpu.h:23,
from zephyr/include/kernel.h:2458,
from zephyr/include/zephyr.h:20,
from zephyr/subsys/bluetooth/host/monitor.c:24:
zephyr/subsys/bluetooth/host/monitor.c: In function
'_deprecation_check_sys_init_bt_monitor_init0':
zephyr/include/device.h:130:16: warning: '_INIT_LEVEL_PRIMARY' is
deprecated [-Wdeprecated-declarations]
static struct device_config _CONCAT(__config_, dev_name) __used \
^
zephyr/include/device.h:245:2: note: in expansion of macro
'DEVICE_AND_API_INIT'
DEVICE_AND_API_INIT(dev_name, drv_name, init_fn, data, cfg_info, \
^
zephyr/include/init.h:69:2: note: in expansion of macro 'DEVICE_INIT'
DEVICE_INIT(_SYS_NAME(init_fn), "", init_fn, NULL, NULL, level, prio)
^
zephyr/subsys/bluetooth/host/monitor.c:193:1: note: in expansion of
macro 'SYS_INIT'
SYS_INIT(bt_monitor_init, PRIMARY, MONITOR_INIT_PRIORITY);
^
zephyr/include/device.h:48:31: note: declared here
static __deprecated const int _INIT_LEVEL_PRIMARY = 1;
Change-Id: Ie903e3a075f6614b26018be5769be3651f0963be
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Added implementation for HCI Reset Command. Implementation
gracefully disables any running advertiser, observer, and/
or connection roles, and it resets controller context members.
The HCI Reset Command is implemented in such a way that
driver instances shared with other sub-systems and
application is not disturbed and instance/references used
by Bluetooth Controller are gracefully returned back.
Jira: ZEP-1282
Change-id: Ifb9ae6807736b5ec2d9f346cf2a590322056bcee
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This fixes issue that L2CAP Connection Parameters Update Request was
not sent. There was check that used LE features of host controller
to determine if L2CAP procedure or LL shall be used. It was failing
with 4.2 controller. The check shall test if remote supports
LL Connection Parameters Request Procedure. If it's not supported,
then L2CAP Connection Parameters Update Procedure will be used.
Closes ZEP-1220
1/4 L2CAP TC_LE_CPU_BV_01_C PASS
2/4 GAP TC_CONN_CPUP_BV_01_C PASS
3/4 GAP TC_CONN_CPUP_BV_02_C PASS
4/4 GAP TC_CONN_CPUP_BV_03_C PASS
Change-Id: I61ad544d9568ca6306a845e05c1a2e28d1693ab4
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
Using the K_* macros makes it easier to read what exactly the various
timeouts are.
Change-Id: Ia405d3760b8e600af7e33a7221ef6ec717708973
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Switch left-over usage of TICKS_NONE and TICKS_UNLIMITED to the new
unified kernel counterparts K_NO_WAIT and K_FOREVER.
Change-Id: I2f2a16360e816f9f8791eb216deb3c70b8cc87df
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
During the initial integration of controller to Zephyr OS,
radio hardware access was abstracted out into hal/radio.c
file. Bug introduced in hal/radio.c has been fixed so that
whitelist feature works again.
Change-id: Ie5faf80b1a008ef326613548a5a28a4ba52e7ef7
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
The conditional defaults must come last in order to be properly
processed.
Change-Id: Id7a152ca1a1584935029e212d0dd8f37494d1cf4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add implementation in HCI and Controller to support
HCI_LE_Remove_Device_From_White_List, as it is listed as
mandatory under BT Spec. v4.2, Part E, Section 3.19 LE
Controller Requirements.
Change-id: Icef88dffc85746f3cc7adb7fb692ae5578274ed2
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Rename left-over mentions in code comments of "fiber" to "thread".
Change-Id: I1af1baf99652434e90eb491c10238b94d26d341d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Switch from fiber_start() to k_thread_spawn() and from NANOKERNEL to
POST_KERNEL init level.
Change-Id: I34fb11cbe20216c8646ebacb07be304a67e3cd0a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Use k_thread_spawn() instead of the deprecated fiber_start() API.
Change-Id: I42e798ef3a4276863659c8d97c85224a652be1fd
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The bt_recv() function had protections for being called from a
preemptible task context, however nothing was protecting preemption by
ISR. A fairly simple fix is to protect the couple of critical regions
that can be reached from bt_recv() with the help of irq_lock().
Change-Id: Ifc29fd31205eb5425e1b7c862347d9420688df4e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Switch to using the unified kernel k_thread_spawn() API instead of
nano_fiber_start().
Change-Id: I325cf467ae2a52c6aec8fc166397c323929e3013
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Use the unified kernel API k_yield() instead of fiber_yield().
Change-Id: I8f52031f52f7ac8783033a51751dc22decdfa59a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Switch to using k_uptime_get() instead of the deprecated
sys_tick_get_32() API.
Change-Id: I737ef0153eff9d283bae840ff5177f8132396e1b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Use defines from k_fifo intead of legacy API.
Change-Id: Ib8cf0d88240ef145da550b8cf83d2580e7140521
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Those are lefovers from nano_delayed_work usage.
Change-Id: I3f17c7b89b1fa946495e160732457500e2f74f25
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This fixes warnings related to the use of nano_work and
nano_delayed_work in HCI layer.
Note that k_delayed_work takes a timeout in miliseconds rather than in
ticks thus the timeout values have been changed.
Change-Id: I953a82a6aa613bb1072a8ad4b01e0f94e5cd64bd
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This fixes warnings related to the use of nano_work and
nano_delayed_work in bt_conn layer.
Note that k_delayed_work takes a timeout in miliseconds rather than in
ticks thus the timeout values have been changed.
Change-Id: Ia8f34b475051515fd74000cce745ad226aa18aa5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This fixes warnings related to the use of nano_work and
nano_delayed_work in SMP layer.
Note that k_delayed_work takes a timeout in miliseconds rather than in
ticks thus the timeout values have been changed.
Change-Id: Ida58ff0f609dc2a8fd415692bc2cec91eb56a294
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This fixes warnings related to the use of nano_work and
nano_delayed_work in ATT layer.
Note that k_delayed_work takes a timeout in miliseconds rather than in
ticks thus the timeouts values changes.
Change-Id: I14d8438c1537febcb7768ef2934042ce38682739
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This fixes warnings related to the use of nano_work and
nano_delayed_work in L2CAP layer.
Note that k_delayed_work takes a timeout in miliseconds rather than in
ticks thus the timeouts values changes.
Change-Id: I1e3bd7857248865e34a313dd42862af5f4e3805b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Currently the ideal buffer counts for a controller-only build are 6 RX
buffers and 7 TX buffers: ATT_MTU of 158 bytes can be sent in one
connection interval of 6 tx/rx -es wherein connection interval is
7.5ms
Change-Id: I64b4620c5e8e7db8d7ed72fa1db82e266e121f27
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This patch introduces the Connect API which initiates session
connection first. If session is already there with the peer
then it has to reuse it and initiate DLC (which will be done
in the subsequent patch) since there can be only one session
per device.
< ACL Data TX: Handle 256 flags 0x00 dlen 8
Channel: 64 len 4 [PSM 3 mode 0] {chan 0}
RFCOMM: Set Async Balance Mode (SABM) (0x2f)
Address: 0x03 cr 1 dlci 0x00
Control: 0x3f poll/final 1
Length: 0
FCS: 0x1c
> ACL Data RX: Handle 256 flags 0x02 dlen 8
Channel: 64 len 4 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Ack (UA) (0x63)
Address: 0x03 cr 1 dlci 0x00
Control: 0x73 poll/final 1
Length: 0
FCS: 0xd7
Change-Id: I9828e0f3b3ea43bb17df95f0536e15df86f1b4be
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
In some SMP + GATT scenarios it's possible we get up to 6 incoming ACL
packets. To handle these efficiently, and more importantly, to not
have to drop data if the controller lacks host flow control (as is the
case currently with Zephyr-based controllers), increase the default
from 5 to 6.
For a controller-build it makes sense to just match up with the
controller-side configured RX buffers.
Change-Id: Id44fa724597b88a51f9085dac009e8d84a439bfc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
All boolean options default to 'n' without the need to explicitly
state this. It's only the cases where we want 'default y' where we
need to state this.
Change-Id: I47dbda62462ea437a2423b8508ea2cc640a22e41
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Restructure the Bluetooth options more logically.
- Both host and controller are now behind the same high level
CONFIG_BLUETOOTH.
- Selecting controller support disables other HCI driver selection, so
the controller isn't in the same list as HCI drivers any more.
- Under the top-level there's a "Custom stack" option, which when
enabled opens up the option of choosing CONFIG_NBLE.
There are various other cleanups and simplifications in this patch as
well, since splitting these up would have been fairly tricky while
making sure all test cases still build.
Change-Id: I5bb715cb9d20201cb8b72fbd149c8a09a4b2d7d2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This should be particularly useful with the recently added controller
assert functionality that causes vendor events with debug information.
Change-Id: Ied0df2ff414e08c11a73cca0afba4dc04b0b8625
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
When building Zephyr in the controller-only configuration,
assertions that happen in the Link Layer code are not visible
to the Host which is running on another HCI and connected via
UART or USB to it. This patch allows the Controller code
to output the assertion line number when in such a configuration,
allowing the Host to view the event to help debugging.
The event format used is temporary and will be replaced by a
standardized Vendor Specific specification to come at a later
time.
Change-Id: I013ca6783a3fdedc47b171132919dd4798c66285
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The right convention for help text is tab + 2 spaces.
Change-Id: I2722a8b33f5f74be110dc43fbcecc12841f0db84
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
When retrying the request due to a security error that can fail but since
the original buffer was freed in the process the code can no longer verify
if the opcode matches thus it always fails BT_ATT_ERR_UNLIKELY instead of
using the response error, so this not longer cares about the opcode and
just use the response error always.
JIRA: ZEP-1195
Change-Id: I1149b993b97733ab5bb00f347e4f973647e0fdd4
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This consolidate code around LE signalling header handling which has been
duplicated in many places.
Change-Id: I0c2cd48c155b751e1bbbd26070965d075cdc2cc5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
When a peer controller does not recognize one of the LL control
PDUs received, it will issue an LL_UNKNOWN_RSP PDU to let the
peer know that it does not recognize the request.
The controller now handles this incoming PDU and completes the
procedure by issuing the appropriate HCI event in the case of
an LL_FEATURE_REQ and _RSP pair.
Jira: ZEP-1220
Change-Id: I7c04a346441f04deee41198daa6309c11ae1b571
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
'private' is a C++ reserved word and will lead to compilation errors:
C++ ble.o
In file included from ble.cpp:7:0:
include/bluetooth/bluetooth.h:284:10: error: expected unqualified-id before 'private'
uint8_t private[4];
Change-Id: I36aef5a84af4fc66e1c810bd0c56e5ab5f803294
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
In function at_get_number check for the value if gets computed.
If not return error. Also change the end state handling.
Change-Id: I193b04fa2880dfb44e7727b30b67c1ec2e051cc7
Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
Add an implementation for the bt_storage_clear() API.
Jira: ZEP-181
Change-Id: Iae01c571c161317ea0cc44513d108301c7b5a069
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add basic implementation of an internal storage handler that uses the
local file system. The root directory for all Bluetooth related data
is /bt. Each remote device has its own subdirectory and each key its
own file. This helps keep the implementation very simple, but does
come with the meta-data overhead for each file.
As an example, the value of a key 0x0001 for a device with a static
random address cc:11:22:33:44:55 would be stored in the following
file: /bt/cc11223344551/0001. Local values such as the identity
address are stored directly under /bt with a file name that matches
the key the same way as remote-device files.
For full functionality the implementation requires a file system that
can support file/directory names of up to 13 characters in length. If
the file system supports less than that (as is the case with FAT12)
then only local values can be stored (in /bt/abcd). Local values
include the identity address as well as the local IRK.
Jira: ZEP-181
Change-Id: I7dc696af6353a154cb00dcd01a5f4ac3d7127e6b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This is not needed for Zephyr controller build and should already
be fixed in Mynewt.
Change-Id: I39e81dc3e9b5fd5a3f5f823465527248625caf26
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Patch 8c118f8673 causes the wrong semaphore
to checked so receiving credits are never restored which caused the
channel to get stuck after all the credits are consumed.
JIRA: ZEP-1199
Change-Id: I9cd5474b3bcaafcb19d15613939ce30d07befe0a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Remove hardcoded use of crystal as 32KHz clock source and
20 ppm accuracy; and use the values from config for sleep
clock source and sleep clock accuracy value in Bluetooth
Controller.
Change-id: I1c0d53ecf8ad158153d5186a6680b5eb03d1641b
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Making a reference to the common work queue code should not necessarily
drag in the system workqueue, since it is possible to use a workqueue
that is not the system workqueue. This is done by moving the system
workqueue into its own code module.
Moving the system workqueue to its own code module allows removing the
NANO_WORKQUEUE and SYSTEM_WORKQUEUE kconfig options, and compiling the
common workqueue code and system workqueue all the time. They are only
linked in the final image if a reference to them exist, same as the
other kernel modules.
Change-Id: I6f48d2542bda24f4702e7c2e317818dd082b3c11
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
Provide more detailed information about the controller address and
version upon init when debug is enabled.
Change-Id: I5fe9c7c91f95928cb3cc64b801137bb1466e4115
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
During implementation of alternate encryption procedure
usable in nRF51, commited in
c41d3edda8, re-encryption
procedure was broken. This commit fixes the issue, and
now re-encryption should work on both nRF51 and nRF52.
Change-id: Ia41200f42b1d46e1f3f35ff44b582d4ffcc5f4fa
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
So that application could check data pointer to see if any
data have been received and if read operation is complete.
Change-Id: I36c3ff81baefbc535374d937e5297938445eafa6
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
This makes use of the same code used by LE to print the state transitions.
Change-Id: I90a04f3c3f426fde1e0987acb572f7371c483c1c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds a common function to log state transitions including the caller
function and line in case something goes wrong:
[bt] [DBG] bt_l2cap_chan_disconnect: (0x0011b14c) chan 0x001199c0 scid 0x0040 dcid 0x0040
[bt] [DBG] bt_l2cap_chan_set_state_debug: (0x0011b14c) chan 0x001199c0 psm 0x0080 connect -> disconnect
[bt] [WRN] bt_l2cap_chan_set_state_debug: bt_l2cap_chan_disconnect()1562: invalid transition
Change-Id: I246a9004a04d93a38b8c7f7633705f6c191698b2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Channel state shall be updated properly otherwise it may cause unexpected
errors.
Change-Id: Ifd54d6bd3c5b44a40c315fd8a2946b30168aa65f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This defines and clarifies PF bit macro for both UIH and
non UIH packets.
Change-Id: Ide7736c0fc8607708824766adbfccf1bd7bc48e9
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
Security will be elevated based on the DLC required level
during connection.
Change-Id: I0b63885582f34a5689f7bc8081c1f9f011b2325f
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
Initialize the variable to zero before computing.
Change-Id: Iccdf77a085667728dbb68779f001c8d940a7a89d
Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
This is necessary in order to properly handle security errors which are
part of the testing specification thus can influence qualification.
Change-Id: If444e753be9196f3d5bb36cea00e332a33aa249f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This is to avoid code duplication while implementing outgoing
connection.
Change-Id: I52f882b7be9180f29def59c8ac3ef0a4798b719d
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
This is to avoid code duplication while implementing outgoing
connection.
This also moves setting initiator flag while allocating, than
doing it when SABM is received.
Change-Id: I8e811c995bf0eaa0bd24715e2e96d8a578a79c5d
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
This replaces initiator flag of session and dlc to enum which has
two values INITIATOR and ACCEPTOR.
Also this defines macros for CRs in header. Basically there are
three types fo CRs. Frame header CR has different meaning for
UIH and non UIH packets. Also this renames the existing msg hdr
CR to make it consistent.
These changes are basically done to make it more readable
Change-Id: Ic15e93465b0afbd19d8805f27d7a43f34ef38689
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
Move controller code from drivers/controller to
subsys/bluetooth/controller.
Change-Id: I73f675188485aa3267507bad7647796e593a3da0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Move the Bluetooth host stack from net/bluetooth to
subsys/bluetooth/host. This is preparation for having both host and
controller under the same root, i.e. subsys/bluetooth/.
Change-Id: I3bc796f7e331fca0c485f3890d62b9c03e027b96
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>