Commit graph

42249 commits

Author SHA1 Message Date
Johan Hedberg
6147fc6384 drivers/console: Ignore characters when runnning out of buffer space
To clean up the logic and prepare for more control character support,
change the behavior so that instead of treating end of buffer as a
forced line break simply stop incrementing the position variable until
getting a carriage return.

Change-Id: Ie3970cb779dac3c826a3d21cf0b9ae57a43eddb2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:03 -05:00
Johan Hedberg
1c35329dc0 drivers/console: Remove unnecessary check for line feed character
The terminal doesn't generate line feed ('\n') when pressing return,
rather only a carriage return, so we can simplify the condition for
handling end of line.

Change-Id: I3eef8c6af19c43ef98ccdd9a5e3662d280834425
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:03 -05:00
Allan Stephens
ed78a03da2 doc: Enhance information about microkernel mailboxes
Completely overhauls Kernel Primer section on mailboxes to fill in
a host of omissions, correct errors, and improve readability.

Change-Id: I7f27230f59a593f6b7f44f399363ba423156b43e
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:25:03 -05:00
Johan Hedberg
5355aa8a76 Bluetooth: samples/shell: Add support for custom prompt callback
Change-Id: Ib5d305b4e98d5bcf7c14172494f452c35149a8de
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:03 -05:00
Johan Hedberg
610186b48a Bluetooth: Fix HCI driver Kconfig references in samples
Now that the H:4 driver is the default it doesn't have to be
explicitly enabled anymore. The only exception is the "no default
driver" option that's needed by the test_bluetooth unit test.

Change-Id: Ie582d51202714e314b76ffa9659c7a232a18fc1a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:03 -05:00
Johan Hedberg
5305003b32 Bluetooth: Use h4_* prefix for H:4 driver internal symbols
Now that the HCI driver is called H:4 use the shorter driver-specific
prefix h4_* for its internal symbols.

Change-Id: Icdab1147e5ec31f84e0a3d810192ddd462f4dfdd
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:03 -05:00
Johan Hedberg
4bb1391c7d Bluetooth: Rename UART driver to H:4 driver
We'll in the future also have a three-wire UART (H:5) HCI driver, so
the current H:4 driver cannot have a generic name.

Change-Id: Id326ae63d6f4d273d0d0c6120143e2f8d62968d1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:03 -05:00
Johan Hedberg
966acc1980 Bluetooth: Don't default to continuous scanning with BT_LE_SCAN_ACTIVE
Change-Id: I76d7db24bb9459f1df1d1e9881accc970b60aaf8
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:03 -05:00
Johan Hedberg
c692c1672a Bluetooth: Fix passing bool instead of NULL pointer
Change-Id: I230c7b450587d85ba96cd4c71653eff0d9d56dcc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:03 -05:00
Arkadiusz Lichwa
bf8179be9e Bluetooth: BR/EDR: Enforce BLUETOOTH_CONN be set
Whenever selects BR/EDR support in Kconfig, make BLUETOOTH_CONN
option be set as well due to for BR/EDR devices fundamental behaviour
is interact with others by making ACL based connections.

Change-Id: Ieffd2fc6aa47278112be177e5a7e2021e50b0fa3
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:03 -05:00
Arkadiusz Lichwa
f0572cfb61 Bluetooth: BR/EDR: Update of hci_disconn_complete
As a cleanup of just made disconnection don't touch LE specific
actions.

Change-Id: I0c7c42f47ac8f6683380124df571fa2b2afbf526
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:03 -05:00
Arkadiusz Lichwa
853ab787e7 Bluetooth: BR/EDR: Initial connection complete handling
Enables getting by host connection complete event and handle
internal state of related to the event connection object.

Change-Id: Ie6252ff33cc2e1fff5a4ce746fda7c3a59bf8aab
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:03 -05:00
Arkadiusz Lichwa
7abddd2bdf Bluetooth: BR/EDR: Look up conn by BT address helper
Defines helper routine to look up conn pool object for existance
of instance matching requested bluetooth address.

Change-Id: I31e05afb2346c7dab14e7ba1bd2f4e1378876ae0
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:03 -05:00
Arkadiusz Lichwa
db57e259a7 Bluetooth: BR/EDR: Rename BT_CONN_TYPE_BREDR
To conform to API convention rename BT_CONN_TYPE_BREDR to BT_CONN_TYPE_BR.
Updates stack code so far uses it.

