platform/upstream/bluez.git
5 years agoclient: Add envs for proxies 66/204966/1
Luiz Augusto von Dentz [Mon, 26 Mar 2018 12:09:05 +0000 (15:09 +0300)]
client: Add envs for proxies

This adds envs for device and adapter proxies found so other files are
able to access them.

Change-Id: I3e2c0911a2d44224f6046399d62ca4999e579e89
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agogatt: Fix checking for paired flag instead of bonded 65/204965/1
Luiz Augusto von Dentz [Tue, 27 Mar 2018 15:38:20 +0000 (18:38 +0300)]
gatt: Fix checking for paired flag instead of bonded

Device state should remain valid for devices that are bonded/stored not
only paired.

Change-Id: I7b87d8f75a18c040b52cc6210e468d984b71938c
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agodevice: Fix storing GATT attributes 64/204964/1
Szymon Janc [Mon, 26 Mar 2018 14:11:53 +0000 (16:11 +0200)]
device: Fix storing GATT attributes

This fix two issues:
 - not storing attributes after pairing if device is using RPA
 - storing attributes for temporary device if it is using static
   or public address

Change-Id: I06cfed13e4c347a15138494cfae0be65e283ae30
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agodevice: Change storage warning to debug messages 63/204963/1
Szymon Janc [Mon, 26 Mar 2018 14:11:52 +0000 (16:11 +0200)]
device: Change storage warning to debug messages

It is normal for device to have private address so there is no reason
to issue warning message when not storing data for it.

Change-Id: I9c432f6513c5e581fdc8f60f951a4639fcb6b41b
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agotools/bluetooth-player: Return exit status for non-interactive 62/204962/1
ERAMOTO Masaya [Mon, 26 Mar 2018 08:31:04 +0000 (17:31 +0900)]
tools/bluetooth-player: Return exit status for non-interactive

Change-Id: I654ed7a5e3bee27a057047c0bed1567e4b4b4866
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Return exit status for non-interactive 61/204961/1
ERAMOTO Masaya [Mon, 26 Mar 2018 08:31:02 +0000 (17:31 +0900)]
client: Return exit status for non-interactive

Change-Id: Icf727225fca0f15fb3c14061181a825133b9d175
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoAdd support for requiring min key size for access GATT characteristics 60/204960/1
Szymon Janc [Fri, 23 Mar 2018 13:08:21 +0000 (14:08 +0100)]
Add support for requiring min key size for access GATT characteristics

This allows to configure bluetoothd to require minimum encryption key
size when accessing GATT server characteristics. It is a global
configuration option affecting whole GATT database.

Change-Id: Ibec567f17447d35421f016c5e0021ef49aa713ef
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Parse all options passed for GATT attribute 59/204959/1
Luiz Augusto von Dentz [Fri, 23 Mar 2018 13:32:12 +0000 (15:32 +0200)]
client: Parse all options passed for GATT attribute

This parses the options given to Acquire*, WriteValue and ReadValue.

Change-Id: If324abcc5b02f4e36137998dc4c8d4bd77b43e8b
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agogatt: Send device and link options with AcquireNotify 58/204958/1
Luiz Augusto von Dentz [Fri, 23 Mar 2018 09:16:03 +0000 (11:16 +0200)]
gatt: Send device and link options with AcquireNotify

This adds the device and link options to AcquireNotify as mentioned in
the documentation.

Change-Id: I65ba0bc1ecc8a4c4adf90b7bc1ba515b061ee4fd
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agodoc/gatt-api: Update documentation regarding link option 57/204957/1
Luiz Augusto von Dentz [Fri, 23 Mar 2018 09:23:56 +0000 (11:23 +0200)]
doc/gatt-api: Update documentation regarding link option

This reflects what the code has already doing so any server operation which
requires the device option shall also get the link type as well.

Change-Id: Ic5f78954160ec80e053a8b83b169ea918f2ac38e
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agogatt: Fail to register service with invalid Includes property 56/204956/1
Szymon Janc [Thu, 22 Mar 2018 20:07:55 +0000 (21:07 +0100)]
gatt: Fail to register service with invalid Includes property

This is optional property but if it is present it must be of
proper type.

Change-Id: I0a144bc7ce0e7b55a5f8ba0f94d7608397491dfa
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoshared/gatt-client: Fix tracking current service during discovery 55/204955/1
Andrzej Kaczmarek [Thu, 22 Mar 2018 15:21:01 +0000 (16:21 +0100)]
shared/gatt-client: Fix tracking current service during discovery

We should mark service as completed before trying to insert another
characteristic - in case inserting characteristic for new service
fails, previous one won't be discarded.

Change-Id: I14b6af270aebc358a88ffd2419c39573a1728b31
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoshared/gatt-client: Fix discovery of discontinuous database 54/204954/1
Andrzej Kaczmarek [Thu, 22 Mar 2018 15:21:00 +0000 (16:21 +0100)]
shared/gatt-client: Fix discovery of discontinuous database

If local cache of peer's database has gaps where new services appear
after reconnection, GATT client will attempt to discover all included
services and characteristics definitions between starting handle of
first service and end handle of last service. This means the result
will contain also attributes which are already present in active
services in local database and thus attempting to add them again will
fail.

To fix this, instead of discovering whole range we'll only discover
ranges for missing services - starting with included services then
characteristics. To optimize this process we'll merge ranges of
adjacent services and any empty spaces in between - the result is
basically set of ranges without any known service. In most cases this
works the same or very similar to current implementation.

This issue can sometimes be observed with iOS devices as ANCS and CTS
services may not be available all the time.

Change-Id: I2b73f0204f2e3cb7177b97799182f608156138ef
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoshared/gatt-client: Fix removing services from pending list 53/204953/1
Andrzej Kaczmarek [Thu, 22 Mar 2018 15:20:59 +0000 (16:20 +0100)]
shared/gatt-client: Fix removing services from pending list

We should remove from pending list service which was just processed,
not the one that has just started being processed.

Change-Id: I045bc1964f0951f6fae4d116acb973d70161a801
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Fix stay on error handling in non-interactive 52/204952/1
ERAMOTO Masaya [Mon, 19 Mar 2018 08:40:48 +0000 (17:40 +0900)]
client: Fix stay on error handling in non-interactive

Returns the FAILURE status since there is no meaning of stay in
non-interactive mode when executing some commands with an invalid
argument or with no controller. Also returns with the SUCCESS status
when getting a scan filtering value or disconnecting a non-default
device.

Change-Id: Iac437afcd04648ba9bb4580201c70e1e8396a329
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agogatt: Properly handle service changes when offline 51/204951/1
Luiz Augusto von Dentz [Mon, 19 Mar 2018 12:44:27 +0000 (14:44 +0200)]
gatt: Properly handle service changes when offline

If remote peer is disconnected the indication shall be cached so when
the peer connects again it receives the changes.

