platform/upstream/bluez.git
4 years agomesh: Fix processing of Config Node Reset message 53/228953/1
Inga Stotland [Tue, 17 Mar 2020 22:15:46 +0000 (15:15 -0700)]
mesh: Fix processing of Config Node Reset message

This fixes a condition when a node continues processing messages
after it has been reset by a remote configuration client.
Upon receiving Config Node Reset message, node removal happens after
a grace interval to allow sending of Config Node Reset Status reply.

Change-Id: I7bb87d65c141a479325fc5436921e62aab0eef95
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agotools/mesh-cfgclient: Implement node-reset command 52/228952/1
Inga Stotland [Tue, 17 Mar 2020 22:15:45 +0000 (15:15 -0700)]
tools/mesh-cfgclient: Implement node-reset command

This implements one-pass removal oa a remote node from a mesh network
by issuing a node-reset command from config menu. The following actions
are performed:
- Config Node Reset message is sent to a remote node
- Upon either receiving Config Node Reset Status or response timeout,
  node record is removed from configuration client's database and,
  by calling DeleteRemoteNode() method on mesh.Management interface

node-delete command from the main menu is removed.

Change-Id: I52fb6c640b6001373ff9650b3440f518ad5d5d85
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agotest/test-mesh: Add support for static OOB in the agent 51/228951/1
Inga Stotland [Wed, 11 Mar 2020 22:37:12 +0000 (15:37 -0700)]
test/test-mesh: Add support for static OOB in the agent

This allows to display a 16-octet key to be entered on the remote
device during provisioning.

Change-Id: If00c3e86c419733a348f412ec350a88d4127f85f
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agotools/mesh-cfgclient: Add support for Static OOB key 50/228950/1
Brian Gix [Wed, 11 Mar 2020 22:59:40 +0000 (15:59 -0700)]
tools/mesh-cfgclient: Add support for Static OOB key

This fixes a bug that didn't allow 16 octet Static OOB strings during
provisioning.

Change-Id: I08c04784d920b4cf4dcff0e172e9095d00be7bc7
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agoREADME: Add Mesh required Kernel Configuration section 49/228949/1
Brian Gix [Wed, 11 Mar 2020 22:15:18 +0000 (15:15 -0700)]
README: Add Mesh required Kernel Configuration section

Not all distributions include all required mesh crypto support.  This
adds a section with known kernel required options.

Change-Id: I8b62d79ffb4688426f1b37a27be494abcd1eb00a
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agotools/mesh-cfgclient: Record remote node's default TTL 48/228948/1
Inga Stotland [Wed, 4 Mar 2020 07:39:15 +0000 (23:39 -0800)]
tools/mesh-cfgclient: Record remote node's default TTL

This adds code to save the value of a remote node's default TTL
upon receiving Config Default TTL Status message.

Also, cleanup leftover "#if 0" clause

Change-Id: Ie1bb672b4b3b617017e08b68c73c2c8c361fa00a
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agotools/mesh-cfgclient: Add address checks for pub/sub commands 47/228947/1
Inga Stotland [Mon, 2 Mar 2020 20:40:29 +0000 (12:40 -0800)]
tools/mesh-cfgclient: Add address checks for pub/sub commands

This addrs verification of subscriptpion address value entered on
the command line: unassigned address, unicast address, and
all-nodes address are not allowed. Publication address check verifies
that the entered value falls into mesh address space.

Also, change the type of parameter count in comaand processing routines
from int to uint32_t to match the retrun type of the parameter parsing
routine.

Change-Id: Ib5747a132e59e4af5f21dbad5319167234230548
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Remove unused parameters from internal rx functions 46/228946/1
Inga Stotland [Thu, 27 Feb 2020 06:56:07 +0000 (22:56 -0800)]
mesh: Remove unused parameters from internal rx functions

