Commit graph

19193 commits

Author SHA1 Message Date
Andrei Emeltchenko
e3f542cf2f galileo: Correct typo and mark variable unused
Change-Id: I0a386b293ddff54bbce8035670a282201eb5358b
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:24:32 -05:00
Andrei Emeltchenko
c7b152932d galileo: Remove unneeded defines
If console handler is defined uart console should also be defined.

Change-Id: I3efcc6c837f8f1621340f7f13bf0603d7dc42fb2
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:24:32 -05:00
Tomasz Bursztyka
17e06fb457 uart: Move generic API to root directory of include
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>
2016-02-05 20:24:32 -05:00
Andrei Emeltchenko
82c958581e doc: Replace bt_init() with bt_enable()
bt_init() is now static function and API should use bt_enable().

Change-Id: I565f30bf816282961b71ceae2bbe90d5d93e7b8a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:24:32 -05:00
Dirk Brandewie
94c2960227 i2c: designware move to using single isr
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>
2016-02-05 20:24:31 -05:00
Dirk Brandewie
7a1e221733 init: add SYS_GET_DEVICE() macro to bury &__initconfig_* names usage.
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>
2016-02-05 20:24:31 -05:00
Dirk Brandewie
ad5af93f25 x86: Add context value to loapic_mkstub and ioapic_mkstub macros
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>
2016-02-05 20:24:31 -05:00
Dirk Brandewie
147d6585ae x86: arm: Modify IRQ_CONFIG macro to have same signature as ARC
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>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
2e938481ce checkpatch: error - initialised_static
Change-Id: I8f51f861e2250c87c296b697ef5b6610ce644b34
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
0182d863cd checkpatch: error - function_without_args
Change-Id: Id020ac7eafbb20352d839565256f0bf47f7fe301
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
e4bb957a00 checkpatch: error - pointer_location
Change-Id: I9ce224cb75ba21caecffd6747833257f748b5ecf
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
a60c866c70 checkpatch: error - open_brace
Change-Id: I434037ce969bcd1fc08bd4b407f9508773e64b1e
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
d04ae83e11 checkpatch: error - return_parentheses
Change-Id: If1964349a115043fa54bf48ebfe4b3c0a414ed57
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
39063598db checkpatch: error - spacing
Change-Id: Ie6e1c43581dd4b0734625b3a4e59a4ca79619e99
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
3bc4039601 checkpatch: error - switch_case_indent_level
Change-Id: I9cbd6ab80b0c0f170626bb1c6b2d07498038fb8f
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
7cfc703711 checkpatch: error - trailing statements
Change-Id: I461134536da0288261b90f605a904ab3ea466340
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
4518f747af checkpatch: error - trailing_whitespace
Change-Id: I9ccc8aef40de7b66e1899994e3dbc7147df61414
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
978851fb6a checkpatch: code_indent failures
Corrects the checkpatch code_indent failures

Change-Id: I2ff93b8907d3eddbaa543ccbd12aecef8af7f698
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
247dc8f2d1 checkpatch: removing C++ comment style
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>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
c936f6a029 random: rename random to use underscore
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>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
70b8230397 pwm: renaming files to use underscore
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>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
286a7e2bfe adc: renaming ADC files to use underscore
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>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
6bf971915f gpio: rename files
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>
2016-02-05 20:24:31 -05:00
Dan Kalowsky
e899bb60ac i2c: changing file names to be consistent
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>
2016-02-05 20:24:31 -05:00
Szymon Janc
3def4202ae Bluetooth: SMP: Ignore unsupported AuthReq in Security Request
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>
2016-02-05 20:24:31 -05:00
Szymon Janc
a0f209ba8c Bluetooth: SMP: Pass SMP context to smp_request_tk
Use SMP context as smp_request_tk() parameter.

Change-Id: Ia0bafa4bab06c8696f1c05a6cfc402d81a08b2ab
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:31 -05:00
Szymon Janc
fe5a7f1041 Bluetooth: SMP: Pass SMP context to smp_reset
Use SMP context as smp_reset() parameter.