Change-Id: Ic887ae4f56fdd80efa998e12f6d42f018ad7a6b3
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agogatt: Add confirmation callback 50/204950/1
Luiz Augusto von Dentz [Mon, 19 Mar 2018 12:44:26 +0000 (14:44 +0200)]
gatt: Add confirmation callback

This replaces indicate flag with confirmation callback to enable
setting custom callback if necessary.

Change-Id: I2378e4dc42a1a241eb79fe7f947a5ab20bf5c5e0
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agodoc/gatt-api: Includes shall not be mandatory 49/204949/1
Luiz Augusto von Dentz [Thu, 22 Mar 2018 09:19:14 +0000 (11:19 +0200)]
doc/gatt-api: Includes shall not be mandatory

It is perfectly fine to have a service without any Includes.

Change-Id: Ibc8746d3a961d0900fa90c7b0be04e2a10b64aca
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agobuild: Fix make distcheck 48/204948/1
Luiz Augusto von Dentz [Thu, 22 Mar 2018 09:16:26 +0000 (11:16 +0200)]
build: Fix make distcheck

Change-Id: I2ac28241236a7367f63610ae040487c9fce86099
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agobuild: Fix not disabling obexd when given --disable-obex 47/204947/1
Luiz Augusto von Dentz [Wed, 21 Mar 2018 16:52:55 +0000 (18:52 +0200)]
build: Fix not disabling obexd when given --disable-obex

--disable-obex shall disable building obexd daemon.

Change-Id: I978627b477f7ec25236e49ab1f6ac43263abf497
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Add authorization request handling for attribute operations 46/204946/1
Grzegorz Kolodziejczyk [Tue, 20 Mar 2018 14:05:19 +0000 (15:05 +0100)]
client: Add authorization request handling for attribute operations

This patch adds optional authorization request for reading, writing of
gatt database attributes.

Change-Id: Iffeabaa1ebd44b8fbf521194f603b2836e0042eb
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Update read callbacks with invalid offset error handlers 45/204945/1
Grzegorz Kolodziejczyk [Tue, 20 Mar 2018 14:05:18 +0000 (15:05 +0100)]
client: Update read callbacks with invalid offset error handlers

This patch adds invalid offset handlers to read callbacks of attributes.

Change-Id: I7c9184e0f0caf0e43c7b37eeaa40a6a12a1fd883
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agogatt: Add org.bluez.Error.InvalidOffset for long read procedure 44/204944/1
Grzegorz Kolodziejczyk [Tue, 20 Mar 2018 14:05:17 +0000 (15:05 +0100)]
gatt: Add org.bluez.Error.InvalidOffset for long read procedure

This patch adds handling of invalid offset error for gatt database in
case if offset in read blob would be invalid.

"The Read Blob Request is repeated until the Read Blob Response’s Part
Attribute Value parameter is zero or an Error Response is sent by the server
with the Error Code set to Invalid Offset." Bluetooth Core 5.0, 4.12.2

"If the prepare Value Offset is greater than the current length of the attribute
value then all pending prepare write values shall be discarded for this client,
the queue shall be cleared and then an Error Response shall be sent with the
«Invalid Offset»." Bluetooth Core 5.0, 3.4.6.3

Change-Id: I678ca6984bde4502a3b325fd1822d21d98e6a1a9
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Fix reading long values 43/204943/1
Grzegorz Kolodziejczyk [Tue, 20 Mar 2018 14:05:16 +0000 (15:05 +0100)]
client: Fix reading long values

While value has more than single MTU can carry long read procedure will
be triggered. In such cases offset need to bo considered while getting
value from storage.

Change-Id: Ide2d67c7562a83f317e699627a7c22ba058c47f8
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agogatt-database: Add support for Included service 42/204942/1
Avichal Agarwal [Mon, 19 Mar 2018 12:02:26 +0000 (17:32 +0530)]
gatt-database: Add support for Included service

Parse Includes property and register any object path found as included
service.

Change-Id: Id0a311b31bebf6f307a621ce3d66858f209b25f5
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agodoc/gatt-api.txt: Add support for Included Service 41/204941/1
Avichal Agarwal [Tue, 20 Mar 2018 05:09:41 +0000 (10:39 +0530)]
doc/gatt-api.txt: Add support for Included Service

included service support implemented at server side

Change-Id: I1577d5a1a5cb3d469bff2bf65a918740135ddcb5
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoshared/gatt-client: Fix attempting to discovery with handle 0 40/204940/1
Luiz Augusto von Dentz [Wed, 14 Mar 2018 12:51:29 +0000 (14:51 +0200)]
shared/gatt-client: Fix attempting to discovery with handle 0

If a service was removed an no other service was added it may happen
that pending_svc has not empty but first_svc and last_svc has not been
set causing the following request:

< ACL Data TX: Handle 76 flags 0x00 dlen 11
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x0000-0x0000
        Attribute type: Include (0x2802)

Change-Id: Id628ff103fee0abfcb961aaa4e0032737b0c805c
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoshared/gatt-client: Fix secondary service discovery 39/204939/1
Luiz Augusto von Dentz [Wed, 14 Mar 2018 12:46:05 +0000 (14:46 +0200)]
shared/gatt-client: Fix secondary service discovery

If the error returned is either BT_ATT_ERROR_ATTRIBUTE_NOT_FOUND or
BT_ATT_ERROR_UNSUPPORTED_GROUP_TYPE the discovery shall be marked as
successful and no error shall be printed.

Change-Id: I3caf7be943e0457137732ee4427a38b914c7115f
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoshared/gatt-client: Omit valid errors for primary discovery 38/204938/1
Luiz Augusto von Dentz [Wed, 14 Mar 2018 12:56:30 +0000 (14:56 +0200)]
shared/gatt-client: Omit valid errors for primary discovery

BT_ATT_ERROR_ATTRIBUTE_NOT_FOUND shall not cause anything to be printed
since it is a valid response and just mark the end of primary discovery.

Change-Id: Ideebfd3b7646f5082f07edb0ae03c74272f23ec5
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoshared/gatt-server: Fix crash on read multiple 37/204937/1
Szymon Janc [Tue, 13 Mar 2018 07:47:27 +0000 (08:47 +0100)]
shared/gatt-server: Fix crash on read multiple

When read multiple includes external characteristic, call to
gatt_db_attribute_read's complete callback is asynchronous.

Fix following crash:
Use of uninitialised value of size 8
   at 0x49718A: read_multiple_complete_cb (gatt-server.c:994)
   by 0x498999: pending_read_result (gatt-db.c:136)
   by 0x49A84B: gatt_db_attribute_read_result (gatt-db.c:1787)
   by 0x451F4C: read_reply_cb (gatt-database.c:1712)
   by 0x48B221: method_call_reply (client.c:972)
   by 0x53AB601: ??? (in /usr/lib64/libdbus-1.so.3.19.3)
   by 0x53AEF7E: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.19.3)
   by 0x486FEF: message_dispatch (mainloop.c:72)
   by 0x50CB576: ??? (in /usr/lib64/libglib-2.0.so.0.5400.3)
   by 0x50CEB76: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.5400.3)
   by 0x50CEF1F: ??? (in /usr/lib64/libglib-2.0.so.0.5400.3)
   by 0x50CF231: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.5400.3)