This removes unused ttl parameter from mesh_model_rx(). The TTL value
is not processed at the access layer, so there is no need to pass it
to a model.
Also, remove "uint32_t dst" parameter from the typedef of
mesh_model_recv_cb: providing a just destination address is sufficient
for internally implemented models (currently, it's only Config Server)

Change-Id: I603aa23a495a40bb804e0a370331d1efd8508270
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agotest/test-mesh: Fix output of UpdateModelConfig method 45/228945/1
Inga Stotland [Tue, 25 Feb 2020 18:44:18 +0000 (10:44 -0800)]
test/test-mesh: Fix output of UpdateModelConfig method

This correctly unpacks configuration dictionary received
in the UpdateModelConfig() method

Change-Id: If7ca5d0b2249508bb0df4a0cc7f78d74da8e30bc
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Clean up handling config model publication message 44/228944/1
Inga Stotland [Tue, 25 Feb 2020 18:44:17 +0000 (10:44 -0800)]
mesh: Clean up handling config model publication message

This tightens up the Config Server code that handles the processing of
Config Model Publication Set and Config Model Publication Get messages.

Change-Id: I3ce67395f0a092e37f0e8f2396092b13ff53ac20
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Simplify model virtual pub/sub logic 43/228943/1
Inga Stotland [Tue, 25 Feb 2020 18:44:16 +0000 (10:44 -0800)]
mesh: Simplify model virtual pub/sub logic

This reorganizes the part of the code that handles model publishing
and subscribitng to virtual labels.

Change-Id: I4780c38113b64967ed555ef8172b15e98cab3ed3
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agotools/mesh-cfgclient: Save and restore group addresses 42/228942/1
Inga Stotland [Tue, 25 Feb 2020 18:44:15 +0000 (10:44 -0800)]
tools/mesh-cfgclient: Save and restore group addresses

This allows to save created virtual labels and group addresses
in configuration file. The stored values can be restored upon
the tool start up.

Change-Id: Idd28a88e47f1401f488bd770ce6c9940fdb39bd0
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agotools/mesh-cfgclient: Clean up subscription list output 41/228941/1
Inga Stotland [Tue, 25 Feb 2020 18:44:14 +0000 (10:44 -0800)]
tools/mesh-cfgclient: Clean up subscription list output

This tightens up the subscritpiton list status print out:
use the same function for vendor and SIG models.

Change-Id: Ifc6dac0152c6b62cbcaf6b0648c42bb822274401
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agotools/mesh-cfgclient: Add support for virtual labels 40/228940/1
Inga Stotland [Tue, 25 Feb 2020 18:44:13 +0000 (10:44 -0800)]
tools/mesh-cfgclient: Add support for virtual labels

This adds commands to generate and use virtual addresses for
configuring remote node's publication and subscription.

New commands:
virt-add - generate a new label and calculate virtual address
group-list - displays group addresses that are in use and available
             virtual labels with corresponding virtual addresses

Change-Id: I823786d050673491739d895461d8b564c757ee6b
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: rework incoming advertisement filtering 39/228939/1
Brian Gix [Sun, 23 Feb 2020 18:47:37 +0000 (10:47 -0800)]
mesh: rework incoming advertisement filtering

Future versions of Mesh will introduce new advertising packets, which
do not fit in the limited and rigid filtering currently used. This minor
rewrite allows registering and receiving of *any* AD types, including
the filtering on multiple octets of the incoming AD parts.

Change-Id: I36c8f673100afbfd3738d9e243020f13064c7262
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Fix app payload decryption for virtual labels 38/228938/1
Inga Stotland [Tue, 18 Feb 2020 19:30:10 +0000 (11:30 -0800)]
mesh: Fix app payload decryption for virtual labels

This fixes a bug when a virtual label and its size hasn't been passed
to a decryption function: instead of always using NULL pointer for
label and 0 for lable size, use actual virtual label info if decrypting
a payload addressed to a virtual destination.

Change-Id: Ica8abfd453aa4085998c00725f4bf23146d9a5dd
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agounit: Add Mesh test 8.3.22 - Virtual Addressing 37/228937/1
Brian Gix [Tue, 18 Feb 2020 18:34:36 +0000 (10:34 -0800)]
unit: Add Mesh test 8.3.22 - Virtual Addressing

Change-Id: I7a4bfaed4f961466c3eb81b0f46cc8643169c495
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agotest/test-mesh: Fix output of MessageReceived method 36/228936/1
Inga Stotland [Tue, 18 Feb 2020 07:52:08 +0000 (23:52 -0800)]
test/test-mesh: Fix output of MessageReceived method

This fixes formatted output of recieved message parameters.

Change-Id: I3df227d548ed9f99c806c6b5fec264555fee5d2f
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Fix keyring app keys directory iteration 35/228935/1
Inga Stotland [Fri, 7 Feb 2020 06:39:45 +0000 (22:39 -0800)]
mesh: Fix keyring app keys directory iteration

This fixes how app key files are accessed when finalizing
Key Refresh procedure. Instead of using open(entry->d_name, ...)
to get file descriptor, use openat(dir_fd, entry->d_name, ...)
since entry->d_name contains a relative app key filename, not an
absolute path.

Change-Id: I943a3b180ed8425d3437a659c50461e167353bfd
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Allow to finish key refresh when no AppKeys are stored 34/228934/1
Inga Stotland [Wed, 5 Feb 2020 22:53:43 +0000 (14:53 -0800)]
mesh: Allow to finish key refresh when no AppKeys are stored

This handles a case when a Key Refresh procedure is in place with
no application keys stored in the keyring. When KR procedure is
finalized, the check for the presence of AppKeys storage directory
does not return failure if the directory does not exist.

Also, remove duplicate include.

Change-Id: I1ca58e5b4f06acf8ef17e8eb0ac0afa3f7decd70
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agoPrevent the exception case in GATT connect 48/228548/1
DoHyun Pyun [Tue, 24 Mar 2020 01:10:36 +0000 (10:10 +0900)]
Prevent the exception case in GATT connect

If kernel's crypto API does not work, we can't use
GATT database hash. So we add the exception case
for this.

Change-Id: Id4e5e9b7ff814aedd3f3e43d689ced3be8ee25dd
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
4 years agoGATT: Ignore svc changed indication before starting full scan 05/228405/1
injun.yang [Mon, 16 Mar 2020 05:58:14 +0000 (14:58 +0900)]
GATT: Ignore svc changed indication before starting full scan

[Model] All
[BinType] AP
[Customer] OPEN

[Issue#] N/A
[Request] Internal
[Occurrence Version] N/A

[Problem] Service discovery failed
[Cause & Measure] When gatt connected, bluez start full discovery.
 Duplicated svc disvovery is not required
[Checking Method] OOBE connection with iPhone 6 > turn off iPhone BT off & on

[Team] Convergence BT
[Developer] Injun Yang
[Solution company] Samsung
[Change Type] Specification change

Change-Id: I86f326c48c86e4456bd9fa043994f0d32849e2b2

4 years agoFix stack smashing detected issue 04/228304/6
Wootak Jung [Fri, 20 Mar 2020 06:41:32 +0000 (15:41 +0900)]
Fix stack smashing detected issue

le_conn_param data should be filled as a uint16 not uint32.
it can cause stack overflow.

 #3  0xf7233a70 in __GI___fortify_fail_abort (need_backtrace=
     need_backtrace@entry=false, msg=0xf72741cc "stack smashing detected")
     at fortify_fail.c:28
 No locals.
 #4  0xf7233a34 in __stack_chk_fail () at stack_chk_fail.c:29
 No locals.
 #5  0x00958f88 in update_le_conn_parm (conn=<optimized out>, msg=0x0,
     user_data=<optimized out>) at src/device.c:4216
         device = <optimized out>
         io = <optimized out>
         fd = <optimized out>
         param = {min = 72, max = 72, latency = 0, to_multiplier = 200}
         __func__ = "update_le_conn_parm"

Change-Id: Ia0df33fc30e31057ef4b2a07a0ac64d61d67dd81

4 years agoFix a2dp source role connnection issue 83/228083/1 accepted/tizen/unified/20200319.232430 submit/tizen/20200319.092128
Wootak Jung [Thu, 19 Mar 2020 03:14:23 +0000 (12:14 +0900)]
Fix a2dp source role connnection issue

selected_sep should be initialized

Change-Id: Icb6f4f3a5ab0d47b051d86c5af1df706ec298600

4 years agoDon't use the dbus auto-activation in TV profile 21/226721/1 accepted/tizen/unified/20200306.040256 submit/tizen/20200305.052643
DoHyun Pyun [Thu, 5 Mar 2020 05:20:05 +0000 (14:20 +0900)]
Don't use the dbus auto-activation in TV profile

