This patch makes attributes discovery more easier from the point
of shell application user.
UUIDs of discovered attribute declarations are now printed.
For services handle range is shown.
btshell> gatt-discover-primary 1800
btshell> Service 1800 found: start handle 00000001, end_handle 0000000b
Characteristic properties are parsed to string and printed
with characteristic value handle.
Characteristic f000ffc1-0451-4000-b000-000000000000 found: handle 0000006a,
value_handle 0000006b
Properties: [write][write w/w rsp][notify]
Change-Id: I6823fa562206ccf336dc301ee71bc4a02cecc14f
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
If pairing failed before encryption was enabled or if enabling
encryption failed (eg due to remote device missing LTK) required
security level should be reset.
Otherwise it is not possible to re-try with setting security level.
Error reporting to application is still missing though.
Change-Id: I085e3ee116bd04304a4c4563cc40f9d40262447e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Advertising type is already configured based on current settings.
Change-Id: I4b47237c9ea7c48eab05786f01b38ebe3250141a
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
According to Core Specification "An Error Response shall be sent by
the server in response to the Read Multiple Request if insufficient
authentication, insufficient authorization, insufficient encryption
key size is used by the client, or if a read operation is not permitted
on any of the Characteristic Values. The Error Code parameter is set as
specified in the Attribute Protocol."
If any handle used by client is invalid we should return and error.
Change-Id: I5489ce6284531822676a63edf13db23289866102
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
To allow the remote central to pair and encrypt the link.
IO capabilities are set to DisplayOnly.
Change-Id: I46459539f1b882952d29ee5eb8d17766715de4b8
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
This patch fixes the issue with 128bit uuid descriptors discovery.
Data from Find Information Response were parsed improperly,
because length took into account the size of pointer to info data,
not data itself.
Change-Id: Ifad0110705bacc3c757a91ebbd97af5ba93897d9
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
We had two attributes stored with the same handle.
Change-Id: Ib24912578b958d428d6b3da3c2f73994691622bb
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
Factor out role dependent code to helper. This allows to get rid of
'done' label without decresing code readibility. Allows to cleanly
build with CONFIG_BLUETOOTH_PERIPHERAL and CONFIG_BLUETOOTH_SMP
defined.
Change-Id: I33606955ae8b1c75385e2eee89620761d59f0108
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
It is possible that slave sends subsequent Security Request while
link is already encrypted. One example is that current LTK is
unauthenticated and slave wants to increase security with MITM
protection.
Change-Id: I5f079e6140a5912443f770ba2c7cabeffcecdf2b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
BTP protocol specifies value length to be 2 octets value,
so uint16_t has to be used to store this length.
Change-Id: I2a911910475db305a0ff1f9ab70866d24aa47158
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
If security level changed due to key refresh application was
not notified about it.
Change-Id: I550095608da6d9bfb885ff2fbf62d9edc0429d06
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This fix crash due to calling auth callback from wrong pointer.
get_io_capa was using bt_smp_io_capa instead of structure provided
in argument. This resulted in checking NULL pointer for provided
callbacks. By coincident this always returned
BT_SMP_IO_KEYBOARD_DISPLAY (first 8 bytes in memory were non-zero)
and resulted in calling callback from NULL address if application
didn't provided passkey_display or passkey_entry callbacks.
btshell>
bt: bt_smp_connected (0x00115360): conn 0x00111788 handle 73
bt: bt_att_connected (0x00115360): conn 0x00111788 handle 73
bt: bt_gatt_connected (0x00115360): conn 0x00111788
Connected: 20:68:9D:60:A1:E4 (public)
bt: bt_smp_recv (0x00115360): Received SMP code 0x01 len 7
bt: smp_pairing_req (0x00115360):
bt: smp_init (0x00115360): prnd 8773a11cde889e1b7397064527a5469d
***** Unhandled exception/interrupt occurred! *****
Current thread ID = 0x00115360
Faulting instruction address = 0x00111788
Fatal fiber error! Aborting fiber.
Change-Id: Ic297603a3fbc8bd741d5110c01bef61f7dda1d6f
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
If pairing was finished it is perfectly fine for remote to send
another SMP PDU and start new pairing.
To make code simpler just use smp_reset() to set SMP into correct
state.
Change-Id: I8d04a5f0ed78c01ef4caca89f02a1ac5fe950e90
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Adding convenience scripts that help user when running socat,
radvd and tunslip6 processes. These helper scripts restart
corresponding processes when qemu stops. This way end user
does not need to manual restart the utility processes.
Change-Id: I2e8eb15ee0ffe2ac8f1cedf4431cf8b09fcbbee5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
User can set the source IP address of the sent network packet
in dtls-client by using -b command line option. This helps if
the -i option picks up wrong address from network interface.
Change-Id: I8c26f1a14de2394085dea1d6008eb758a5ce7ad1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This allows to pair with devices that use reduced encryption key size.
Encryption key size is stored with keys for future use. LTKs are kept
in full form (16 bytes) and are reduced only when used.
As master:
< ACL Data TX: Handle 64 flags 0x00 dlen 11
SMP: Pairing Request (0x01) len 6
IO capability: NoInputNoOutput (0x03)
OOB data: Authentication data not present (0x00)
Authentication requirement: Bonding, No MITM, Legacy,
No Keypresses (0x01)
Max encryption key size: 16
Initiator key distribution: EncKey Sign (0x05)
Responder key distribution: EncKey IdKey Sign (0x07)
> ACL Data RX: Handle 64 flags 0x02 dlen 11
SMP: Pairing Response (0x02) len 6
IO capability: KeyboardDisplay (0x04)
OOB data: Authentication data not present (0x00)
Authentication requirement: No bonding, No MITM, Legacy,
No Keypresses (0x00)
Max encryption key size: 7
Initiator key distribution: <none> (0x00)
Responder key distribution: <none> (0x00)
...
< HCI Command: LE Start Encryption (0x08|0x0019) plen 28
Handle: 64
Random number: 0x0000000000000000
Encrypted diversifier: 0x0000
Long term key: df3cff52a981d6000000000000000000
As slave:
> ACL Data RX: Handle 64 flags 0x02 dlen 11
SMP: Pairing Request (0x01) len 6
IO capability: KeyboardDisplay (0x04)
OOB data: Authentication data not present (0x00)
Authentication requirement: No bonding, No MITM, Legacy,
No Keypresses (0x00)
Max encryption key size: 7
Initiator key distribution: <none> (0x00)
Responder key distribution: <none> (0x00)
< ACL Data TX: Handle 64 flags 0x00 dlen 11
SMP: Pairing Response (0x02) len 6
IO capability: NoInputNoOutput (0x03)
OOB data: Authentication data not present (0x00)
Authentication requirement: No bonding, No MITM, Legacy,
No Keypresses (0x00)
Max encryption key size: 16
Initiator key distribution: <none> (0x00)
Responder key distribution: <none> (0x00)
...
> HCI Event: LE Meta Event (0x3e) plen 13
LE Long Term Key Request (0x05)
Handle: 64
Random number: 0x0000000000000000
Encrypted diversifier: 0x0000
< HCI Command: LE Long Term Key Request Reply (0x08|0x001a) plen 18
Handle: 64
Long term key: 701b431a9e17bb000000000000000000
Change-Id: Ibc70aa01c040aff0d39410d273d6880d35aa5ae0
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This is in preparation for supporting different encryption key sizes.
Change-Id: I36ed61a35fbe4988ce863127ae318c63f9298dd3
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This adds bt_l2cap_server_register which can be used to register a
server to a given PSM.
Change-Id: I301dc26a0ed881230568aa0fdd6cc5d0d6dd814a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
After license text was changed correct also code lines.
Change-Id: Idd3f34c38bb8ff9a40b6c02755f9716a98a6e86f
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Performed edits based on Steve's comments. This new change fixes the
merge conflict of a previous version.
Change-Id: Ib99ed9a28da94c5780115ab0221edc9409e74919
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
Edited for grammar, style, markup, linkage, consistency.
This change was resubmitted to avoid having a nickname as author.
Change-Id: Ie3a1a16c33939062ce2e139024afd2162a0c802d
Signed-off-by: Steve Ballard <stephen.r.ballard@intel.com>
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
Minor changes to formatting to make guidelines clearer.
Edit for clarity, readability and markup. Cleared whitespace error.
Change-Id: I050857653303cfae32875b1b6c2151b22271c0b6
Signed-off-by: L.S. Cook <leonax.cook@intel.com>
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
Change the new files from Intel in BSD-3 to Apache 2.0
Change-Id: Ica4b455e9cb8134889f2a88e2d96094ce7093734
Signed-off-by: Javier B Perez Hernandez <javier.b.perez.hernandez@linux.intel.com>
Improves the efficiency of the search by doing a single pass through
all device objects, rather than searching one level at a time.
Also enhances the comments for this routine.
Change-Id: I6786f24381f03d74d8c559ccbd7aa6a37683a8b7
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Introduces the SYS_DEFINE_DEVICE() macro, which supports 5 distinct
levels of device initialization and 100 priorities within each level.
Note: The existing init macros (e.g. nano_early_init()) have been
adapted to utilize the enhanced initialization model, but will
eventually be retired.
Change-Id: If677029d8b711a3fae9b2f32b5470cd97d19aeda
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Gets rid of obsolete #ifdefs, since the name of a UART device's
associated variable is now constant regardless of when it is
initialized.
Change-Id: Ic6b5ce7777f067fb57aee33899a644c63040d41f
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Gets rid of the trailing initialization level character from the
name of the device variable generated by the macro, since it serves
no useful purpose. (The linker scripts place the various initialization
sections in ascending order based on the name of the section, so there
is no need to embed the initialization level in the variable name itself.)
Change-Id: I56bb79a513b8f77fb1f3fbaccec14454c2520772
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Drivers do it by themselves, usually either in a dedicated irq
configuration function or direcly in their initialization routine.
Change-Id: Id1cca1a1e3e3f36264d99d1d2f2d651d84e0687e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Reworks the internal design of a command packet set so that
the command packet array is split out into a separate variable
lying in uninitialized memory. This shrinks the command packet's
data section footprint to almost nothing.
Note: A side effect of this change is that it is no longer possible
to define a command packet set as a "static" variable since the
CMD_PKT_SET_INSTANCE() macro now generates two variables.
Change-Id: I9c7ebe637edf879758589ff4a26ace1303790bf7
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
This functions - reusing _arc_v2_aux_reg_* ones - will ease porting
drivers to ARC architecture hiding arch specific calls under generic
functions. On ARC, auxiliary registers is conceptually comparable to
x86 ports, thus the possibility to bring sys_in/sys_out to access those.
Change-Id: Ic5c0fc41f32ec4ad861dbb58cd8defaf4497bc03
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Initial import of the Grove LCD I2C controller. Data sheet can
be found at:
http://www.seeedstudio.com/wiki/images/0/03/JHD1214Y_YG_1.0.pdf
[DL: Updated command sequence according to datasheet.]
Change-Id: Id1b491f8dce346769dc42c41fac0ea3aabe3950a
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Edit the content, adding bold text and headings for readability.
Revised the structure based on comments by developers.
Resubmitted to solve merge issues.
Change-Id: I7679eb7c71eab5cd18addcdb296c376923984494
Signed-off-by: L.S. Cook <leonax.cook@intel.com>
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
Book titles need italics, other minor issues Line length fixed.
Markup errors corrected.
Resubmitted to solve merge issues.
Change-Id: I069463a45655e1bd4c57828008c0868083757344
Signed-off-by: L.S. Cook <leonax.cook@intel.com>
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
use __aligned__ and __used__ instead of aligned/used to avoid conflicts
with macros of the same name.
Change-Id: Ic36067dfc9df7ebcea486a075f759825d0dbde70
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
rename the sections macro to avoid conflicts with the same
macro being defined in sys/cdefs.h of an external libc.
Change-Id: I4d9e060eeff788ca4112c0ad3e98f0bea135f145
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Calling 'make menuconfig' from an application will prepare
the configuration defined in the application (Makefile) and
will launch menuconfig with the correct configuration rather
than the default for the architecture.
Change-Id: I6c611ddaa23b67632c507291294a73b6c4283cea
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Changed the existing API table to a list as it was done
in the Kernel Primer.
Change-Id: Ib0d7952c650316b414ac9258ab3c48e9f6c70c4e
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
Lots of enhancements and bug fixes but primarily it fixes an issue
where checkpatch was reporting errors in lines that have not changed.
Change-Id: If141a294b92cbabd4ad8978a40168abb062aebfb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
will generate an extra file that specifies the maximum amount
of stack used, on a per-function basis.
Using a static stack checker the data can be analysed, for example:
http://dlbeer.co.nz/oss/avstack.html
Change-Id: I23bd8ce7c4516bd0c7ffb74504e6d379677f25f8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
GPIO driver is initialized at pre-kernel-late level, if SPI does it too,
it will happen before GPIO (depends on the ordered list of
initialization). In order to ensure it gets GPIO initialized always
before SPI, let's set SPI to initalize at the next level: nano-early.
Change-Id: I6e34168c88fca0187a809bf5c7971492bd5acb5c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This test fails with exception debug enabled. Make sanity pass again
while we debug this issue.
Change-Id: I0df279d2ec2f8fb29c30d25ec0d05da18e929964
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Currently when an unhandled exception or trap occurs, we don't know
specifically which one happened. The CONFIG_EXCEPTION_DEBUG option
installs handlers for various exceptions and prints out details
when they happen.
Change-Id: I4d3fe4544c3e2583c4f83b306b86ac0595d9ce0e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
SPH and SPO flags are not mutual exclusive, this way
they need to occupy different bit fields.
Added missing () around _in_ parameters of macros as well.
Change-Id: I6175231dddaca84a2a3190a5d0a388496a549baf
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Remove unnecessary bullets and replaced them with indentation.
Added articles and performed other edits for clarity, markup and style.
Change-Id: I390d04a6a3c20eabde2eb100cac4fc88a3ca8cc8
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
The document was edited for clarity, style, consistency, grammar, and
spelling.
Change-Id: If1af5cfd8285bb13606a1bff257177521af7ab3d
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>