Invalid read of size 8
   at 0x49718A: read_multiple_complete_cb (gatt-server.c:994)
   by 0x498999: pending_read_result (gatt-db.c:136)
   by 0x49A84B: gatt_db_attribute_read_result (gatt-db.c:1787)
   by 0x451F4C: read_reply_cb (gatt-database.c:1712)
   by 0x48B221: method_call_reply (client.c:972)
   by 0x53AB601: ??? (in /usr/lib64/libdbus-1.so.3.19.3)
   by 0x53AEF7E: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.19.3)
   by 0x486FEF: message_dispatch (mainloop.c:72)
   by 0x50CB576: ??? (in /usr/lib64/libglib-2.0.so.0.5400.3)
   by 0x50CEB76: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.5400.3)
   by 0x50CEF1F: ??? (in /usr/lib64/libglib-2.0.so.0.5400.3)
   by 0x50CF231: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.5400.3)
 Address 0x8 is not stack'd, malloc'd or (recently) free'd

Change-Id: Id0aca942b2c5229e798c2d4fb9d9d8c3ac86cdde
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoRelease 5.49 36/204936/1
Marcel Holtmann [Sat, 10 Mar 2018 15:35:21 +0000 (16:35 +0100)]
Release 5.49

Change-Id: Icf519908cc6e44b9e760ac7a904052d7a39bcffd
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoavctp: Fix crash when disconnecting 35/204935/1
Luiz Augusto von Dentz [Fri, 9 Mar 2018 09:26:04 +0000 (11:26 +0200)]
avctp: Fix crash when disconnecting

When disconnecting the channel queue shall not be destroyed before
freeeing all requests including those that already have been processed
otherwise the following crash may happen:

4 errors in context 2 of 103:
Invalid read of size 4
   at 0x12A5C2: control_req_destroy (avctp.c:762)
   by 0x12A539: pending_destroy (avctp.c:517)
   by 0x48A0D48: g_slist_foreach (in /usr/lib/libglib-2.0.so.0.3600.0)
   by 0x12A77B: avctp_channel_destroy (avctp.c:553)
   by 0x12A801: avctp_disconnected (avctp.c:570)
   by 0x12A0F1: control_disconnect (control.c:134)
   by 0x1306B9: avrcp_disconnect (avrcp.c:4471)
   by 0x17DAE9: btd_service_disconnect (service.c:307)
   by 0x18437D: dev_disconn_service (device.c:1405)
   by 0x48A0D48: g_slist_foreach (in /usr/lib/libglib-2.0.so.0.3600.0)
   by 0x187D87: device_request_disconnect (device.c:1437)
   by 0x187EC6: dev_disconnect (device.c:1522)
 Address 0x4fde068 is 0 bytes inside a block of size 16 free'd
   at 0x48252B3: free (vg_replace_malloc.c:446)
   by 0x4888172: g_free (in /usr/lib/libglib-2.0.so.0.3600.0)
   by 0x12AB64: avctp_queue_destroy (avctp.c:537)
   by 0x48A0D48: g_slist_foreach (in /usr/lib/libglib-2.0.so.0.3600.0)
   by 0x48A0D91: g_slist_free_full (in /usr/lib/libglib-2.0.so.0.3600.0)
   by 0x12A75E: avctp_channel_destroy (avctp.c:552)
   by 0x12A801: avctp_disconnected (avctp.c:570)
   by 0x12A0F1: control_disconnect (control.c:134)
   by 0x1306B9: avrcp_disconnect (avrcp.c:4471)
   by 0x17DAE9: btd_service_disconnect (service.c:307)
   by 0x18437D: dev_disconn_service (device.c:1405)
   by 0x48A0D48: g_slist_foreach (in /usr/lib/libglib-2.0.so.0.3600.0)

Change-Id: Ida52cd46ad8d1754e8afa84ab52f7e84b68f1065
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agodevice: Fix missing Paired property change on non-bonded device 34/204934/1
Szymon Janc [Tue, 6 Mar 2018 14:15:14 +0000 (15:15 +0100)]
device: Fix missing Paired property change on non-bonded device

If device is paired but not bonded than Paired property should be
also updated when device is disconnected.

Change-Id: Ic4b49d25692dd09807196444f20be76212b96b30
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoFixed the session list for obex 33/204933/1
Amit Purwar [Wed, 10 Apr 2019 09:38:02 +0000 (15:08 +0530)]
Fixed the session list for obex

Change-Id: Ic86fba8e3089b0d29c80260f9335ecda7e64c62d
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoFix storage for adapters without public address 32/204932/1
Szymon Janc [Tue, 6 Mar 2018 13:28:07 +0000 (14:28 +0100)]
Fix storage for adapters without public address

Since those have adapter folder prefixed with "static-" this needs
to be taken into account when storing data.

Change-Id: I3a444ac00c36ee064538629284a466633a01e1e3
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoadvertising: Fix crash when if client invalidate property 31/204931/1
Luiz Augusto von Dentz [Fri, 19 Jan 2018 13:37:07 +0000 (11:37 -0200)]
advertising: Fix crash when if client invalidate property

If a property is invalidated the iter is set to NULL which should be
checked and properly reset.

Change-Id: I4981b56b9d8b68bb589d0ced2f429c71441a7ce8
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoadvertising: Fix creating another mgmt instance 30/204930/1
Luiz Augusto von Dentz [Wed, 28 Feb 2018 12:09:08 +0000 (14:09 +0200)]
advertising: Fix creating another mgmt instance

adapter already instanciate a instance of mgmt so just reuse that
instead of creating a new one.

Change-Id: I0a1fd65ff2d6f6cbae5783a25f1adbd547992432
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoRemove obsolete Debian notes from HACKING 29/204929/1
David Frey [Mon, 5 Mar 2018 20:01:16 +0000 (12:01 -0800)]
Remove obsolete Debian notes from HACKING

The HACKING document says that Debian's automake version doesn't satisfy
the automake >= 1.10 requirement, but this is no longer true. The
automake version in Debian 8 (oldstable) is 1.14 and the version in
Debian 9 (stable) is 1.15.

Change-Id: I2428584f070a52d6aac2b8b766f9a9793b018f91
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agodevice: Fix bearer selection with single mode controller 28/204928/1
Szymon Janc [Mon, 5 Mar 2018 16:16:35 +0000 (17:16 +0100)]
device: Fix bearer selection with single mode controller