Change-Id: I80fb8575c5f7228d45b4119f3bf8b79e7a7f90a7
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
4 years agoFix : slave long term key is not loaded 72/226572/2 accepted/tizen/unified/20200305.123315 submit/tizen/20200304.063814
injun.yang [Tue, 3 Mar 2020 08:47:28 +0000 (17:47 +0900)]
Fix : slave long term key is not loaded

[Model] All
[BinType] AP
[Customer] OPEN

[Issue#] N/A
[Request] Internal
[Occurrence Version] N/A

[Problem] Request LE pairing again to paired device.
[Cause & Measure] After BT off/on, slave long term key is not loaded.
[Checking Method] Test with iOS GM

[Team] Convergence BT
[Developer] Injun Yang
[Solution company] Samsung
[Change Type] Specification change

Change-Id: I4191331b69b892891e02f904554eb7733e3eabe6

4 years agoWhile LE scanning, send first RPA instead of IDA 45/226445/1
injun.yang [Wed, 26 Feb 2020 11:16:02 +0000 (20:16 +0900)]
While LE scanning, send first RPA instead of IDA

[Model] All
[BinType] AP
[Customer] OPEN

[Issue#] N/A
[Request] Internal
[Occurrence Version] N/A

[Problem] Durning LE scanning, unable to find a paired RPA device
[Cause & Measure] Bluez report it as IDA instead of PRA. Handle it as RPA
[Checking Method] LE scan for paired RPA device

[Team] Convergence BT
[Developer] Injun Yang
[Solution company] Samsung
[Change Type] Specification change

Change-Id: I890fda13825172f759d4f4f317dfd053504c4c4b
Signed-off-by: injun.yang <injun.yang@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
4 years agoUpdate the version to 5.52 04/226304/1 accepted/tizen/unified/20200302.125812 submit/tizen/20200302.000010
DoHyun Pyun [Sun, 1 Mar 2020 23:50:25 +0000 (08:50 +0900)]
Update the version to 5.52

Change-Id: I61221e0254289d2e68fa1f14bfa29008387118db
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
4 years agoInitialize AVC volume in SINK reconnecting time 56/225956/3 submit/tizen/20200226.220348
DoHyun Pyun [Wed, 26 Feb 2020 00:05:04 +0000 (09:05 +0900)]
Initialize AVC volume in SINK reconnecting time

Change-Id: Id566b529ac352b1d3120f5295414534c928bbf74
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
4 years agoAVC : prevent ear-shock sound 55/225955/1
Sangki Park [Fri, 21 Jun 2019 02:22:12 +0000 (11:22 +0900)]
AVC : prevent ear-shock sound

[Model] Renaissance
[BinType] AP
[Customer] ALL

[Issue#] N/A
[Request] N/A
[Occurrence Version] N/A

[Problem] N/A
[Cause & Measure] N/A
[Checking Method] N/A

[Team] Bluetooth
[Developer] Sangki Park
[Solution company] Samsung
[Change Type] Specification change

Change-Id: If6adfdeab296821d4e6409685fcdbb0c73bebbcc

4 years agoCheck AVRCP volume gain when A2DP connected 54/225954/1
Sangki Park [Tue, 18 Jun 2019 09:11:03 +0000 (18:11 +0900)]
Check AVRCP volume gain when A2DP connected

[Model] Renaissance
[BinType] AP
[Customer] ALL

[Issue#] Internal
[Request] N/A
[Occurrence Version] N/A

[Problem] If AVRCP connection is made before A2DP connection,
 the AVC volume gain could not be set because of no transport device.
 To fix the problem, check AVRCP AVC volume when A2DP is connected.
[Cause & Measure] N/A
[Checking Method] N/A

[Team] Bluetooth
[Developer] Sangki Park
[Solution company] Samsung
[Change Type] Specification change

Change-Id: I65dd03a4192fcaec35da3d2a5dad0d62fa4c5f3e

4 years agoMerge "Send the positive response for AVRCP_EVENT_VOLUME_CHANGED" into tizen
Pyun DoHyun [Tue, 25 Feb 2020 01:57:18 +0000 (01:57 +0000)]
Merge "Send the positive response for AVRCP_EVENT_VOLUME_CHANGED" into tizen

4 years agoFix: background gatt connection is not working 23/225823/1
injun.yang [Mon, 24 Feb 2020 08:11:42 +0000 (17:11 +0900)]
Fix: background gatt connection is not working

[Model] All
[BinType] AP
[Customer] OPEN

[Issue#] N/A
[Request] Internal
[Occurrence Version] N/A

[Problem] background gatt connection is not working
[Cause & Measure] If auto_connect is true, initiate background auto connection
 and reply dbus to bt-service
[Checking Method] background gatt auto connection

[Team] Convergence BT
[Developer] Injun Yang
[Solution company] Samsung
[Change Type] Specification change

Change-Id: Ie9f0887774a9e46a26a209d11cbca70298379489

4 years agoSend the positive response for AVRCP_EVENT_VOLUME_CHANGED 38/225738/1 submit/tizen/20200225.002806
DoHyun Pyun [Mon, 24 Feb 2020 07:27:50 +0000 (16:27 +0900)]
Send the positive response for AVRCP_EVENT_VOLUME_CHANGED

Change-Id: If243d77e095b607052d17d93616b0d0711d724a7
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
4 years agoDon't set the system volume in AVC Target mode 65/225565/1 accepted/tizen/unified/20200225.224413 submit/tizen/20200224.010600 submit/tizen/20200224.010745 submit/tizen/20200225.003144
DoHyun Pyun [Fri, 21 Feb 2020 03:44:37 +0000 (12:44 +0900)]
Don't set the system volume in AVC Target mode

Change-Id: I8aaf66d7f9fdc5945d06d8607b4a75c3151bb195
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
4 years agoFix the get / set property fail issue for transport 14/225414/1 submit/tizen/20200220.012900 submit/tizen/20200220.013347
DoHyun Pyun [Wed, 19 Feb 2020 02:06:53 +0000 (11:06 +0900)]
Fix the get / set property fail issue for transport

Change-Id: I0452c2df36a20e74faa6d47f356082a9ffb61c63
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
4 years agoMerge branch 'bluez_upgrade_5.52' into tizen 64/225064/1
DoHyun Pyun [Mon, 17 Feb 2020 06:28:27 +0000 (15:28 +0900)]
Merge branch 'bluez_upgrade_5.52' into tizen

Change-Id: I8de9bd87762d3e985f2e9209170e65fd6c64d6c6

4 years agoApply secure log to uinput path
Deokhyun Kim [Thu, 6 Feb 2020 11:27:26 +0000 (20:27 +0900)]
Apply secure log to uinput path

<6>[  712.832464]  [1:     bluetoothd: 4557] input: 64:7B:XX:XX:5A:71 as /devices/virtual/input/input6

Change-Id: I68dfc2f3362f03036d4a99a15906a95482b70354
Signed-off-by: Deokhyun Kim <dukan.kim@samsung.com>
4 years agoMerge branch 'bluez_upgrade_5.52' of https://review.tizen.org/gerrit/p/platform/upstr...
himanshu [Wed, 12 Feb 2020 07:29:37 +0000 (12:59 +0530)]
Merge branch 'bluez_upgrade_5.52' of https://review.tizen.org/gerrit/p/platform/upstream/bluez into bluez_upgrade_5.52

4 years agoRelease 5.52
Marcel Holtmann [Thu, 31 Oct 2019 06:58:44 +0000 (07:58 +0100)]
Release 5.52

Change-Id: Ia68e20375186874b3c18ec7a8941c40433f713a5
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agobuild: Move $(UDEV_CFLAGS) to global $(AM_CFLAGS)
Marcel Holtmann [Mon, 3 Dec 2018 18:47:20 +0000 (19:47 +0100)]
build: Move $(UDEV_CFLAGS) to global $(AM_CFLAGS)

Change-Id: Iffd8d88092266bc4afdecda9da7a9dcb48bc2c78
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agobuild: make building with --coverage work again
Jan Engelhardt [Wed, 28 Nov 2018 15:45:14 +0000 (16:45 +0100)]
build: make building with --coverage work again

When `./configure --enable-coverage` is given and lcov is present,
MISC_CFLAGS and MISC_LDFLAGS will be set to --coverage. However,

1. obexd uses per-target LDFLAGS and, in doing so, forget to re-mention
$(AM_LDFLAGS). This problem existed for a long time.

2. obexd uses per-target CFLAGS and, in doing so, forgot to re-mention
$(AM_CFLAGS). This got broken in 06dbb223fbe50acc48b3ba1d33cb424275b4baaa.

This led to no --coverage showing up in the linker line for obexd,
causing a link failure indicating unresolved symbols like
__gcov_exit.

Change-Id: I4aca476dd36f1ddc960f8f3c85cb615f9e2d36d3
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agobuild: add missing BACKTRACE_CFLAGS
Jan Engelhardt [Sun, 25 Nov 2018 09:20:12 +0000 (10:20 +0100)]
build: add missing BACKTRACE_CFLAGS

Some targets use BACKTRACE_LIBS, hence need BACKTRACE_CFLAGS.

Change-Id: I1862e2e3f649183f170e102b384e7eec90bcc9a6
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agobuild: -D/-I arguments go into CPPFLAGS
Jan Engelhardt [Sun, 25 Nov 2018 09:20:08 +0000 (10:20 +0100)]
build: -D/-I arguments go into CPPFLAGS

-D and -I are preprocessor directives, they are therefore to appear
in CPPFLAGS, not CFLAGS. (It is unfortunate that pkg-config does not
make the distinction / or it was misnamed, because only -D/-I make
sense to be emitted by pkg-config in the first place — anything else
(-f/-m) has the potential to mess up someone's compilation. So
pkg-config's Cflags is actually used to convery Cppflags.)

Change-Id: I7031834ae2d9446367ce02ca78be9842dece0683
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoFix: Bluez build Failure because of wrong libexecdir value
himanshu [Tue, 11 Feb 2020 05:12:47 +0000 (10:42 +0530)]
Fix: Bluez build Failure because of wrong libexecdir value

This Fix is needed because the libexecdir was replaced with
pkglibexecdir in the following upstream patch.

Commit ID - 78bce480093799c287ac8561b9407fa48796a130

Change-Id: I42905c94a6db3496b017d8b3faf394f8c749cda5
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agobuild: rename libexecdir to pkglibexecdir
Jan Engelhardt [Sun, 18 Nov 2018 16:07:55 +0000 (17:07 +0100)]
build: rename libexecdir to pkglibexecdir

When files are to be placed not in libexecdir but a subdirectory of
it, automake has a variable name reserved for exactly that purpose
(and a default value, which Makefile.am will override), called
pkglibexecdir. Let's use it.

Change-Id: I8b4e271814ab998a7eccaf5c3c2ac3ddc539a6df
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoFix: Bluez multiple build Fail issues.
himanshu [Mon, 10 Feb 2020 08:46:10 +0000 (14:16 +0530)]
Fix: Bluez multiple build Fail issues.

Change-Id: Ib8d6e774f9526cf21db1d9de1d26b4dabd0bf9a9
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agocore: Remove old code related to sd_notify
Luiz Augusto von Dentz [Mon, 26 Nov 2018 15:56:03 +0000 (17:56 +0200)]
core: Remove old code related to sd_notify

This is no longer needed since mainloop instances can handle it now.

Change-Id: Iec185750e3cab2cb90f15ab0dc8849cf9c4f3e9f
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agobuild: Require at least version 0.26 when building with external ELL
Marcel Holtmann [Thu, 31 Oct 2019 06:35:28 +0000 (07:35 +0100)]
build: Require at least version 0.26 when building with external ELL

Change-Id: I7e10746eb3c2e84527db70722fa2c35e781ad101
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agotools: Add utitlity for analyzing Broadcom HCD firmware files
Marcel Holtmann [Mon, 4 Jun 2018 19:06:56 +0000 (21:06 +0200)]
tools: Add utitlity for analyzing Broadcom HCD firmware files

Change-Id: Ia5d4ba6388a3f822f54bde8295cdc09c05a49dba
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agobuild: Enable BIND_NOW
Florian Weimer [Thu, 9 May 2019 12:37:41 +0000 (14:37 +0200)]
build: Enable BIND_NOW

Partial RELRO means that the object is GNU_RELRO but not BIND_NOW.  This
reduces the effectiveness of RELRO.  bluez triggers this because it
enables PIE during the build, and rpmdiff takes this as an indicator
that the best possible hardening is desired.

https://bugzilla.redhat.com/show_bug.cgi?id=983161

Change-Id: I09d90d9b2ce3fa13a0ec220b83ca141301e7a72b
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agobuild: Add a few default configure options
Bastien Nocera [Thu, 9 May 2019 12:37:39 +0000 (14:37 +0200)]
build: Add a few default configure options

Add 3 optional features that are currently used and distributed in
the Fedora packages to the default build configuration.

The additional build time is minimal, and it ensures that the build
gets maximum coverage.

Change-Id: I282d3d84d59923076d6e1834d0876b3533d02e4b
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agobuild: add missing UDEV_CFLAGS
Jan Engelhardt [Sun, 25 Nov 2018 09:20:10 +0000 (10:20 +0100)]
build: add missing UDEV_CFLAGS

Some targets link UDEV_LIBS, which means they also need UDEV_CFLAGS
in their (or the global) CPPFLAGS.

Change-Id: I0923d445a4d2b63eb991e7225fc5c5c11dee6265
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agobuild: add missing ALSA_CFLAGS
Jan Engelhardt [Sun, 25 Nov 2018 09:20:11 +0000 (10:20 +0100)]
build: add missing ALSA_CFLAGS

Some targets use ALSA_LIBS, hence need ALSA_CFLAGS.

Change-Id: I47cfd15ad2da2b71af21469089a86a5fe05a4e4d
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agobuild: -l arguments to belong into LDADD/LIBADD not LDFLAGS
Jan Engelhardt [Sun, 25 Nov 2018 09:20:07 +0000 (10:20 +0100)]
build: -l arguments to belong into LDADD/LIBADD not LDFLAGS

It is an error to put -l arguments into LDFLAGS, because the linker
command line is order-sensitive and libs must appear in certain
places. For this, automake has the LDADD/LIBADD.

Change-Id: I19de36547008f1c4cc21e31c746d0f62c9d815d5
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agobuild: change @foo@ to $(foo) in automake makefiles
Jan Engelhardt [Sun, 25 Nov 2018 09:20:06 +0000 (10:20 +0100)]
build: change @foo@ to $(foo) in automake makefiles

When using automake, all AC_SUBSTed variables are made available as
make variables, so that they can also be set at make time. Therefore,
they need not use the @harcoded@ style.

Change-Id: I92f5421de3567e27c3a38abb0b165bc7f0e46eb3
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agomonitor: Add support for reading over J-Link RTT
Andrzej Kaczmarek [Tue, 20 Feb 2018 14:52:49 +0000 (15:52 +0100)]
monitor: Add support for reading over J-Link RTT

This patch adds support for reading data over J-Link RTT. It can be
used as replacement for TTY when reading from embedded devices since
it's much faster and does block a UART. Data format is the same as
for TTY. At the moment monitor over RTT is only supported by Apache
Mynewt project.

Reading data is done by polling RTT every 1 msec since there is no
blocking API to read something from RTT buffer.

To enable reading from RTT, J-Link configuration needs to be passed via
command line (all parameters except <device> can be skipped to use
default value):
  -J <device>,<serialno=0>,<interface=swd>,<speed=1000>
  -J nrf52,683649029

In some cases J-Link cannot locate RTT buffer in RAM. In such case
RAM area and buffer name should be provided via command line:
  -R <address=0x0>,<area=0x1000>,<buffer=monitor>
  -R 0x20000000,0x10000

Change-Id: Ic9023663c0c3c2bc5bf3b06e702734fffbbf3baa
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agomonitor: Add interface for J-Link library
Andrzej Kaczmarek [Tue, 20 Feb 2018 14:55:52 +0000 (15:55 +0100)]
monitor: Add interface for J-Link library

This adds simple interface to libjlinkarm.so which will be used to read
data from RTT buffer. It was mostly made by trial and error since there
is no public documentation for this library so it may lack something,
but seems to work fine with few Cortex-M devices I tried.

Change-Id: Iaa326544843c705c3dd84344bd505aa5fed310f1
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agomonitor: Consolidate code printing bitfield
Luiz Augusto von Dentz [Mon, 2 Jul 2018 13:49:12 +0000 (16:49 +0300)]
monitor: Consolidate code printing bitfield

This reduces the duplicated code around printing bitfields.

Change-Id: I1d1323c33f5427b245f142f9607b4b56ac8cb43f
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agobtmgmt: Add support for setting PHY in add-adv
Jaganath Kanakkassery [Thu, 14 Jun 2018 12:21:19 +0000 (17:51 +0530)]
btmgmt: Add support for setting PHY in add-adv

Change-Id: Ibb2bc77463913a87edc44d36d29b2646efe54388
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoFix: assuming writes to CCC will always contain 2 bytes.
himanshu [Thu, 30 Jan 2020 09:35:25 +0000 (15:05 +0530)]
Fix: assuming writes to CCC will always contain 2 bytes.

This change is because of the following
upstream patch.

Commit ID - e60a6b7d9d0fa55fda5cd0457f6c763078949d87

In order to sync the Tizen code with the upstream
this patch is necessary.

Change-Id: I2e5350d999445366784ef5547a2390047998badb
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoFix: Change the parse_options function call in TIZEN_FEATURE_BLUEZ_MODIFY tag
himanshu [Thu, 30 Jan 2020 06:50:59 +0000 (12:20 +0530)]
Fix: Change the parse_options function call in TIZEN_FEATURE_BLUEZ_MODIFY tag

This change is because of the implementation of
type option in Characteristic.WriteValue

This change was introduced in the following
upstream patch.

Commit ID - aa9f9b193c51d371b5d2a863f35a034ee0377b22

In order to sync the TIZEN CODE with the upstream
this fix is needed.

Change-Id: I5ed1359a4fb3b704b8d33d540bb0d5956fb93ebb
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoFix: Bluez crash while making a2dp connection
himanshu [Wed, 29 Jan 2020 07:07:39 +0000 (12:37 +0530)]
Fix: Bluez crash while making a2dp connection

As the a2dp_sep struct in the a2dp_find_eps
function has been changed to queue in the
BlueZ 5.52 Release,therefore the necessary
change was needed in the TIZEN_MODIFY code.

Change-Id: I9bdb50b341356abd845ff8e3ab9a446991b25091
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agotools: Fix compiler warning
Szymon Janc [Wed, 13 Jun 2018 00:19:33 +0000 (02:19 +0200)]
tools: Fix compiler warning

Change-Id: Iebe47dd0a045e4066a546a13cbb7c601528aa5a7
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agogatt: Fix assuming writes to CCC will always contain 2 bytes
Luiz Augusto von Dentz [Fri, 6 Sep 2019 11:52:34 +0000 (14:52 +0300)]
gatt: Fix assuming writes to CCC will always contain 2 bytes

The spec actually allows writing just 1 byte:

BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 3, Part F
page 2320:

  'If the attribute value has a fixed length and the Attribute Value
   parameter length is less than or equal to the length of the attribute
   value, the octets of the attribute value parameter length shall be
   written; all other octets in this attribute value shall be
   unchanged.'

Change-Id: I845531fbd44262a5ab29c2353f63c16ed98480bc
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoclient: Add type to write command
Luiz Augusto von Dentz [Mon, 11 Feb 2019 09:29:21 +0000 (11:29 +0200)]
client: Add type to write command

This enables setting the write type as optional third parameter:

write <data=xx xx ...> [offset] [type]

The type can be used to force a specific procedure to be used, for
example to force reliable writes one can enter:

> write 00 0 reliable

Change-Id: I4e74cff3cd2a38f07b36e09716023810e641c136
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agogatt: Implement "type" option for Characteristic.WriteValue
Luiz Augusto von Dentz [Wed, 6 Feb 2019 14:49:03 +0000 (16:49 +0200)]
gatt: Implement "type" option for Characteristic.WriteValue

This implements the "type" option as documented.

Change-Id: Ib3f73e27b13161c0ed44dd00bb4ad0a28e75e79a
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agodoc/gatt-api: Add "type" option to Characteristic.WriteValue
Luiz Augusto von Dentz [Wed, 6 Feb 2019 14:45:07 +0000 (16:45 +0200)]
doc/gatt-api: Add "type" option to Characteristic.WriteValue

The option "type" can be used to force a certain procedure to be used:
  - "command": Use Write Without Response procedure
  - "request": Use (Long) Write With Response procedure
  - "reliable"" Use Reliable Write procedure

Change-Id: I418a58273d60a1383fd1cc1df50318098f79550c
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agotools: Adjust for changed l_dbus_object_manager_enable parameters
Marcel Holtmann [Thu, 31 Oct 2019 06:34:15 +0000 (07:34 +0100)]
tools: Adjust for changed l_dbus_object_manager_enable parameters

Change-Id: I986d70468d8f2995fb640fb083dd2f735fce11cd
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoa2dp: Remove experimental flag for remote MediaEndpoint
Luiz Augusto von Dentz [Fri, 18 Oct 2019 10:51:54 +0000 (13:51 +0300)]
a2dp: Remove experimental flag for remote MediaEndpoint

This makes the MediaEndpoint and stable API for remote endpoints which
aligns with RegisterApplication API which is already stable.

Change-Id: I8469aa2926289d1c68f69d2442acb0c17f2d36ec
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agomonitor: Extract TTY data processing to separate function
Andrzej Kaczmarek [Tue, 20 Feb 2018 14:52:10 +0000 (15:52 +0100)]
monitor: Extract TTY data processing to separate function

Change-Id: I8c597727451b1f3ed9ae452bcef885492bf12ca4
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoaudio: Fix cancelling disconnect timeout
Luiz Augusto von Dentz [Fri, 11 Oct 2019 12:40:04 +0000 (15:40 +0300)]
audio: Fix cancelling disconnect timeout

If AVDTP session has been connected but no stream has been setup calls
to service->connect would return -EBUSY to avoid stream setup collision
but it also takes a reference to the session cancelling the disconnect
timeout and disabling the stream_setup logic that would attempt to
estabilish a stream.

Change-Id: I47a87aeb77429441b7470ff26ef9a9a2d0c54b43
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoMakefile.am: add missing mkdir in rules generation
Ross Burton [Tue, 8 Oct 2019 10:01:56 +0000 (11:01 +0100)]
Makefile.am: add missing mkdir in rules generation

In parallel out-of-tree builds it's possible that tools/*.rules are
generated before the target directory has been implicitly created. Solve this by
creating the directory before writing into it.

Change-Id: Id9ad0802138cd89c64d339fd8ca202d6f5416f98
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoMakefile.obexd: add missing mkdir in builtin.h generation
Ross Burton [Tue, 8 Oct 2019 09:58:32 +0000 (10:58 +0100)]
Makefile.obexd: add missing mkdir in builtin.h generation

In parallel out-of-tree builds it's possible that obexd/src/builtin.h is
generated before the target directory has been implicitly created. Solve this by
creating the directory before writing into it.

Change-Id: I13dd701cc1ab160f71a12ee6cb46359c69da0d23
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoRelease 5.51
Marcel Holtmann [Thu, 19 Sep 2019 17:57:40 +0000 (19:57 +0200)]
Release 5.51

Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agobuild: Update library version
Marcel Holtmann [Thu, 19 Sep 2019 17:36:43 +0000 (19:36 +0200)]
build: Update library version

Change-Id: Idd899dc4dfd3a15d03053d614ea9e70882946c55
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agomonitor: Decode L2CAP channel mode
Luiz Augusto von Dentz [Fri, 13 Sep 2019 10:54:07 +0000 (13:54 +0300)]
monitor: Decode L2CAP channel mode

This decodes the L2CAP channel mode of each frame:

> ACL Data RX: Handle 3585 flags 0x02 dlen 12
      Channel: 64 len 8 [PSM 127 mode Basic (0x00)] {chan 0}
< ACL Data TX: Handle 3585 flags 0x00 dlen 9
      Channel: 65 len 5 sdu 3 [PSM 127 mode LE Flow Control (0x80)] {chan 1}

Change-Id: I45d093dbb336b00e16c96bc99d3c693d416563c2
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agomonitor: Add proper decoding of LE flowctl mode
Luiz Augusto von Dentz [Fri, 13 Sep 2019 07:08:13 +0000 (10:08 +0300)]
monitor: Add proper decoding of LE flowctl mode

This enables decoding LE flowctl mode properly and print out the
SDU.

Change-Id: I3bb08559418dc353de06b979c1c4dc86c3998069
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agodoc: Remove uneeded dbus API for App Key Refresh
Brian Gix [Fri, 6 Sep 2019 16:24:33 +0000 (09:24 -0700)]
doc: Remove uneeded dbus API for App Key Refresh

Change-Id: I6a3dac56c911d2234dd8513828d49ef325fb6d0c
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoshared/shell: fix help message typo
Ronan Pigott [Wed, 14 Aug 2019 23:00:34 +0000 (16:00 -0700)]
shared/shell: fix help message typo

Change-Id: Ibe8b83dca57b93dc937ecc77c938b6c6c6819a28
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agocompletion: add bluetoothctl zsh completions
Ronan Pigott [Sat, 17 Aug 2019 06:34:51 +0000 (23:34 -0700)]
completion: add bluetoothctl zsh completions

This zsh compdef provides completions for the bluetoothctl command.

It has been modified from version 1 of this patch to get the command
names and descriptions from the newly introduced --zsh-complete.

It utilizes the output of `bluetoothctl devices` or
`bluetoothctl controllers` to provide a descriptive completion menu
in those contexts.

e.g.

$ bluetoothctl connect <TAB>
04:52:C7:0C:D4:A7  -- Bose QuietComfort 35
40:4E:36:D9:8F:28  -- Pixel 2
A4:38:CC:20:5D:E0  -- Pro Controller

Change-Id: Ib06fa64d1cf86b6bc6439d6f99ef36d042ed3ec1
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoshared/shell: add --zsh-complete option
Ronan Pigott [Sat, 17 Aug 2019 06:34:50 +0000 (23:34 -0700)]
shared/shell: add --zsh-complete option

This adds a new long form option --zsh-complete to provide all available
commands in an output format suitable for parsing by zsh or other shell
completion scripts.

Invoke like: `bluetoothctl --zsh-complete help`

There is no corresponding short form option.

Change-Id: Idafb56b224f92a786223e43cae63babd1740834c
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoclient/main: add help option for available args
Ronan Pigott [Sat, 17 Aug 2019 06:34:49 +0000 (23:34 -0700)]
client/main: add help option for available args

This option exists to facilitate external completion of commands that
have specially defined arguments. It effectively adds two new commands
to bluetoothctl with the following output:

$ bluetoothctl agent help
on
off
DisplayOnly
DisplayYesNo
KeyboardDisplay
KeyboardOnly
NoInputNoOutput

$ bluetoothctl advertise help
on
off
peripheral
broadcast

Shell completion scripts can then parse this output to provide
completions for those commands.

Change-Id: Ia431ea11d7a1cb344b512f0180bd0ebac0754567
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoshared/gatt-client: Automatically add CCC when discovering
Luiz Augusto von Dentz [Mon, 26 Aug 2019 11:51:44 +0000 (14:51 +0300)]
shared/gatt-client: Automatically add CCC when discovering

The spec mandates that a CCC exists if either notify or indicate
property is marked:

BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 3, Part G page 2357

  "If set, the Client Characteristic Configuration Descriptor shall
  exist."

Change-Id: Ib588c87cc3be81e439ff8f7678b7e451b5c34825
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agotools: Tweak script to get Company IDS from SIG
Brian Gix [Tue, 20 Aug 2019 19:44:55 +0000 (12:44 -0700)]
tools: Tweak script to get Company IDS from SIG

The Bluetooth SIG website requires a trailing "/" on the web page for
the curl command to work.

Change-Id: Ie18c0711d52335d6df2a6bfb08e2bc84e37545e4
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoclient: Fix not able to select attributes if parent exists
Luiz Augusto von Dentz [Tue, 20 Aug 2019 10:40:10 +0000 (13:40 +0300)]
client: Fix not able to select attributes if parent exists

When selecting attributes by UUID the code was not checking attributes
that are not a children of the current selected attribute.

Change-Id: If08b0bc5b7e9c36931585fb3f18f35c9db2616ab
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoclient: Allow UUID 16 bits on select-attribute
Luiz Augusto von Dentz [Tue, 20 Aug 2019 10:38:54 +0000 (13:38 +0300)]
client: Allow UUID 16 bits on select-attribute

This allow passing UUIDs on 16 bits format.

Change-Id: I974ab05787c241cff05b344efba70683b96d679f
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agotest: Add example-player
Luiz Augusto von Dentz [Fri, 12 Jul 2019 15:10:13 +0000 (18:10 +0300)]
test: Add example-player

This adds an example of registering a player with use of
RegisterApplication.

Change-Id: I3abaf08554f34062befe3f1a3dfcda0b633481f2
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agotest: Add example-endpoint
Luiz Augusto von Dentz [Fri, 12 Jul 2019 12:24:16 +0000 (15:24 +0300)]
test: Add example-endpoint

This adds an example of registering an endpoint with use of
RegisterApplication.

Change-Id: I6667abb66b7ee6986fcae90cdc18793d0f0fbd01
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agomedia: Add implementation of RegisterApplication
Luiz Augusto von Dentz [Thu, 11 Jul 2019 13:38:58 +0000 (16:38 +0300)]
media: Add implementation of RegisterApplication

This implements RegisterApplication registering any proxy which does
implement either MediaEndpoint or MediaPlayer.

Change-Id: Ib6bab82176f9941662511f47facc4f8d1f3d31e4
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agodoc/media-api: Add RegisterApplication method
Luiz Augusto von Dentz [Thu, 11 Jul 2019 13:36:28 +0000 (16:36 +0300)]
doc/media-api: Add RegisterApplication method

This uses application ObjectManager to discover the MediaEndpoint and
MediaPlayer object of an application and deprecates the use of
RegisterEndpoint and RegisterPlayer.

Change-Id: Ieb647e431ea32fc5934de3b84098c9a171f990e6
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoinput/hog: Remove HID device after HoG device disconnects
Benjamin Tissoires [Fri, 14 Jun 2019 15:31:25 +0000 (17:31 +0200)]
input/hog: Remove HID device after HoG device disconnects

When the Bluetooth LE device disconnects, make sure to also destroy the
uHID device so that we don't have a lingering HID device accessible from
user-space.

This also fixes the input subsystem never seeing the device reattaching,
causing settings that should be applied on connection not to be applied.

https://bugzilla.kernel.org/show_bug.cgi?id=202909

Tested-by: Bastien Nocera <hadess@hadess.net>
Change-Id: Idbc431d733c5bfba710b9d455e1dc564e2e3c302
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agodoc: Cleanup API Provisioner1 interface
Brian Gix [Thu, 11 Jul 2019 22:59:44 +0000 (15:59 -0700)]
doc: Cleanup API Provisioner1 interface

Modified the RequestProvData In and Out param list to eliminate
parameters which can be provided by the Node which owns the
procedure, and clean-up the actual error list.

Change-Id: I00a7f511f38fd7a7060f4845e6dfb184c4a5791d
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoemulator: Fix condition check in btdev_create()
Inga Stotland [Thu, 4 Jul 2019 07:01:10 +0000 (00:01 -0700)]
emulator: Fix condition check in btdev_create()

This fixes a case where logical '||' was used with constant operand
and the condition check always resulted in true.

Was: if (type == BTDEV_TYPE_BREDRLE || type == BTDEV_TYPE_LE
                                        || BTDEV_TYPE_BREDRLE50)
Fixed: if (type == BTDEV_TYPE_BREDRLE || type == BTDEV_TYPE_LE
                                        || type == BTDEV_TYPE_BREDRLE50)

Change-Id: If8730ed0e30a0b9508a7e9591e3f63cc3deecff9
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agogatt: Fix failure of repeated AcquireNotify calls
Rob Spanton [Tue, 9 Jul 2019 16:57:22 +0000 (17:57 +0100)]
gatt: Fix failure of repeated AcquireNotify calls

This patch fixes a problem that can be encountered if a DBUS client
performs the following steps:

 1) Calls AcquireNotify on a characteristic
 2) Closes the fd produced by AcquireNotify
 3) Immediately calls AcquireNotify again on the same characteristic
 4) Disconnects DBUS client (does not have to be immediately)
 5) Reconnects DBUS client and call AcquireNotify

If these steps are followed, then the third call to AcquireNotify
will often be responded to with an error message stating "Notify
acquired".  Furthermore, the second call to AcquireNotify will not be
provided with an fd.

It turns out that the following was happening:  Closing the fd causes
bluez to disable notifications on that characteristic by writing to
the CCC.  If the second call to AcquireNotify is made before that CCC
write has completed, then a new write to the CCC to re-enable
notifications is enqueued.  Once that first write has completed, the
second write is then taken from the queue and started in
`disable_ccc_callback()`.  Unfortunately `disable_ccc_callback()` was
not actually using the data from the queue, but was instead just
re-using the data that it had been passed (`notify_data` instead of
`next_data`).

This meant that the write to the CCC to enable notifications would
happen, but the callback that needed to be made to the code that was
waiting for the enqueued operation to complete would never happen.  In
this AcquireNotify case, the register_notify_io_cb() function would
not be called, resulting in no socket creation and no response to the
second AcquireNotify call.  Instead it would leave some state
hanging around on bluez's representation of the characteristic, and so
subsequent calls to AcquireNotify by any DBUS client would fail with
the aforementioned error.

The fix is simple here -- make `disable_ccc_callback()` pass the
correct data through.

Change-Id: Ia49678498d713b2285c06ed01b72a6c0e1a6fe35
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoshared/hfp: Fix using uninitialized value
Luiz Augusto von Dentz [Tue, 9 Jul 2019 08:11:57 +0000 (11:11 +0300)]
shared/hfp: Fix using uninitialized value

This fixes the following trace when running unit tests:
  at 0x409597: is_response (hfp.c:1009)
  by 0x409597: hf_call_prefix_handler (hfp.c:1103)
  by 0x409955: hf_process_input (hfp.c:1176)
  by 0x409955: hf_can_read_data (hfp.c:1240)
  by 0x40C0E8: watch_callback (io-glib.c:170)
  by 0x48C3EDC: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.6000.3)
  by 0x48C426F: ??? (in /usr/lib64/libglib-2.0.so.0.6000.3)
  by 0x48C45A2: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.6000.3)
  by 0x40C94C: mainloop_run (mainloop-glib.c:79)
  by 0x40CEF9: mainloop_run_with_signal (mainloop-notify.c:201)
  by 0x408A43: tester_run (tester.c:870)
  by 0x404E04: main (test-hfp.c:865)

