Bluetooth fibers must have their stacks properly aligned.
Change-Id: Id46b376abb46400c563050b4c8393ab3983ff045
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
BLUETOOTH_UART and BLUETOOTH_DEBUG_UART defined twice.
Change-Id: I77f0e87a7f6132514696ef854c183037a540acba
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit add license headers to Kconfig files.
Change-Id: I79e60263b8c7b696463ecc84b8ad411af5415117
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
This commit organizes the bluetooth Ksymbols in:
- Driver symbols at drivers/bluetooth/Kconfig
- Stack symbols at net/bluetooth/Kconfig
Change-Id: I8ebadeb8ac7f8a769d7620e4e44077a05915dc86
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
This commit adds the Makefile and Kconfig files
to support the bluetooth driver in the Kbuild system.
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: I1f72b13aca8fb098eece04c4f0e1b680639b520f
The code was incorrectly using RX_STACK_SIZE instead of
CMD_RX_STACK_SIZE.
Change-Id: I4a8ddb700e2a701bf8572ed877865a7d0cb3b2d0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Some hci_core.c debug logs were still incorrectly using the old
bt_bdaddr_str API.
Change-Id: I92ce4544c44266216225b4d9a20e639a2fefa9d0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add a GATT debug config option to be able to limit the debug logs only
to the GATT submodule.
Change-Id: Ie486c9125070f32506547f981c704eaf3e9f2377
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Read attributes matching value and handle range generating a proper
response:
< ACL Data TX: Handle 3585 flags 0x00 dlen 9
ATT: Find By Type Value Response (0x07) len 4
Handle range: 0x0001-0x0005
Change-Id: I8001afa2b22e804bef3778d0509d17b01a8d597c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Read attributes matching UUID and handle range generating a proper
response:
< ACL Data TX: Handle 3585 flags 0x00 dlen 20
ATT: Read By Type Response (0x09) len 15
Attribute data length: 7
Attribute data list: 2 entries
Handle: 0x0002
Value: 020300002a
Handle: 0x0004
Value: 020500012a
Change-Id: Iaf4b0c963765a7769a17144a4d394dce8555c2d3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This replace the old code that could only compare 16 bits UUID with
bt_uuid_cmp which can expand to 128 bits if types don't match.
Change-Id: I84219d451d8c95baf6f7e42b92629cb106428ccf
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
bt_gatt_foreach_attr iterates over attributes via callback, it will be
used to implement discovery functionality.
Change-Id: Ice66f4b3d0d12b3616986931d5da0fe0f202e533
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
bt_uuid_cmp compares 2 UUIDs returning if they match, if the types are
different it converts both to 128 bit format before performing the
comparison.
Change-Id: Iacf330cc0271a7e5429cbb2f405a7d9ef249a1a3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds initial API and definitions to create a database.
Change-Id: I69d5b3f5fd2f04cc309c2f76a84581673aa54e7b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This properly init the MTU to default upon new connection and properly
store the new value in case of Exchange MTU request.
Change-Id: I561f5b1756fd8833244cdd2a986e561c16fc8471
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
The overflow/underflow checks are something that we want to have
whenever debug is enabled in general (and not just for buffers
specifically).
Change-Id: Ib4edd366ae8ce1a80d33155ab1dc8d5a20477909
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
For LE Privacy support we'll need to be able to distinguish which
addresses are RPAs and which are Identity Addresses.
Change-Id: Ie244a4d53ffddc435edbd6d69d7ecca205202f18
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
We use addresses in lots of places and with LE we always need to pass
around the type in addition to the address value. Defining dedicated
types for addresses makes the code much simpler.
Change-Id: Ie8b495dce50e3f084685909c19acc5d08e2cca10
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
When debug is enabled the cmd_rx fiber seems to cause exceptions some
times. Increasing its stack size seems to help.
Change-Id: I8152645f5904758b771ffe73b1112c77c8bfe924
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Now that bt_hci_send_cmd_sync() is safe to be called from the rx fiber
(used for all HCI events besides Command Complete/Status) we can move
the le_rand() usage to the key distribution stage instead of the
workaround of generating them prematurely.
Change-Id: I8bbc8dc78922a275a0c9982474d60b0693b29af2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Now that there's the split of Command Complete/Status events from all
other RX data we don't anymore need dedicated per-connection RX
fibers. Remove these fibers and their associated FIFO and use
bt_l2cap_recv() directly from bt_conn_recv().
Change-Id: Ib9740e76200cfa40d46ee234f9693dcb7e8387fd
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
These events are special since they release any blocking
bt_hci_cmd_send_sync() calls. In order to be able to use the send_sync
API from HCI Event handlers without deadlocking having the Command
Complete/Status events processed through a dedicated fiber is
essential.
Change-Id: Id5c597d618bf326a8efb7c9ca2500af60a502d77
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
To prepare for a dedicated Command Complete/Status processing fiber,
add 'tx' to the existing names to differentiate from the 'rx' in the
upcoming names.
Change-Id: I59e0ba34502e4a2341396f81bfb5829c296b35a5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Unknown buffers are likely a bug, but we should still put them back to
the buffer pool. Also, there's no reason to stop running the fiber.
Change-Id: I413f9ff115689da9b1487bc622a8d26693cfd6d0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The bt_hci_cmd_send_sync function will deadlock if called from within
the rx fiber. Add prevention for this when debug is enabled by
verifying that the calling context is not the rx fiber.
Change-Id: Ib94bd5c10185165d017fe0aeafbce46d503ad705
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add support for distributing our LTK to the remote side. Normally we
would generate the needed random bytes when the connection becomes
encrypted, however using bt_hci_cmd_send_sync() from a HCI event
handler (which the encryption_change is) is not possible and will
deadlock (because it needs to wait for a HCI command of its own to
complete). Instead, pre-generate the LTK as part of the SMP context
when we receive the SMP Random PDU from the remote.
Change-Id: Id9cc34b7ddfd1804626cf8bdc81c25aa8cc7943c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
We shouldn't send any unknown bits or bits that we do not support.
Change-Id: Ia1c1cfd1e70ca879fd070b5fbcceef3b66ba8237
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add more defines needed to do key distribution and using correct
values for the authentication requirement.
Change-Id: I674c143d26ee31e9473c50c181c2947a305025fd
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
We also need to store the EDiv & Rand values to be able to do correct
look-up of LTKs.
Change-Id: If6dbfc7569d18a4c8597a401deccad3ef8cb51ad
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
We'll soon need to generate other amounts of random bytes than 16.
Update the le_rand() helper to generate any amount of random bytes.
Change-Id: I9295e6e3d79b0577c7bced31604a0fa45f1a9424
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
UUID defines, etc, will be needed by multiple files including GATT.
Change-Id: I855d3934242f54a8b5bf31652a4f8b9dfb63ef06
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Now that we have the connected/disconnected callbacks available for
L2CAP channels we can use these to associate the bt_conn with a
respective protocol-specific context.
Change-Id: I7c4d9a54f73ae7029a73372a1b0c93d473b28881
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add callbacks to notify L2CAP channels of connections, disconnections
and changes in the encryption state.
Change-Id: I66f86f20f551f01459abdbec6ccd214992828470
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
We'll either way need various callbacks as well as get rid of the
channel-specific contexts in conn.h, so add a dynamic way of
registering fixed channels. The LE signaling channel is handled in the
same way as any other channel.
Change-Id: I5f8c1af3c8e3d107212becf507a5a6485838e081
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
There will be various scenarios where we need to know what the current
encryption mode for a connection is.
Change-Id: I9836ffe51bfb6ebfc09497c7c716bd13a4064305
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The handles do not need ACL data-like decoding and the handlers should
be no-op for any non-zero status.
Change-Id: I40006ef7e5d01e8841ae0bebeda87755b2a32938
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Now that the logging macros use printf we can use more appropriate
format specifiers for various values.
Change-Id: I01025133b6a075f3478957a60163a1574cd85df7
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>