If remote device is dual mode and advertises without "BR/EDR flag
not supported" set than device is marked as supporting BR/EDR
even if controller is doing LE only. This results in bluetoothd
trying to connect over BR/EDR since this is prefered transport
if none is connected.

Fix this by checking if adapter supports specified technology
before doing heuristic transport selection.

Change-Id: Icb51c40a4327759817c637f90821c0bea866edc4
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Fix lines going beyond 80 columns 27/204927/1
Luiz Augusto von Dentz [Thu, 1 Mar 2018 09:11:17 +0000 (11:11 +0200)]
client: Fix lines going beyond 80 columns

Change-Id: I31dfc94aa5314362a7d5b18aeb8ecb4ebbe11a71
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agodbus-common: Remove unused functions 26/204926/1
ERAMOTO Masaya [Thu, 1 Mar 2018 04:27:42 +0000 (13:27 +0900)]
dbus-common: Remove unused functions

Change-Id: I580a497600bbe7c2521f5303fdbd2069b60a558b
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agounit/test-gdbus-client: Use g_dbus_dict_append_entry() 25/204925/1
ERAMOTO Masaya [Thu, 1 Mar 2018 04:27:38 +0000 (13:27 +0900)]
unit/test-gdbus-client: Use g_dbus_dict_append_entry()

Change-Id: I63b356bd82ffee5f40ba4b53756d384874c7ee59
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Use g_dbus_dict_append_*() 24/204924/1
ERAMOTO Masaya [Thu, 1 Mar 2018 04:27:21 +0000 (13:27 +0900)]
client: Use g_dbus_dict_append_*()

Change-Id: Ifeeed4631fc3408ef3225c6356cabb7179c3d472
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoobexd: Remove unused source/header files for dbus 23/204923/1
ERAMOTO Masaya [Thu, 1 Mar 2018 04:27:16 +0000 (13:27 +0900)]
obexd: Remove unused source/header files for dbus

Due to using g_dbus_emit_property_changed() and g_dbus_get_properties(),
obex_dbus_signal_property_changed() is unused since commit 96063756
("obex-client: Rename org.bluez.obex.Transfer to Transfer1"), and
OBC_PROPERTIES_ARRAY_SIGNATURE macro is unused since commit 3eadc034
("obex-client: Make use of g_dbus_get_properties to get transfer properties").

Change-Id: If237f40dea006c9b96e16dc3e446dff80e591aed
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoobexd: Use g_dbus_dict_append_entry() 22/204922/1
ERAMOTO Masaya [Thu, 1 Mar 2018 04:27:10 +0000 (13:27 +0900)]
obexd: Use g_dbus_dict_append_entry()

Change-Id: I7119b0a9dbf1d5491fe869e59efca3ab0e18d313
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Quit when done with command 21/204921/1
Luiz Augusto von Dentz [Fri, 23 Feb 2018 14:34:58 +0000 (16:34 +0200)]
client: Quit when done with command

This ensures that the commands don't stay hanging since bt_shell no
longer quits immediatelly after executing a command.

Change-Id: I69dd2faa6c1c55039d7d19d2e4effcf2cd4919d7
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoshared/btp: Fix return type in btp_send 20/204920/1
Szymon Janc [Fri, 23 Feb 2018 13:40:09 +0000 (14:40 +0100)]
shared/btp: Fix return type in btp_send

This function returns bool.

Change-Id: Ie7d30dcb11a2e400a43e7f29ae92006caee1366e
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoshared/btp: Allow to call btp_send without valid btp 19/204919/1
Szymon Janc [Fri, 23 Feb 2018 13:40:10 +0000 (14:40 +0100)]
shared/btp: Allow to call btp_send without valid btp

This allows to unconditionally call btp_send from code that generates
events eg when mapping those from D-Bus events.

Change-Id: Id47fb80d7116d0fd8ac4f48567ee115ca43c3e89
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Don't auto register agent on non-interactive mode 18/204918/1
Luiz Augusto von Dentz [Wed, 21 Feb 2018 11:02:42 +0000 (13:02 +0200)]
client: Don't auto register agent on non-interactive mode

There is no use to register an agent when on non-interactive mode.

Change-Id: Idbbac0630b0ea901cceeb710bdae32a4e03fbe45
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoadapter: Add ConnectDevice method 17/204917/1
Szymon Janc [Mon, 19 Feb 2018 13:40:19 +0000 (14:40 +0100)]
adapter: Add ConnectDevice method

This allows to connect device without doing general discovery. This is
needed for some of qualification tests where there is no general
discovery upfront and we need to do connection to device with provided
address.

Another usecase is for scenario where scanning happen on one controller
but connection handling on another.

New device object is announced only if physical connection was
successful. On success this method returns path to created device
object. After ConnectProfile return bluetoothd continue with
services discovery and profile connection.

This patch implements bare minimum properties needed for connection -
address and address type. If needed eg. for non-NFC based OOB it could
be extended with more options.

Change-Id: I08bbd114ac9c46bf377879694175c58d0e8fea02
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoshared/shell: Fix history display with no saved prompt 16/204916/1
Szymon Janc [Tue, 20 Feb 2018 11:09:40 +0000 (12:09 +0100)]
shared/shell: Fix history display with no saved prompt

Prompt needs to be restored always since default prompt is provided.
This fix issues with history line being clobbered by offset of prompt
length.

[bluetooth]# connect 9C:5C:F9:AB:C5:82
Attempting to connect to 9C:5C:F9:AB:C5:82
[bluetooth]# disconnect 9C:5C:F9:AB:C5:82
Attempting to disconnect from 9C:5C:F9:AB:C5:82
Failed to connect: org.bluez.Error.Failed
Successful disconnected
[bluetooth]# discoverable on
Changing discoverable on succeeded
[CHG] Controller 5C:E0:C5:34:AE:1C Discoverable: yes
[bluetooth]# disconnect discoverable on

after pressing up-down
[bluetooth]# disconnect dis5C:F9:AB:C5:82

Change-Id: I83d4d5e15cb67f51256359d7e73c19a840c85a34
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoshared/io: Don't process HUP cond before others 15/204915/1
Luiz Augusto von Dentz [Tue, 20 Feb 2018 09:11:26 +0000 (11:11 +0200)]
shared/io: Don't process HUP cond before others

When a HUP happens there maybe data left to be processed so the
disconnect handler shall be called last.

Change-Id: Ic4a4ec535cc628f01118c5ade20d5e36bc25671a
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agodevice: Fix probing service twice 14/204914/1
Luiz Augusto von Dentz [Mon, 19 Feb 2018 12:51:50 +0000 (14:51 +0200)]
device: Fix probing service twice

If there is already a service for a given profile there is no point in
probing it again.

Change-Id: I932148183acaf832763e7cc9e419312957d91d72
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoadapter: Fix not clearing connectable setting on power off 13/204913/1
Szymon Janc [Mon, 19 Feb 2018 12:43:35 +0000 (13:43 +0100)]
adapter: Fix not clearing connectable setting on power off