Change-Id: Ie720545383bf5ec748b20afd6b87517fa22bdef8
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agogatt: Require medium security for ATT socket over BR/EDR
Luiz Augusto von Dentz [Wed, 3 Jul 2019 15:39:20 +0000 (18:39 +0300)]
gatt: Require medium security for ATT socket over BR/EDR

Encryption is required according to the spec:

  BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 3, Part G page 2397:

  5.1.2 BR/EDR channel requirements

  The channel shall be encrypted. The Key_Type shall be either an
  Unauthenticated Combination Key or an Authenticated Combination Key.

Change-Id: I1cf0647421e2aeb7db0136758a33d626192c56c7
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoatt: Return error in case Exchange MTU is used over BR/EDR link
Luiz Augusto von Dentz [Wed, 3 Jul 2019 15:32:37 +0000 (18:32 +0300)]
att: Return error in case Exchange MTU is used over BR/EDR link

In case of BR/EDR the L2CAP MTU negotion is used instead:

  BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 3, Part G page 2370
  4.3.1 Exchange MTU

  This sub-procedure shall not be used on a BR/EDR physical link since
  the MTU size is negotiated using L2CAP channel configuration
  procedures.

Change-Id: Iadcd6d11ad30f892661da0e9e58993fa2e4e987b
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agotools: Fix build after y2038 changes in glibc
Bastien Nocera [Fri, 7 Jun 2019 07:51:33 +0000 (09:51 +0200)]
tools: Fix build after y2038 changes in glibc

The 32-bit SIOCGSTAMP has been deprecated. Use the deprecated name
to fix the build.

Change-Id: I8fb8adcbb9ea4731ed83dcd3dbbf18ed7cc724fa
Signed-off-by: himanshu <h.himanshu@samsung.com>
4 years agoavctp: Fix not accounting output MTU properly
Luiz Augusto von Dentz [Wed, 3 Jul 2019 12:25:00 +0000 (15:25 +0300)]
avctp: Fix not accounting output MTU properly

The code shall use BT_IO_OPT_OMTU to read the output MTU.

Change-Id: Ie97e172469b26177a612c8f2d3231c196e877a83
Signed-off-by: himanshu <h.himanshu@samsung.com>