Some controllers are broken in that they may send a completed packets
event after a disconnection has already occurred and the handle is
invalid:
> HCI Event: Disconnect Complete (0x05) plen 4
Status: Success (0x00)
Handle: 64
Reason: Remote User Terminated Connection (0x13)
< HCI Command: LE Set Advert.. (0x08|0x000a) plen 1
Advertising: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4
LE Set Advertise Enable (0x08|0x000a) ncmd 1
Status: Success (0x00)
> HCI Event: Number of Completed Pa.. (0x13) plen 5
Num handles: 1
Handle: 64
Count: 1
Since the disconnection code already takes care of updating the
le_pkts_sem semaphore appropriately there is no need to do anything
for this kind of events (except log a warning of a misbehaving
controller).
Change-Id: I67b35aa50f7297d6bcdeeeab62f1f1d224b1a372
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This is in preparation for being able to compile out SMP support.
Change-Id: Idb3597dd16e457d19d592a9b7dce954b950b174e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Separate connection master role related parts in single block making
it simpler to split. This is a preparation for being able to compile
in only central or peripheral role support.
Change-Id: I27dc9b32048bf4e682149d5f1d5edbd994155e2b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
The HCI driver send() callback may fail and in such a case require
different handling on the core stack side. This patch introduces the
missing error handling to the places calling drv->send().
Change-Id: Ia0e4f05aedd88c268cf0da98b11924eb3c5c4c0b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The core specification says the following about the treatment of
unacknowledged packets when a disconnection occurs (page 773 in core
spec 4.2):
"When the Host receives a Disconnection Complete, Disconnection Physical
Link Complete or Disconnection Logical Link Complete event, the Host shall
assume that all unacknowledged HCI Data Packets that have been sent to the
Controller for the returned Handle have been flushed, and that the
corresponding data buffers have been freed. A Primary Controller does not
have to notify the Host about this in a Number Of Completed Packets event"
This patch adds tracking of unacknowledged packets on a per-connection
basis and makes sure the semaphore that counts controller buffers is
given back the appropriate amount when a disconnection occurs.
Change-Id: I2ff4d12ffa50d4dda5b3e8c75fc75b4c0927e609
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The send() callback of HCI drivers should be returning 0 on success
and a negative value on error. The uart_fifo_fill() function returns
the number of transmitted bytes so it can not be directly mapped to
the send() return value.
Change-Id: I59be478c1985f44a46f2a9613f61471423b0e63a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Separate connection related parts in single block making it
simpler to split. This is a preparation for being able to compile
out connection support.
Change-Id: I992e604cae848ed2dfe821a6971248e53ae23498
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This patch factors setting up controller to host data flow control
to separate function. This is a preparation for being able to compile
out connection support.
Change-Id: Ibcce0b740534331a6365c2370b7b637877d71560
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
All required includes should be placed in source file that includes
internal header.
Change-Id: I161e7ebe2e62377ea4cf03f759d48f5900103076
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Writes to GATT attribute that has no write permission set, should
return write not permitted (BT_ATT_ERR_WRITE_NOT_PERMITTED)
in check permission routine.
Change-Id: I95f0988e171294cd98b79d3e7b518383ac47567d
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Move parts of the API that are not usable for applications to
an internal header.
Change-Id: Idbcd3db8acda74375ea9deec2bf3d7eddc8a4ddb
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
If no attribute with given handle is found in database then invalid
handle error should be set and returned. If attribute is found then
pre-set invalid handle error will be cleared.
Change-Id: I4119877bb72693e18003399f9b6764666f801fe4
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
This makes menu cleaner and easier to follow what options
are Bluetooth specific. It is now similar to IP configuration.
Change-Id: Ic2f6002ab30093bed62e71fe268a576d69a9cd0d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Tinydtls had its own .gitignore file that masked away two
include files that are needed in compilation. Removed
the files from ignore file and added those two files.
Change-Id: Ibcfcf4e18ca8f56eef97d41464c4233148e9db9e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If the remote response with encryption/authentication error attempt to
elevate the security and retry sending the request:
bt: bt_att_recv (0x00112e0c): Received ATT code 0x01 len 5
bt: att_error_rsp (0x00112e0c): request 0x0a handle 0x0018 error 0x0f
bt: security_changed (0x00112e0c): conn 0x0010f5ac level 1
bt: security_changed (0x00112e0c): Retrying
bt: bt_att_recv (0x00112e0c): Received ATT code 0x0b len 1
bt: att_handle_read_rsp (0x00112e0c):
bt: att_read_rsp (0x00112e0c): err 0x00
Change-Id: I9d74fb50385c39b2092357f4fd6912a3eb041442
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Clone request buffer so it can later be used to validate the response.
Change-Id: I306f7b01a9a72a6c4b8e97c30789247b28428365
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This documents describes protocol used by external tester to drive
IUT. Currently initial version includes only Core and GAP services.
Change-Id: I2fcb366076313880116be2ead8916bb56a4b5910
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Use correct config option to either enable or disable
neighbor discovery.
Change-Id: If67219cfa71893d2805b37e5ab3bbd11af789cb5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This adds bt_buf_clone which can be used to duplicate a buffer, including
its contents.
Change-Id: I473841e1fce00fddbfac1fb2c55d40741658484f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This big patch refactors tester application and put it in par with
updated tester protocol.
Change-Id: Ib016fdd0aac58a32bcdc67774843cf65d619947d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
If bt_enable() is called from a preemptible context we need to make
sure the RX prio fiber is initialized by the time the HCI init runs
from the hci_rx_fiber function.
Change-Id: I91bb0c69d011944ee2a035b2a707618632a6b189
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
There is no need for local copy of addres. Use pointer instead.
Change-Id: I4681af527813093547d2641ab2390cfa64383d6b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Connection address based on keys is already selected before call to
check_pending_conn. There is no need to select it again.
Change-Id: I2f1a329c19f5c08734c50dbf8d32bf5c28192a35
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This is a mandatory characteristic for GAP servie. It must be included
in GATT db.
Change-Id: I27c0c6d56f5303c3c5d1606d7656c51823f74989
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
Pass service handles to the callback during service discovery.
Change-Id: I616de5188faf76c84cc02ceb29a6f5aab631b89c
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
Do not use local _isdigit function, use public isdigit
instead.
Change-Id: Ifc2721fc2def429de4934c9855f08dae30326694
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This option adds optional libc functions that are not directly
used by the kernel but can be used for testing purposes.
This option is experimental.
Change-Id: Ia4dba718359c4f381047a5b52ebddb26d87ea75a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add function for comparing two strings ignoring case.
Change-Id: I2fc78c0a0d0f53e23566ffacd8dca3b23e386c26
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Rewrites the LOAPIC timer tickless idle implementation to cover all edge cases.
Change-Id: Ide0a235f298dfc5c75a090a45d1bf8275d81e248
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
Removes tickless idle skew calculation as it is not particularly useful.
The actual "skew" may vary wildly depending upon whether cache is involved
or not.
Change-Id: Ie5c966eba5cdc3cff2610d4c1f3bb673c83ec8b7
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
Fixes two missed replacements of
_SysIdleElapsedTicks -> _sys_idle_elapsed_ticks
in the timer drivers.
Both were previously missed due to typos.
Change-Id: If55c9624df6f3bd7188e249f74d3ee3de61a68e4
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
This reduces the defconfig file to only those options needed
for the platform. We also introduce a kernel independent config
file (no micro/nano prefix) that be the default.
Sanity checks depends on the nano/micro file naming, so until it
is modified to support the new model, we keep the old files.
Change-Id: Ife1744d88f7bf229c1da04d5b86db26678af7f6c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The files will have the needed fragments to move a .config
file to either a nano or micro kernel .config. This will let us
get rid of the micro_*_defconfig/nano_*_defconfig in the future
and once the sanitychecks are adapted leaving us with a single
fragment file per platform and thus making it easier to maintain.
Change-Id: If23b32cc259de498816ddc8be15cdd6e0014106a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
"scripts/kconfig/merge_config.sh && make oldconfig" works well
enough for merging local config fragments, but Kbuild currently has
the entry points only for "kvmconfig" and "tinyconfig".
This commit provides the generic target for mergeconfig, so we can
manage our own config fragments easily:
put "foo.config" in arch/$(SRCARCH)/configs/ or kernel/configs/,
and then run "make foo.config".
Now "make kvmconfig" is just a shorthand of "make kvm_guest.config".
Likewise, "make tinyconfig" is equivalent to
"make allnoconfig tiny.config".
Change-Id: I9ea4fd21ac46b42c2b6d87ee7eeeff67768bc375
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Kbuild always runs in $(objtree). Actually, $(objtree) is always
set to "." by the top-level Makefile.
We can omit "-O $(objtree)" and "$(objtree)/".
Change-Id: I17eea62cc3b85957572f9f9eb5207caa1a91f881
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
If "make kvmconfig" is run with "-j" option, a warning message,
"jobserver unavailable: using -j1. Add `+' to parent make rule.",
is displayed.
$ make -s defconfig
*** Default configuration is based on 'x86_64_defconfig'
#
# configuration written to .config
#
$ make -j8 kvmconfig
Using ./.config as base
Merging ./arch/x86/configs/kvm_guest.config
[ snip ]
#
# merged configuration written to ./.config (needs make)
#
make[2]: warning: jobserver unavailable: using -j1. Add `+' to
parent make rule.
scripts/kconfig/conf --oldconfig Kconfig
[ snip ]
#
# configuration written to .config
#
Change-Id: Icda8d75af0bb50612cb020874649593c2ed0154f
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>