When kernel control of connectable is used daemon doesn't enable
connectable setting unless discoverable. Both settings are permanent
over power toggle unless discoverable timeout was set. In that case
discoverable flag is cleared by kernel on power off. This leads to
connectable flag being left enabled when toggling power on discoverable
adapter with timeout set.

This has some implications on system behaviour:
 - accepting connection from unknown devices
 - not being able to advertise as broadcaster

Since kernel doens't know the reason for enabling connectable flag (and
thus if disable if on power off) this needs to be handled in bluetoothd.

Change-Id: Id454bbd69027affc08a9a11bccfd90e0a2da12a9
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Add clear command for advertise 12/204912/1
ERAMOTO Masaya [Fri, 16 Feb 2018 05:51:48 +0000 (14:51 +0900)]
client: Add clear command for advertise

Adds the clear command to advertise-related commands to clear individual
fields or whole of advertise configuration.

Change-Id: I947e47a73830cfc28d370e1c5f3a47d3cf6fb254
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Introduce ad_disable_{uuids,service,manufacturer} 11/204911/1
ERAMOTO Masaya [Fri, 16 Feb 2018 05:51:37 +0000 (14:51 +0900)]
client: Introduce ad_disable_{uuids,service,manufacturer}

Change-Id: Id0555a1433d234f42dd1d0faa08f3274b30a1cc8
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Introduce data_clear() calling ->clear() 10/204910/1
ERAMOTO Masaya [Fri, 16 Feb 2018 05:51:29 +0000 (14:51 +0900)]
client: Introduce data_clear() calling ->clear()

Change-Id: I96e980ea20bffa99096c367db92478f6aea1ab10
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Improve help messages for advertise 09/204909/1
ERAMOTO Masaya [Fri, 16 Feb 2018 05:51:21 +0000 (14:51 +0900)]
client: Improve help messages for advertise

Change-Id: Id56c9df117e6c817b4d3b5dda6b54941441349b4
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Fix data growth if reconfiguring ad service 08/204908/1
ERAMOTO Masaya [Fri, 16 Feb 2018 05:51:15 +0000 (14:51 +0900)]
client: Fix data growth if reconfiguring ad service

Since commit 65eff5c2 ("client: Rename set-service to service"), data
are appended in every run of advertise service with data arguments as
below:

  [bluetooth]# service 1 1 2
  [bluetooth]# service
  UUID: SDP(1)
    01 02                                            ..
  [bluetooth]# service 1 1 2 3
  [bluetooth]# service
  UUID: SDP(1)
    01 02 01 02 03                                   .....

Change-Id: I1e8f6f19adbbd967b2ddc06837ddf7103ea18167
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Not output ad service info if no uuid sets 07/204907/1
ERAMOTO Masaya [Fri, 16 Feb 2018 05:51:08 +0000 (14:51 +0900)]
client: Not output ad service info if no uuid sets

Change-Id: I2f3db46b13b7d33a952993dcc1c1421e01b4ce1c
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Fix null output for ad service uuid 06/204906/1
ERAMOTO Masaya [Fri, 16 Feb 2018 05:51:03 +0000 (14:51 +0900)]
client: Fix null output for ad service uuid

If getting the advertise service information without setting, outputs
null as UUID as below:

  [bluetooth]# service
  UUID: ((null))

Change-Id: I47ce8f6c380b90bf17acfa0db112bfc93b234e14
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoadapter: Fix initializing GATT server for BR/EDR only controllers 05/204905/1
Luiz Augusto von Dentz [Wed, 14 Feb 2018 13:58:15 +0000 (15:58 +0200)]
adapter: Fix initializing GATT server for BR/EDR only controllers

Controller that do not support LE bearer shall not use GATT server for
anything.

Change-Id: Iffde6329966bb828a43262f3af41f6f294ce5667
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoobexd: Fix null response name 04/204904/1
ERAMOTO Masaya [Wed, 14 Feb 2018 07:20:31 +0000 (16:20 +0900)]
obexd: Fix null response name

Prints out "<unknown>" string if there is no response name as below:

  obexd[8117]: obexd/src/obex.c:cmd_connect()
  obexd[8117]: CONNECT(0x0), (null)(0xffffffff)

Change-Id: I3229def9a31f1397001f9c101550e0f30da17641
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoadvertising: only parse adv from adv interfaces 03/204903/1
Matt Schulte [Wed, 7 Feb 2018 07:48:56 +0000 (23:48 -0800)]
advertising: only parse adv from adv interfaces

client_proxy_added is called for every interface on an object passed in
to the dbus RegisterAdvertisement method. This can cause a NULL
dereference to occur and a failure status in the reply on dbus
RegisterAdvertisement method calls. The fix is to return early from
client_proxy_added if the proxy interface is not
org.bluez.LEAdvertisement1. If this early return is not there, two
different error paths could occur.

1) client_proxy_added is first called with the
org.bluez.LEAdvertisement1 interface and then with another interface.
The second call will fail the parse_advertisement call and possibly
cause a NULL dereference on the dbus_message_unref if
add_client_complete has already occurred.

2) client_proxy_added is first called with an unknown interface and then
org.bluez.LEAdvertisement1. The first call will cause
parse_advertisement to fail and a failure to be replied to the client
calling RegisterAdvertisement. The advertisement may be successfully
registered on the second client_proxy_added call but a NULL dereference
will occur on the call to dbus_message_new_method_return in
add_client_complete.

Change-Id: I5fa0dbaad9568d0ebdd1c358246f10b20cbe2bcc
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoshared/gatt-db: Fix declaration attributes permission 02/204902/1
Konstantin Zhukov [Mon, 12 Feb 2018 10:40:30 +0000 (14:40 +0400)]
shared/gatt-db: Fix declaration attributes permission

According to Bluetooth Core specification v4.2 (Vol. 3, part G,
section 3.1), service declararion attributes should have only READ
permission. The same obligation has charateristic declaration and
include service declaration attributes.

Without this permission connected clients could corrupt GATT database
by writing to declaration attributes. After thatm service discovery
fails in other clients.

Change-Id: Ib18c4de213e9c242a09a770d9f24cd850a1af6a0
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoobexd: Emit Size property of transfer after open() 01/204901/1
ERAMOTO Masaya [Fri, 9 Feb 2018 09:11:41 +0000 (18:11 +0900)]
obexd: Emit Size property of transfer after open()

Emits the Size property of transfer after calling ->open() because it
may update the size information.

Change-Id: I343e2f9c5993a9c91107e75f7a0af747f262308c
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoobexd: Use emitting function wrapped for transfer 00/204900/1
ERAMOTO Masaya [Fri, 9 Feb 2018 09:10:57 +0000 (18:10 +0900)]
obexd: Use emitting function wrapped for transfer