Change-Id: Ia759ef68bbdb232e3b0992740e0536d310e19010
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
ad425d4dae Bluetooth: Fix connection type check in bt_conn_lookup_state
Change-Id: I543b18ecaa714c1c15ed45b5bc911272dd13b49a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
d2f90fad61 Bluetooth: Fix missing conn type check in bt_conn_lookup_addr_le
Change-Id: Ib98b257daf0a64f441e8532f615bbf5c84ee887e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
719aab5ce3 Bluetooth: BR/EDR: Reject SCO connections until we support them
Change-Id: I73ae6d02a00d06ccfc382c86599df338f68cb6a5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Arkadiusz Lichwa
08c40b1034 Bluetooth: BR/EDR: Validate incoming conn request
Initilizes conn object and defines accept and reject response to
incoming connection request.

Change-Id: I8f50ce535a43f5d04f12951f5c855004910a81a5
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:02 -05:00
Arkadiusz Lichwa
1453613acc Bluetooth: BR/EDR: Enable handling incoming conn request
Upsizes event mask to accept incoming connection and
defines initial handler for incoming connection request.

Change-Id: I93490c0916761aba3d6bc7a6b7cb5dcb8153c9c7
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
76d3602e46 Bluetooth: samples/shell: Update advertising command to new API
Change-Id: I2cb1065547dc3d39f5b9c645a576f768aa9d903f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
de6e78e1f6 Bluetooth: samples/beacon: Use NRPA for advertising
Change-Id: I9c9c8ab5b18bdd0e035944718405cfec9a164c13
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
4087728345 Bluetooth: Provide API to advertise with local NRPA
Applications may want to protect the privacy (identity of the local
device). One way to do this is to generate a Non-resolvable Private
Address and use that when advertising.

Change-Id: Ib852b03c14af062f914aa99a14e50c2e52ac78c2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
2ab218a315 Bluetooth: Make bt_rand consume only one net_buf at a time
Calling bt_rand() while holding a HCI cmd net_buf will (at least right
now) allocate a second HCI cmd net_buf. The default HCI cmd net_buf
count is 2, so if the caller of le_set_nrpa() also does a similar
trick this would leave to a deadlock. Doing the bt_rand() call first
solves the issue.

Change-Id: I4d6e3f448930bb1fa0456c9603dce62146fb545e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
d13a338689 Bluetooth: Use NRPA for active scanning
There's no reason for us to go revealing our public address when doing
active scanning.

Change-Id: I27bed74bb377b8bba75843ea76acb8f0d58f70f7
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
e4e51e3051 Bluetooth: Move random number helper to hci_core.c
We'll need this e.g. for NRPA generation even when SMP isn't enabled.

Change-Id: I4bffca3a180fda8f6757e902f8e255ba497b0bf5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
d4a9bdebc9 Bluetooth: samples/shell: Clean up advertise command handler
Change-Id: I11ed196b69d340eab9d8e0e1dc1d2d959cc1043b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
40cb272e14 Bluetooth: Add validity checks for adv & scan parameters
Change-Id: I46900e740794f96b91d01bfb6dc3f808881224cf
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
784e391bef Bluetooth: Add define for Connectable low duty cycle directed advertising
Change-Id: Id17df93e086a16e12f2b12172fda8e351b07cdf3
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
47044cd677 Bluetooth: Add advertising interval to LE adv params API
Change-Id: Id61589ca723c822ea8eb84c67ac9ed57b00cc305
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
7fb1900511 Bluetooth: Fix typo in LE GAP timer definitions
Change-Id: I390043bf44bab2e99fd5d58f52691b50a7763818
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
9533fbcfe1 Bluetooth: Add latency & timeout to LE conn param API
Change-Id: Icd6122b9056dd686d70a2d213a18dcab34f5e80a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
1a32d5ed55 Bluetooth: Add support for specifying connection parameters
Applications may want fine-grained control of connection parameters.
The two APIs to provide this through are bt_le_set_auto_conn() as well
as bt_conn_create_le().