Change-Id: If513c58178445cf73e53085397c6f6ba080a2f27
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:31 -05:00
Szymon Janc
a004eb2319 Bluetooth: Add new line in le_conn_update_complete debug log
Change-Id: Id08aa8246b5e5970b0ff104a9c86d80069d1a7e5
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:31 -05:00
Mariusz Skamra
acc84f2bed Bluetooth: ATT: Add debug log for printing negotiated MTU
To have same logs in att_mtu_req and att_mtu_rsp.

Change-Id: Ic820f989d0928089d5b0a6bce21e5e1c369eb026
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:31 -05:00
Mariusz Skamra
2ba3c9aa1d Bluetooth: Fix sending incorrect MTU in the Exchange MTU response
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>
2016-02-05 20:24:31 -05:00
Mariusz Skamra
de72c02645 Bluetooth: Don't response with error to Exchange MTU req if MTU > 517
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>
2016-02-05 20:24:31 -05:00
Szymon Janc
8b49731d3f Bluetooth: SMP: Fix missing new lines in logs
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>
2016-02-05 20:24:31 -05:00
Mariusz Skamra
ee224e8bb0 Bluetooth: ATT: Fix incorrect BT_ATT_OP_CMD_MASK
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>
2016-02-05 20:24:30 -05:00
Mariusz Skamra
ceef6099dd Bluetooth: shell: Improve device found event callback
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>
2016-02-05 20:24:30 -05:00
Mariusz Skamra
df7f3a193f Bluetooth: shell: Improve attribute discovery callback
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>
2016-02-05 20:24:30 -05:00
Mariusz Skamra
50e2355754 Bluetooth: Add bt_uuid_to_str function
To be used for debugging purposes.

Change-Id: I471e1a0c1affc52e900ae99a53f58346e9f997ef
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:30 -05:00
Szymon Janc
08415ff1d7 Bluetooth: Fix not reseting required sec level on error
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>
2016-02-05 20:24:30 -05:00
Szymon Janc
f795f37426 Bluetooth: Remove outdated comment from tester
Advertising type is already configured based on current settings.

Change-Id: I4b47237c9ea7c48eab05786f01b38ebe3250141a
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:30 -05:00
Szymon Janc
3e3dbe2e23 Bluetooth: Fix Read Multiple Characteristics Values error response
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>
2016-02-05 20:24:30 -05:00
Mariusz Skamra
15612e6bf9 Bluetooth: Add authentication callbacks to the peripheral app
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>
2016-02-05 20:24:30 -05:00
Mariusz Skamra
2e3eccd7a1 Bluetooth: att: Fix invalid discovered descriptors parsing
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>
2016-02-05 20:24:30 -05:00
Mariusz Skamra
9a794915b7 Bluetooth: Fix invalid characteristic handle in peripheral app db
We had two attributes stored with the same handle.

Change-Id: Ib24912578b958d428d6b3da3c2f73994691622bb
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:30 -05:00
Szymon Janc
74036343c1 Bluetooth: Refactor bt_conn_security
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>
2016-02-05 20:24:30 -05:00
Szymon Janc
1706ecebe2 Bluetooth: SMP: Fix dropping subsequent Security Requests
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>
2016-02-05 20:24:30 -05:00
Mariusz Skamra
cc1208fb5f Bluetooth: Fix invalid value length type
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>
2016-02-05 20:24:30 -05:00
Szymon Janc
e82b9e488f Bluetooth: Fix not reporting security level change
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>
2016-02-05 20:24:30 -05:00
Szymon Janc
7ee4fa4473 Bluetooth: SMP: Fix crash when using KeyboardOnly capabilities
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>
2016-02-05 20:24:30 -05:00
Szymon Janc
a51d61d214 Bluetooth: SMP: Fix not allowing any PDU after pairing is finished
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>
2016-02-05 20:24:30 -05:00
Jukka Rissanen
901cadd5cd net: tools: Helper scripts for running socat, tunslip6 and radvd
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>
2016-02-05 20:24:30 -05:00
Jukka Rissanen
dd71984334 net: tools: Allow user to set the source address for dtls-client
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>
2016-02-05 20:24:30 -05:00