Also replaces emit_transfer_progress() with the new wrapper function
because the total/transferred arguments have not been used since commit
a5c2b6e8 ("obexd: Align client and server spec of org.bluez.obex.Transfer1")
and g_dbus_emit_property_changed_full() checks if the path argument is
NULL.

Change-Id: I2733ee5de2de15d008d45724abffafefa87fc045
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoshared/gatt-client: Reset callbacks when unregistering 99/204899/1
Luiz Augusto von Dentz [Fri, 9 Feb 2018 10:46:55 +0000 (12:46 +0200)]
shared/gatt-client: Reset callbacks when unregistering

If user application is unregistering a notification handler its
callbacks shall not be called even CCC write is still holding a
reference to notify_data.

Change-Id: Ib16702e9d0437478487daf6571844b55ceac5266
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoadapter: Remove spurious propery changed signal 98/204898/1
Szymon Janc [Thu, 8 Feb 2018 16:03:06 +0000 (17:03 +0100)]
adapter: Remove spurious propery changed signal

There is no "Connectable" property on Adapter1 interface.

Change-Id: I2673bfc3bf9a5b18ceac1dffacbf47b05181e1a4
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoadvertising: Configure discoverable flag based on adapter settings 97/204897/1
Szymon Janc [Wed, 7 Feb 2018 10:02:24 +0000 (11:02 +0100)]
advertising: Configure discoverable flag based on adapter settings

Until now advertising as peripheral was always setting General Discoverable
flag set. With this patch this is set based on adapter discoverable setting.

Change-Id: Ic4db27d37f94ab6a99250f919d9e9432cfa40886
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agocore: Fixes order InterfaceAdded 96/204896/1
Luiz Augusto von Dentz [Wed, 7 Feb 2018 11:35:07 +0000 (09:35 -0200)]
core: Fixes order InterfaceAdded

Registering on the callback of MGMT_OP_READ_ADV_FEATURES causes
InterfacesAdded to be reschedule after the device objects which causes
tools such as PulseAudio to consider it invalid.

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

Change-Id: I5e485ccbeb9d0cd81b0a34bbe970306333ef948e
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Fix not cleaning up notify pipe 95/204895/1
Luiz Augusto von Dentz [Tue, 6 Feb 2018 10:01:19 +0000 (08:01 -0200)]
client: Fix not cleaning up notify pipe

If remote unsubscribe, disconnects or the daemon closes the socket the
io shall be destroyed properly otherwise it will prevent new
subscriptions.

Change-Id: I9cd77b61e7bfdd38ecd160edd0b9316d8285c7b0
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agogatt: Fix memory leak 94/204894/1
Luiz Augusto von Dentz [Tue, 6 Feb 2018 09:00:14 +0000 (07:00 -0200)]
gatt: Fix memory leak

If bt_gatt_client_register_notify fails the client shall be freed.

Change-Id: Ie478a2df0edb4129129daa1fb3448c44cfcc7efa
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Don't set generators for modes 93/204893/1
Luiz Augusto von Dentz [Mon, 5 Feb 2018 12:02:43 +0000 (10:02 -0200)]
client: Don't set generators for modes

Commands that already have all values set on the argument string don't
need to add a generator since bt_shell can now auto complete them.

Change-Id: I6a1876b4754a574ae68b1dfb7f80b16885e6d83a
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agobuild: Bump ELL dependency to 0.3 92/204892/1
Szymon Janc [Fri, 2 Feb 2018 09:18:11 +0000 (10:18 +0100)]
build: Bump ELL dependency to 0.3

This is first version that supports D-Bus proxy API used by btpclient.

Change-Id: If8dfb4a3f2744fc42c128de72e088ee17893ab18
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoadapter: Use g_dbus_send_reply whenever possible 91/204891/1
Luiz Augusto von Dentz [Wed, 31 Jan 2018 10:55:30 +0000 (08:55 -0200)]
adapter: Use g_dbus_send_reply whenever possible

This convert calls of g_dbus_create_reply + g_dbus_send_message to just
g_dbus_send_reply as that is simpler to maintain and saver as that always
check if the reply could be constructed properly.

Change-Id: I7514f10f22e4c629892796c929cb556a0fb07a97
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agogdbus: Fail to send NULL messages 90/204890/1
Luiz Augusto von Dentz [Sun, 28 Jan 2018 13:44:32 +0000 (11:44 -0200)]
gdbus: Fail to send NULL messages

This should make it safe to call g_dbus_send_message with a NULL
message which is more likely to happen now that g_dbus_create_reply
returns NULL when the message is marked with NO_REPLY flag.

Change-Id: Ie5d51fab161acf06a4813c64d05689f3ecc627df
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agogdbus: Fix replying to messages marked with NOREPLY flag 89/204889/1
Luiz Augusto von Dentz [Sun, 28 Jan 2018 13:22:26 +0000 (11:22 -0200)]
gdbus: Fix replying to messages marked with NOREPLY flag

When a sender flags a D-Bus message as not expecting a reply, it is
against D-Bus policy to send a reply — sending one can result in an
error as reported in:

https://bugzilla.kernel.org/show_bug.cgi?id=198453
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
Change-Id: I64f927691a7e135b3855ee2ed10f202f0a1cd632

5 years agoobexd: Fix property Size of server transfer 88/204888/1
Luiz Augusto von Dentz [Wed, 24 Jan 2018 13:06:16 +0000 (11:06 -0200)]
obexd: Fix property Size of server transfer

OBJECT_SIZE_DELETE is shall not be consider a valid size.

Change-Id: I84ec5c9f7397dee6597a99263cb200243b0def5f
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoobexd: Clean up unneeded list in src/obex.c 87/204887/1
ERAMOTO Masaya [Tue, 23 Jan 2018 09:45:34 +0000 (18:45 +0900)]
obexd: Clean up unneeded list in src/obex.c

Cleans up the sessions list which has been unneeded by commit 8572afb4
("obexd: Make use of transport drivers and some cleanups").

Change-Id: Ie06072fa6d052bd7e5bdc824e8250362bd914cae
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoshared: Add missing ecc_valid_public_key function 86/204886/1
Marcel Holtmann [Mon, 22 Jan 2018 11:06:31 +0000 (12:06 +0100)]
shared: Add missing ecc_valid_public_key function

Change-Id: I955d675fcf2d8fe6c2d50da9a54100c1e7041bd9
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Print advertising details 85/204885/1
Luiz Augusto von Dentz [Fri, 19 Jan 2018 13:12:09 +0000 (11:12 -0200)]
client: Print advertising details

Print advertising details when active.

Change-Id: Idc4372ad9dbc7d1e8839f7fe67f4490f5de5433e
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Rename set-uuids to uuids 84/204884/1
Luiz Augusto von Dentz [Thu, 14 Dec 2017 18:09:39 +0000 (16:09 -0200)]
client: Rename set-uuids to uuids

