If found error during service level connection disconnect rfcomm.
Change-Id: Ida425375975b8d60ab1024d07a8ffe7745ae0b54
Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
Some application protocol required non-persistente subscription
across connection even in bonded case.
Flag BT_GATT_SUBSCRIBE_FLAG_VOLATILE specify if subscription
must be remove during disonnection.
Change-Id: I1bc2bbbb4bc86f58905e44a7eb267ca0871f2fdb
Signed-off-by: Jonathan Gelie <jonathanx.gelie@intel.com>
Implement the missing port read and write behaviour.
Change-Id: I0928379eddf81d806a0ae6b75a1ea2993c3a28ff
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
Adjust the implementation of gpio_pin_read() to return 0 or 1 rather
than 0 or 2^pin. This ensures consistent behaviour with other gpio
device drivers, and conforms to the behaviour documented in gpio.h by
the previous patch.
Change-Id: Ia02aa68105a406f355d16a3f9b0550f948658483
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
Clarify the behaviour of gpio read and write functions.
Change-Id: Ib64f9e4bfc6e908a945fd7e17ba4073d3c707fc6
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
The subscriptions callback may free or reuse the subscription so all
instances that where this could happen need to safely fetch the next
element which is why this changes switch to use sys_list_t as it has
SYS_SLIST_FOR_EACH_NODE_SAFE.
Change-Id: I37d51f27116ea0c057b560924a9416676477597b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Once the service level connection is done call the connected
callback.
Change-Id: I7541e221d4c03c939682ec70f1d9c093f87ceb09
Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
We can go further with taking advantage of k_poll and merge the
connection TX thread together with the HCI command thread, thereby
saving even more memory.
Change-Id: I1792056fd4621d62c7cd05929094033acca45c74
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Now that the k_poll API is available we can use it to have single
connection TX thread instead of multiple ones, which helps reduce the
per-connection memory overhead by a substantial amount.
Change-Id: Icb5d4da87cf0d660bba8da43186d1e76f41c825a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Adds to BT shell app functionality to trigger to be found on remote
A2SRC UUID. Implements user callback to read resolved response data
and uses existing SDP client API to read attributes values.
> HCI Event: Number of Completed Packets (0x13) plen 5
Num handles: 1
Handle: 77
Count: 1
> ACL Data RX: Handle 77 flags 0x02 dlen 48
Channel: 64 len 44 [PSM 1 mode 0] {chan 0}
SDP: Service Search Attribute Response (0x07) tid 2 len 39
Attribute bytes: 36
Continuation state: 0
Combined attribute bytes: 89
Attribute list: [len 84] {position 0}
Attribute: Service Record Handle (0x0000) [len 2]
0x00010005
Attribute: Service Class ID List (0x0001) [len 2]
UUID (3) with 2 bytes [0 extra bits] len 3
Audio Source (0x110a)
Attribute: Protocol Descriptor List (0x0004) [len 2]
Sequence (6) with 6 bytes [8 extra bits] len 8
UUID (3) with 2 bytes [0 extra bits] len 3
L2CAP (0x0100)
Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
0x0019
Sequence (6) with 6 bytes [8 extra bits] len 8
UUID (3) with 2 bytes [0 extra bits] len 3
AVDTP (0x0019)
Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
0x0102
Attribute: Browse Group List (0x0005) [len 2]
UUID (3) with 2 bytes [0 extra bits] len 3
Public Browse Root (0x1002)
Attribute: Bluetooth Profile Descriptor List (0x0009) [len 2]
Sequence (6) with 6 bytes [8 extra bits] len 8
UUID (3) with 2 bytes [0 extra bits] len 3
Advanced Audio Distribution (0x110d)
Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
0x0102
Attribute: Unknown (0x0100) [len 2]
Advanced Audio [len 15]
Attribute: Unknown (0x0311) [len 2]
0x0001
< ACL Data TX: Handle 77 flags 0x00 dlen 12
L2CAP: Disconnection Request (0x06) ident 10 len 4
Destination CID: 65
Change-Id: I8938d9eebda31f3d252ff49adc1a96abfcbc5751
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Removing the module specific buffer pool. If future, use common acl_tx_pool.
Change-Id: Ie1452f981ef43642715be395315845cc2d9bb285
Signed-off-by: Arun Jagadish <arun.jagadish@intel.com>
Detaching the timeout from the tx_thread lets us prepare for merging
all TX threads into a single one with the help of k_poll(). There's no
need to define a new delayed work object since the existing connection
parameter update object and connection timeout will never need to run
in parallel. Additionally, but some CONFIG_BLUETOOTH_CENTRAL guards to
void pulling in unnecessary code when Central role is not enabled.
Change-Id: Ia1f222aa052edcecd484a924f2d9a63a3b8fd11f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Reduce the pressure on the common RX buffer pool by reusing HCI
command buffers also for the Command Status or Command Complete
response to them. This also implies removing the existing Kconfig
variable for the command buffer sizes since the size is also dependent
on maximum Command Complete event sizes. Instead, reuse the RX buffer
size also for HCI Command buffers.
Change-Id: I006b287d64a0c9ca40de741aa9a424a49a927385
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
With an upcoming patch the HCI command buffers will be reused for the
Command Complete/Status HCI events. The controller HCI code needs some
refactoring to postpone the event buffer allocation so that the
parsing state of the HCI command buffer isn't touched.
Change-Id: I1f614fb9f02ed1886ca84198fbc8c64abc29e44f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
A subsequent patch will start reusing HCI command buffers for
receiving the response, so the distinction of received vs sent data
headroom would just make the code unnecessarily complex. Instead, just
merge these two variable into a single one.
Change-Id: I31d846331939f1a2270df7ed0c75112825e16493
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The C pre-processor doesn't allow using sizeof() in comparisons such
as "#if FOO < sizeof(bar)". To make it possible to use such
comparisons where the sizes of headers are involved, introduce helper
macros for the headers instead of always having to hard-code magic
numbers into the code.
Change-Id: Iaf654cb4aaa49e83360901f5b01225ba4b952854
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
If we are low on RX buffers and receive an LE Advertising Report or a
BR/EDR Inquiry response we should just discard this. If we don't
discard the event we increase the risk of deadlock where the RX
interrupt is enabled but bt_recv() is doing a synchronous HCI command
sending, i.e. waiting for a cmd_status/cmd_complete (which will never
come since the RX interrupt is disabled).
Change-Id: I6266625c9790d68bcf8e8718c8c36f127946c4c6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
If the driver send() fails we need to free up bt_dev.sent_cmd.
Change-Id: I41b6293dfe09f1d94d7f85663ddbebed40cf6e90
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Adds API to allow user get SupportedFeatures attribute ID.
Jira: ZEP-1112
Change-Id: I91a1bf548d99c5c7cc75682aed19e89390350533
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Makes use ProfileDescriptorList atribute API to get remote Hands-Free
profile version.
Jira: ZEP-1112
Change-Id: I3752691057e15c3a9a681dd3277ac160096792e9
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Adds pool memory for storing SDP client query results and introduces
command allowing add HFPAG UUID to be resolved when connection to peer
is already set. When resolved data arrives, UUID callback handler
tries to identify RFCOMM protocol specific information, in this case
remote HFPAG Server Channel Number, stored in Protocol's Descriptor List
attribute data.
> HCI Event: Number of Completed Packets (0x13) plen
Num handles: 1
Handle: 77
Count: 1
> ACL Data RX: Handle 77 flags 0x02 dlen 55
Channel: 64 len 51 [PSM 1 mode 0] {chan 0}
SDP: Service Search Attribute Response (0x07) tid 2 len 46
Attribute bytes: 43
Continuation state: 0
Combined attribute bytes: 96
Attribute list: [len 91] {position 0}
Attribute: Service Record Handle (0x0000) [len 2]
0x00010003
Attribute: Service Class ID List (0x0001) [len 2]
UUID (3) with 2 bytes [0 extra bits] len 3
Handsfree Audio Gateway (0x111f)
UUID (3) with 2 bytes [0 extra bits] len 3
Generic Audio (0x1203)
Attribute: Protocol Descriptor List (0x0004) [len 2]
Sequence (6) with 3 bytes [8 extra bits] len 5
UUID (3) with 2 bytes [0 extra bits] len 3
L2CAP (0x0100)
Sequence (6) with 5 bytes [8 extra bits] len 7
UUID (3) with 2 bytes [0 extra bits] len 3
RFCOMM (0x0003)
Unsigned Integer (1) with 1 byte [0 extra bits] len 2
0x03
Attribute: Browse Group List (0x0005) [len 2]
UUID (3) with 2 bytes [0 extra bits] len 3
Public Browse Root (0x1002)
Attribute: Bluetooth Profile Descriptor List (0x0009) [len 2]
Sequence (6) with 6 bytes [8 extra bits] len 8
UUID (3) with 2 bytes [0 extra bits] len 3
Handsfree (0x111e)
Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
0x0106
Attribute: Unknown (0x0100) [len 2]
Handsfree Gateway [len 18]
Attribute: Unknown (0x0301) [len 2]
0x01
Attribute: Unknown (0x0311) [len 2]
0x0027
< ACL Data TX: Handle 77 flags 0x00 dlen 12
L2CAP: Disconnection Request (0x06) ident 5 len 4
Destination CID: 64
Source CID: 64
> HCI Event: Number of Completed Packets (0x13) plen 5
Num handles: 1
Handle: 77
Count: 1
> ACL Data RX: Handle 77 flags 0x02 dlen 12
L2CAP: Disconnection Response (0x07) ident 5 len 4
Destination CID: 64
Source CID: 64
Jira: ZEP-1112
Change-Id: Ibda606fabe367ca3d0353f77c7093da8c4f175c8
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Adds API to get available specific information included in protocols UUID
tree during parsing Protocol Descriptor List attribute. Usually it's to
be remote Server Channel/PSM number operating on applicable protocol.
There're a few helper functions added to be able parse and retrieve such
information from raw record data.
Jira: ZEP-1112
Change-Id: I736a780b95ba54821d36e6011b739f5ff37cd64f
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Both all-zeroes and all-ones addresses are invalid. Fix the check for
this so that we fall back to a static random identity address when
needed.
Change-Id: I17cf903e0f3ed321311d86d09bed19343c2c801a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This will reduce memory consumption by 23 bytes per session.
Change-Id: I1831b59881eaefb68f93c30e298b8f97d63c7428
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
Session idle timer should not be started in dlc destroy if
session is already disconnected (which can happen in scenarios
like acl disconnection where in dlc is detached from session and
destroy will be called from tx thread) otherwise timer function will
get invoked for a disconnected session.
This patch moves starting of idle timer from dlc destroy to
the point dlc disconnect is recieved from remote since idle
timer is to handle only that scenario.
Change-Id: I94501515a182ff0e2348ba4e2df63100f2f52209
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
The nRF5x come preprogrammed from manufacturing with either a public or
random static BLE address in the FICR register. Use the random static
one when present instead of generating one during Bluetooth
initialization.
Change-id: Ic733cb926e0414e56d6f8be65b033692e914b72a
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Reduce the accelerometer sampling frequency for polling mode.
So, cpu has more time to fetch the sample.
Also add some waiting time for the new frequency setting to
take effect.
Jira: ZEP-1532
Change-Id: If5c1d8a2b5f30b232a212f2775306ca397b9f80c
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Incomplete type is not acceptable to LLVM. Let's use
pointer instead.
Jira: ZEP-1179
Change-Id: Ie6324b2e5076ae2b378fa270d0d9fdcbf29bf8ce
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
Remove CONFIG_GPIO from the prj config file. It is redundant.
Change-Id: Ife4301e7ce480a9002cadcddfd5eaa569900a391
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
Add sensor sample ready check before fetching the sample.
Otherwise, invalid value will be returned.
Jira: ZEP-1532 ZEP-1358
Change-Id: I570151c8ae93fbb744dac857521f596fd63806a6
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
The entry point specified in the elf file should always point to
executable code, and not to the interrupt vector table. Pointing to the
vector table as the entry point in the elf file presents problems with
running the kernel against a debugger as the debugger starts the program
counter at the top of the interrupt vector table.
Change-Id: I76051f6e99a44bab72936670bead5fb8191a6ec7
Signed-off-by: Tim Nordell <tim.nordell@nimbelink.com>
As it turns out Xtensa SDK headers also define _Restrict, causing
havoc. As this was intended to be a private macro, rename it to something
less likely to cause a collision.
Change-Id: I0a7501a1af8cf87efb096872a91a7b44bd2bbdca
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Rename devices. For example, the two i2c devices in the
quark se sensor sub-system will have name string "I2C_0"
and "I2C_1", while the other two i2c devices accessible to
both x86 and arc will have name string "I2C_2" and "I2C_3".
This is valid only when you build arc binary.
It does not apply if you build x86 or arm binary. Similar change is
also made for GPIO and SPI.
Jira: ZEP-1588 ZEP-1614
Change-Id: Ibad4486e70e0aaf287763514a5a9d28b43bca094
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
Header files from Atmel ASF define several preprocesor macros
which are unused and break compilation with some toolchains.
This patch removes those macros. Currently only from same70q21.h
header file which is used by SAM E70 Xplained target board.
Jira: ZEP-976
Change-Id: I13adb92c73773815c6df221ef33b0f56795f1d8c
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
Use this configuration file with the uncrustify tool to fix style
issues. the configuration should apply the zephyr coding style on
source code files with a few minor excrption. Do not take the output for
granted, always check for correctness after running.
To use, for example:
uncrustify --replace --no-backup -l C -c $ZEPHYR_BASE/scripts/uncrustify.conf
This will do the changes inline.
Change-Id: Iecfd2e10bc7e475ca83de0d921ebb5d72156d286
Signed-off-by: Anas Nashif <anas.nashif@intel.com>