Change-Id: If5cddbbf017b868d768d18d2a09daf4af8aa00d8
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
da86c397f1 Bluetooth: Fix LE connection interval type
Change-Id: I0fd1d400414afdd5f75ea8cc5a360330ce16c54b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg
defd4aa4d5 Bluetooth: Update GAP timer definitions
Change-Id: I8376752e10d21289ebeef4e02a24759ec8352c67
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Szymon Janc
af2732202b Bluetooth: SMP: Use smp_error in bt_auth_passkey_entry
There is no need to lookup SMP context again from conn object if
SMP context is already found.

Change-Id: I47ed1da69dc3030021c16579f8039e376ba11320
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:02 -05:00
Szymon Janc
97fb4d2990 Bluetooth: SMP: Delay LE SC pairing until PublicKey is generated
If HCI based ECC is used we should delay sending local Public Key in
LE SC pairing until it is generated by controller.

Change-Id: Ic979fc8efa40a8089ac2b74cbcfac21bdca79bfe
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:02 -05:00
Szymon Janc
b2db881468 Bluetooth: SMP: Follow central-peripheral ifdefs rule
Use same ifdefs rule in all places in SMP code. This makes code
easier to read.

Change-Id: I6936ca6f7a0212fc1918ed18d247f3e6d73f0370
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:02 -05:00
Szymon Janc
52054bd8e3 Bluetooth: SMP: Refactor smp_public_key
SMP code is cutted by ifdefs for central and peripheral roles support.
To make code easier to understand we follow same rule for all code:

  if (conn->role == BT_HCI_ROLE_MASTER) {
    /* master specififc code */
    return;
  }

  /* slave specififc code */

This simple rule allows for covering all build options (only central,
only peripheral or both) in clean way.

Change-Id: I37e65e7444090860069bfa6e9adc5cae07f0c0b9
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:02 -05:00
Szymon Janc
57f54ccabe Bluetooth: SMP: Add helper for generating passkey in LE SC
This allow to reuse same code in follow-up patch.

Change-Id: Ie057943f72b0c3c77d44590b56dd5ff9aa53005f
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:01 -05:00
Szymon Janc
c8e5d429c2 Bluetooth: SMP: Add helper for DHKey generation
This makes code easier to read.

Change-Id: Id63589760530505bb0ea5ef667909260114fdf0d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg
70669756ff Bluetooth: Add convenience macros for defined GAP timers
Change-Id: I6315c7791249d07fa2df0682decc0049718b5a06
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg
6891b94357 Bluetooth: Add missing check for valid filter_dup value
Change-Id: I58375618d572ba5d412eaf18b73bf7d620964f6e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg
266721018d Bluetooth: Add proper defines for scan enable parameters
Change-Id: I2d915517986007356c14e805eaed60a0f4290109
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg
4956d5630e Bluetooth: samples/shell: Add "select" command
Add command for choosing the default connection.

Change-Id: Id100320f31cb0e99ab48b162b466f52f6273018a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg
2f76a721fd Bluetooth: samples/shell: Support disconnecting non-default device
Change-Id: If9d0c601e02b9bbf4b48bf6f2e06b45d2ab5bce2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg
160489a595 Bluetooth: samples/shell: Add "auto-conn" command
Change-Id: Id81b760efa74eb6cd802289f200231bd020fbe94
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg
37a4326aa1 Bluetooth: Fix stopping scanning when clearing auto-conn
Change-Id: I127fcc38d16c068f22fede1e1fe37e41477c2cb1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg
914b553382 Bluetooth: Fix setting CONNECT_SCAN state for connections.
The state of auto-connectable bt_conn objects needs to be set to
CONNECT_SCAN after init as well as whenever bt_le_set_auto_conn is
called.

Change-Id: Iad2ca32a00ee1b4259196dd20651d5bf94ba9f26
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg
fb576fee7f Bluetooth: Start background scanning if necessary in bt_init
If the app loaded the stack with some devices to auto-connect to we
should start the background scanning at the end of bt_init().

Change-Id: Ifd06b66b53639344bdca391eb0ed2d3643ee5a07
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg
e148a3fb12 Bluetooth: Fix bt_le_scan_update dependency on CONFIG_BLUETOOTH_CENTRAL
This function should depend on BLUETOOTH_CENTRAL and not on
BLUETOOTH_CONN. It should also at least be capable of disabling
scanning even if BLUETOOTH_CENTRAL is not set.

Change-Id: Ic6ccd7ddf07ac6529c64889257dc9f9dfb34b531
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00