Make the command return the current value if no parameters:

[bluetooth]# uuids 0x1820
[bluetooth]# uuids
UUID: Internet Protocol Support (0x1820

Change-Id: Ia0fa56d8374f1efcfdbc03a2929a2ea8131ba00d
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Fix register-{characteristic, descriptor} 83/204883/1
Luiz Augusto von Dentz [Tue, 16 Jan 2018 19:01:03 +0000 (17:01 -0200)]
client: Fix register-{characteristic, descriptor}

Flags parameter should be found in the third parameter not the second
since bt_shell don't omit the command anymore.

Change-Id: I7d38136b3a7d8a6a73411b954a85de908cd15c70

5 years agoclient: Remove use of double const argument 82/204882/1
Luiz Augusto von Dentz [Tue, 2 Jan 2018 16:19:26 +0000 (14:19 -0200)]
client: Remove use of double const argument

Change-Id: Ia7869ba6fadb083393b2cda5f62b5de4214ea50a
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoclient: Use g_dbus_proxy_path_lookup() 81/204881/1
ERAMOTO Masaya [Thu, 28 Dec 2017 05:44:18 +0000 (14:44 +0900)]
client: Use g_dbus_proxy_path_lookup()

Change-Id: Icee4a0543cd13cbd516f5156862450b350631264
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agogdbus: Introduce g_dbus_proxy_path_lookup() 80/204880/1
ERAMOTO Masaya [Thu, 28 Dec 2017 05:44:15 +0000 (14:44 +0900)]
gdbus: Introduce g_dbus_proxy_path_lookup()

g_dbus_proxy_path_lookup() returns the path of the proxy that matches the
passed path. It also returns the index of the proxy coming next to the
matched proxy in the passed list.

Change-Id: Id14371c3c692728ef632987be35190146703be3f
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoAdd default a2dp role setting logic for headless 97/202397/1 accepted/tizen/unified/20190330.030017 submit/tizen/20190329.002626
Wootak Jung [Thu, 28 Mar 2019 04:53:30 +0000 (13:53 +0900)]
Add default a2dp role setting logic for headless

Change-Id: I25f5fa87779790eb189d0ac6070a25d5cead09db

5 years agoFix OPP Server dbus rejection issue 84/201584/2 accepted/tizen/unified/20190320.082303 submit/tizen/20190319.064604
Wootak Jung [Mon, 18 Mar 2019 02:26:03 +0000 (11:26 +0900)]
Fix OPP Server dbus rejection issue

Change-Id: Icd6098a74a6336d5f93cbc985761cf3de9463fd1

5 years agoApply the review comments in A2DP multistream 70/201570/1
DoHyun Pyun [Mon, 18 Mar 2019 00:36:27 +0000 (09:36 +0900)]
Apply the review comments in A2DP multistream

Change-Id: I7e0ff1040067be3062f1433847913808b5923fdd
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
5 years agoSupport getting LE Local OOB Data 70/199970/1 accepted/tizen/unified/20190219.154246 submit/tizen/20190218.033542
Seungyoun Ju [Wed, 23 Jan 2019 06:52:15 +0000 (15:52 +0900)]
Support getting LE Local OOB Data

[Problem] There is no interface to get LE local OOB Data
[Cause & Measure] Send MGMT_OP_READ_LOCAL_OOB_EXT_DATA to kernel to get
 LE local OOB Data.

Result:

$ dbus-send --system --print-reply --dest=org.bluez /org/bluez/hci0 org.bluez.OutOfBand.LEReadLocalData
method return time=1548225479.022260 sender=:1.392 -> destination=:1.400 serial=94 reply_serial=2
   array of bytes [
      08 1b 86 a6 6a d6 ae 08 00 02 1c 01 11 22 71 05 07 3e 23 98 9b 54 c4 56
      c4 b0 af 35 12 30 11 23 c4 3c 10 96 94 ad 99 19 9f 58 03 57 e7 5a ac 33
      02 01 00
   ]

< ACL Data TX: Handle 65 flags 0x00 dlen 11
      SMP: Pairing Request (0x01) len 6
        IO capability: KeyboardDisplay (0x04)
        OOB data: Authentication data from remote device present (0x01)
        Authentication requirement: Bonding, MITM, SC, No Keypresses (0x0d)
        Max encryption key size: 16
        Initiator key distribution: EncKey IdKey Sign (0x07)
        Responder key distribution: EncKey IdKey Sign (0x07)
> ACL Data RX: Handle 65 flags 0x02 dlen 11
      SMP: Pairing Response (0x02) len 6
        IO capability: DisplayOnly (0x00)
        OOB data: Authentication data not present (0x00)
        Authentication requirement: Bonding, MITM, SC, No Keypresses (0x0d)
        Max encryption key size: 16
        Initiator key distribution: EncKey IdKey Sign (0x07)
        Responder key distribution: EncKey IdKey Sign (0x07)
< ACL Data TX: Handle 65 flags 0x00 dlen 69
      SMP: Pairing Public Key (0x0c) len 64
        X: cfb9cf0a6922f4c5368c7025f15193e183e895a7ba354d6283cbb6c9ac34aafc
        Y: 9c0a76d625852440b0ccc08d56587f38f3f22a11950e3f2824e4ccc2505fd70f
> HCI Event: Number of Completed Packets (0x13) plen 5
        Num handles: 1
        Handle: 65
        Count: 2
> ACL Data RX: Handle 65 flags 0x02 dlen 27
> ACL Data RX: Handle 65 flags 0x01 dlen 27
> ACL Data RX: Handle 65 flags 0x01 dlen 15
      SMP: Pairing Public Key (0x0c) len 64
        X: acec5a11f457c40138809e618865b8ead2ea1c5f71b38deb8e3bb76c64b219a8
        Y: 9bc8d28c0f96d175c9661ec012af89b5b34f936a9a8ec6c39b75e12540eeaf76
< ACL Data TX: Handle 65 flags 0x00 dlen 21
      SMP: Pairing Random (0x04) len 16
        Random value: a307ddd44443bfbba384cc26bd51012f
> ACL Data RX: Handle 65 flags 0x02 dlen 21
      SMP: Pairing Random (0x04) len 16
        Random value: 36bd1b4d18a5a3dfcdaefeae72cb380e
< ACL Data TX: Handle 65 flags 0x00 dlen 21
      SMP: Pairing DHKey Check (0x0d) len 16
        E: 02cb188687306cd5a10cd3788bd317f3
> HCI Event: Number of Completed Packets (0x13) plen 5
        Num handles: 1
        Handle: 65
        Count: 2
> ACL Data RX: Handle 65 flags 0x02 dlen 21
      SMP: Pairing DHKey Check (0x0d) len 16
        E: 1970e360950cc322587d322f0c4e333a
< HCI Command: LE Start Encryption (0x08|0x0019) plen 28
        Handle: 65
        Random number: 0x0000000000000000
        Encrypted diversifier: 0x0000
        Long term key: a818945751ab5c2e10c6de92ed1c9130
> HCI Event: Command Status (0x0f) plen 4
      LE Start Encryption (0x08|0x0019) ncmd 1
        Status: Success (0x00)
> HCI Event: Encryption Change (0x08) plen 4
        Status: Success (0x00)
        Handle: 65
        Encryption: Enabled with AES-CCM (0x01)

Change-Id: I9e8e9bbc6c06b20938c653b71066d4f27a4028ad

5 years agoDelete temp files 69/199969/1
Seungyoun Ju [Thu, 8 Nov 2018 08:51:03 +0000 (17:51 +0900)]
Delete temp files

[Problem] Storage directory's size becomes huge (over 6MB)
 after infinite rebooting test.
[Cause & Measure] Over 1,500 temp files were created as followings.
 g_file_contents_set() creates temp file and writes contents to it. After that,
 rename temp file to destination file for atomic operation. If a device turned
 off before renaming, temp file remains and never be deleted.
 This patch deletes temp files before creating temp files.

4.0K    /opt/var/lib/bluetooth/FC:A6:21:B2:E1:7B/settings.CKX5BZ
4.0K    /opt/var/lib/bluetooth/FC:A6:21:B2:E1:7B/settings.OA76BZ
4.0K    /opt/var/lib/bluetooth/FC:A6:21:B2:E1:7B/settings.1BFTBZ
4.0K    /opt/var/lib/bluetooth/FC:A6:21:B2:E1:7B/settings.3CB9BZ

[Checking Method] Reboot device while booting

Change-Id: Ie159ef06eab6295b1f40514e4dde386a512eb5d1

5 years agoFix : Multi advertising is not working 68/199968/1
Seungyoun Ju [Fri, 2 Nov 2018 11:12:35 +0000 (20:12 +0900)]
Fix : Multi advertising is not working

[Problem] Multi advertising is not working.
[Cause & Measure] There is a condition to check if multiple advertising
 is supported or not. But the condition is not valid now so it has been
 removed.

Change-Id: I76387667f19b8c58a40416faf4fa42462782b4cb

5 years agoSend LE Set Random Address and check response 67/199967/1
Seungyoun Ju [Thu, 25 Oct 2018 09:11:59 +0000 (18:11 +0900)]
Send LE Set Random Address and check response

[Problem] HCI command Tx timeout happens.
[Cause & Measure] Vendor command is sent before Command complete event comes
 for LE Set Random Address. It causes bluetooth chip's malfunction.
 This commit fixs to check the response about LE Set Random Address. So
 that next vendor command is sent after LE Set Random Address is
 processed properly by chipset.
[Checking Method] Turn on Bluetooth > Start advertising

Change-Id: Ie757398be6d8ad71da1cc23b72ac132789df9e49

5 years agoshared/gatt-client: Fix crash on ext prop read failure 66/199966/2
Szymon Janc [Thu, 26 Jul 2018 14:34:00 +0000 (16:34 +0200)]
shared/gatt-client: Fix crash on ext prop read failure

[Problem] bluetoothd crash happens.
[Cause & Measure] There is no routine for failure case of extended
 property read response. It causes invalid memory access. There is
 upstream patch for this issue. So this patch applies the upstream patch.
[Checking Method] Disconnect BLE during GATT service discovery. This is
 some times issue.

[Original upstream patch]
commit 6e2eb99f666ea7084067196472ff8d49e06f90d9
Author: Szymon Janc <szymon.janc@codecoup.pl>
Date:   Thu Jul 26 16:34:00 2018 +0200

    shared/gatt-client: Fix crash on ext prop read failure

Program received signal SIGSEGV, Segmentation fault.

Program received signal SIGSEGV, Segmentation fault.
ext_prop_read_cb (success=false, att_ecode=0 '\000', value=0x0,
    length=0, user_data=0x72ad30) at src/shared/gatt-client.c:711
711     src/shared/gatt-client.c: No such file or directory.
(gdb) bt
0  ext_prop_read_cb (success=false, att_ecode=0 '\000', value=0x0,
                     length=0, user_data=0x72ad30)
   at src/shared/gatt-client.c:711
1  0x000000000049b8cc in disc_att_send_op (data=0x7199b0)
   at src/shared/att.c:547
2  0x000000000049cb44 in disconnect_cb (io=<optimized out>,
                       user_data=0x716070) at src/shared/att.c:580
3  0x00000000004a6405 in watch_callback (channel=<optimized out>,
                      cond=<optimized out>, user_data=<optimized out>)
   at src/shared/io-glib.c:170
4  0x00007ffff78c704a in g_main_context_dispatch ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
5  0x00007ffff78c73f0 in ?? ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
6  0x00007ffff78c7712 in g_main_loop_run ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
7  0x000000000040c620 in main (argc=1, argv=0x7fffffffe5a8)
   at src/main.c:781

Change-Id: I6f0a0b1501761693ebdbd851773878e827cd6cce

5 years agoMerge "Don't try to reconnect for A2DP source connection" into tizen accepted/tizen/unified/20190214.060733 submit/tizen/20190214.004027
Pyun DoHyun [Tue, 12 Feb 2019 04:22:17 +0000 (04:22 +0000)]
Merge "Don't try to reconnect for A2DP source connection" into tizen

5 years agoDon't try to reconnect for A2DP source connection 97/199297/1
DoHyun Pyun [Fri, 8 Feb 2019 07:46:48 +0000 (16:46 +0900)]
Don't try to reconnect for A2DP source connection

For A2DP multi connection function, we should disable
the reconnection logic for the stable streaming.

Change-Id: I57d217d9e65c7fcbcfd53cdf894236e7ee880dff
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
5 years agoModified the write fd for acquired write 08/199108/1 accepted/tizen/unified/20190212.084045 submit/tizen/20190211.065813 submit/tizen/20190211.100729
Amit Purwar [Mon, 4 Feb 2019 06:36:08 +0000 (12:06 +0530)]
Modified the write fd for acquired write

Change-Id: I2bdc6b7e925bf8d316eb6bebd32ac35328465b2b
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
5 years agoMerge "A2DP profile multiple source support" into tizen
Pyun DoHyun [Wed, 30 Jan 2019 01:05:53 +0000 (01:05 +0000)]
Merge "A2DP profile multiple source support" into tizen

5 years agoFixed disable notify for acquire notification 09/198609/1 accepted/tizen/unified/20190129.064358 submit/tizen/20190129.000858
Amit Purwar [Mon, 28 Jan 2019 05:17:45 +0000 (10:47 +0530)]
Fixed disable notify for acquire notification

Change-Id: Icf807258aa50836ffb99a7bd67740561850e4cff
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>