Only driver specific public headers should be found in include/drivers.
All generic API are found in include/ directory.
Change-Id: Ic50931987bb9460fd4a3843abc6f5de107faf045
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
bt_init() is now static function and API should use bt_enable().
Change-Id: I565f30bf816282961b71ceae2bbe90d5d93e7b8a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
With ioapic_mkstub now taking a context value we can have a single isr
routine and move away from the isr trampolines we have now
Change-Id: Ibbb0f627ac515b12c0590a71da6a3267c952dd30
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Add a macro to retrieve the device structure for a config structure by
name. This avoids the very error prone activity of the developer
having to *know* the way the internal object is named.
Change-Id: I1d7857d5aad6dfd4b1b46f63b946aad1ae3a6dc4
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Add a context value to the ioapic and loapic mkstub macros to allow
the developer to specify a context value that will be passed on the
stack to the interrupt service routines.
All the invocations for the loapic_mkstub and ioapic_mkstub macros
have been changed to pass in 0 so there is no functional difference
ATM. This change removes the need for drivers to have trampoline ISR
routines to pass a context vaule to their generic ISR routine.
This is the first step in getting rid of the hack where the driver
needs to look into the __initconfig_* linker objects.
Change-Id: I2c5eaa20d8cb5a42ef445762c426854be32c8452
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
In order to have drivers that are usable cross architecture the
signature for IRQ_CONFIG needs to be the same to avoid #ifdef hell in
the driver code based on architecture.
Update the macro and it usage for existing drivers
Change-Id: I22e142b21d4e984add231d1dbd97020e4823985f
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Change-Id: I8f51f861e2250c87c296b697ef5b6610ce644b34
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
checkpatch currently reports several files failing the C99 comment
verification. Cleaning these up now.
Change-Id: I35766c1f6c88a280c5e844b3f02668d6e1ad11d2
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Naming convention of the OS requires the use of underscores (_) for
filenames instead of dashes (-).
Change-Id: I62b615f1f336e839cbbef2c3721c1926afe76457
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Naming convention states we should be using an underscore (_) for
filenames not a dash (-).
Change-Id: I51a6ae02957bfc556b8718aae713636bd14c8b2c
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
The naming convention is to use underscores (_) and not dashes (-)
within the filename.
Change-Id: I678cf01306d72a905ed7b161af116c6e4a2cd39c
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
The naming convention used in the source is for there to be an
_ and not a - in the file. Fixing GPIO to be consistent with
the os naming conventions.
Change-Id: Ifc4356c14b52e2cc2411a7445b44c7cb57d2765c
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Naming convention uses the _ not - in the file names. In a recent
commit for I2C this for some reason changed. Making the names now
more consistent with other files.
Change-Id: I1e363c0c09ae0c8b2ac3def3beeaaeafcc01eb74
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
If Security Request with unsupported flags is received just ignore them
instead of repairing. This is already done for Pairing Request but was
missing in Security Request.
Since we are still on 4.0 just remove any new bits definitions and update
BT_SMP_AUTH_MASK accordingly.
This fix constant repairing (instead of just enabling encryption) with
peripherals that support LE Secure Connections.
Change-Id: Ic053590755e97eadbcadbea788670c050f895d32
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
To have same logs in att_mtu_req and att_mtu_rsp.
Change-Id: Ic820f989d0928089d5b0a6bce21e5e1c369eb026
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
According to the Core Spec 4.2 Vol 3 Part G
The server shall respond with the Server Rx MTU parameter set to the
maximum MTU that this server can receive.
Once the messages have been exchanged, the ATT_MTU shall be set
to the minimum of the Client Rx MTU and Server Rx MTU values.
bt: att_mtu_req (0x0010fd04): Client MTU 672
bt: att_mtu_req (0x0010fd04): Server MTU 65
bt: att_mtu_req (0x0010fd04): Negotiated MTU 65
bt: att_mtu_req (0x0010fd04): Client MTU 42
bt: att_mtu_req (0x0010fd04): Server MTU 65
bt: att_mtu_req (0x0010fd04): Negotiated MTU 42
Change-Id: I13f2f0fc99e99d8188ed15bf7972a9b892612e11
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
According to the Core Spec we shall respond to Exchange MTU Request
with MTU parameter set to the maximum MTU that we can receive.
As a Client, we shouldn't send an error if Server's Rx MTU exceeds
517 bytes. Whe should respond with our maximum MTU, because
after negotiation is done, ATT_MTU shall be set to the
minimum of the Client Rx MTU and Server Rx MTU values.
Error will be sent only in case of Rx MTU lower than LE default
ATT_MTU (23).
Change-Id: I9fa4f3fdb9b8129d52fc7b2557129c0894e5d201
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
BT_* log macros don't add new lines at the end of log message.
Change-Id: I4836f58e45453697a87c0a2b290014083b8e229a
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
According to Core 4.2 Vol 3 Part F 3.3, Commands have 6th bit
(startting from 0) set in ATT PDU. If the bit is set, no response shall be sent.
Change-Id: I63f7303e1cf2f9479dae129cdf5d31d7aadc739d
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
With this patch device name obtained from advertising packets
will be printed out.
[DEVICE]: D0:03:4B:DA:10:46 (public), AD evt type 0,
RSSI -83 AppleLETester
[DEVICE]: D0:03:4B:DA:10:46 (public), AD evt type 4,
RSSI -82
[DEVICE]: 00:A0:50:00:00:08 (public), AD evt type 0,
RSSI -80 BLE Keyboard
Change-Id: Ic5116bce958d5b4479d481c40b2658ab56ecb819
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
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>