platform/upstream/bluez.git
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>
5 years agoA2DP profile multiple source support 77/195577/6
Avichal [Fri, 14 Dec 2018 11:18:48 +0000 (16:48 +0530)]
A2DP profile multiple source support

there will be two sources source1 and source2
pause source 1 when source2 plays and viceversa

Change-Id: I2d424ce76278f505f9c270684248a76141e8e2b9
Signed-off-by: Avichal <avichal.a@samsung.com>
5 years agogatt: Switch from pipe2 to sockepair for Acquire* 54/198154/4 accepted/tizen/unified/20190128.061448 submit/tizen/20190122.062550 submit/tizen/20190128.005753
Luiz Augusto von Dentz [Mon, 21 Jan 2019 12:23:10 +0000 (17:53 +0530)]
gatt: Switch from pipe2 to sockepair for Acquire*

This enables to use sendmsg with MSG_NOSIGNAL.

Change-Id: Ie28b0bfbec3730448e7d045d978909accab0f685
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Avichal <avichal.a@samsung.com>
5 years agoEnable the connection request event for custom obex server 22/196522/1 accepted/tizen/unified/20190103.061726 submit/tizen/20190102.044100
DoHyun Pyun [Wed, 2 Jan 2019 04:06:30 +0000 (13:06 +0900)]
Enable the connection request event for custom obex server

Change-Id: Icac1762393d4527d4fa920e5e123bcdf0ec485bf
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
5 years agoInclude btattach, btmon tools into bluez pkg 17/196017/2 accepted/tizen/unified/20181221.054439 submit/tizen/20181221.010143
Wootak Jung [Fri, 21 Dec 2018 00:55:13 +0000 (09:55 +0900)]
Include btattach, btmon tools into bluez pkg

Change-Id: I71f7e2659ce03c0a11fdd489d1a15515255b7a06

5 years agoRemove the apach license in the spec file 70/192070/1 accepted/tizen/unified/20181107.081910 submit/tizen/20181105.232950 submit/tizen/20181105.233041 submit/tizen/20181106.081159
DoHyun Pyun [Tue, 30 Oct 2018 02:24:14 +0000 (11:24 +0900)]
Remove the apach license in the spec file

Change-Id: I440381913b762cc81f732099cecc08348d8752dc
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
5 years agoFix bluez rpm installation priority 23/192023/1
Wootak Jung [Mon, 29 Oct 2018 04:05:31 +0000 (13:05 +0900)]
Fix bluez rpm installation priority

The attribute of hci* execution files is not set network_fw:network_fw,
if bluez rpm is installed before security-config rpm.

Change-Id: Ifadd19e93397a52b14aea872bb88df9f26edc4f9

5 years agoFix profile check logic to distinguish ivi and iot 03/191903/2
Wootak Jung [Thu, 25 Oct 2018 06:15:33 +0000 (15:15 +0900)]
Fix profile check logic to distinguish ivi and iot

Change-Id: I801bb263df0a43386671df7f9775ccb5530b5fee

5 years agoconnect_le is failing for autoconnect 92/188792/1 accepted/tizen/5.0/unified/20181102.022516 accepted/tizen/unified/20181001.092613 submit/tizen/20180928.032653 submit/tizen/20180928.052011 submit/tizen_5.0/20181101.000005
Abhishek Chandra [Mon, 10 Sep 2018 09:01:51 +0000 (14:31 +0530)]
connect_le is failing for autoconnect

[Problem] connect_le api is failing when user set
autoconnect as true .
[Cause] when auto connect is true ,
device_set_auto_connect is called
to set device autoconnect parametes and
it is return back . device_connect_le call is
not called in this case .
[Fix] Removed the dbus_message_new_method_return .
[Verification] verified by code review in upstream
bluez code and also tested by using unit test
in platform.

Change-Id: I09e3d8e1e9169cb734419f9516ba39800ee309ee
Signed-off-by: Abhishek Chandra <abhishek.ch@samsung.com>
5 years agoModify dbus policies based on default deny 21/187621/4
Wootak Jung [Mon, 27 Aug 2018 02:06:12 +0000 (11:06 +0900)]
Modify dbus policies based on default deny

- Remove receive_sender policies
- Combine deny policies

Change-Id: Ic3d691111443589b2896d5bbfde4eae328e996aa

5 years agoSet HID security level to medium. 63/186863/1
Deokhyun Kim [Thu, 16 Aug 2018 05:10:09 +0000 (14:10 +0900)]
Set HID security level to medium.

  - HID should be connected after bonding completes

Change-Id: I48ac572ee7873796bae50194512a86a32262e794
Signed-off-by: Deokhyun Kim <dukan.kim@samsung.com>
5 years agoFix : device_get_ida is failed 67/186667/1
Seungyoun Ju [Mon, 13 Aug 2018 08:34:18 +0000 (17:34 +0900)]
Fix : device_get_ida is failed

[Problem] device_get_ida returns unsupported error code for paired RPA device
[Cause & Measure] Paired RPA device's bdaddr type can be public because
 device.bdaddr has identity address. But old condition assumes that bdaddr
 type should be random. So unsupported error code is returned. This fix
 checks each case and returns proper error codd or result.

Change-Id: I435a354d956a6208129e83cbad32a0b594aec39a

5 years agoImplement 'Get Phy Configuration' MGMT command 18/186018/6
Anupam Roy [Mon, 6 Aug 2018 17:16:01 +0000 (22:46 +0530)]
Implement 'Get Phy Configuration' MGMT command

This patch implements MGMT_OP_GET_PHY_CONFIGURATION
operation if MGMT interface supports PHY Configuration
setting. It introduces two new adapter properties
(l2 2m phy and le coded phy). These properties are filled
upon getting response from kernel about supported phys's.
which are then exported to user by 'SupportedLEFeatures'
adapter property.

This mgmt command supports reading above parameters in bit fields,
based on LE PHY (1M, 2M & CODED) and also
BREDR packet types as following-

 - BR 1M  (1 SLOT, 3 SLOT, 5 SLOT)
 - EDR 2M (1 SLOT, 3 SLOT, 5 SLOT)
 - EDR 3M (1 SLOT, 3 SLOT, 5 SLOT)
 - 1M TX, 1M RX
 - 2M TX, 2M RX
 - CODED TX, CODED RX

Verification logs based on BT 5.0 controller -

bluetoothd[637]: src/adapter.c:get_phy_configuration_resp() Supported phys: [0x7e00]
bluetoothd[637]: src/adapter.c:get_phy_configuration_resp() Configurable phys: [0x7800]
bluetoothd[637]: src/adapter.c:get_phy_configuration_resp() Selected phys: [0x600]
bluetoothd[637]: src/adapter.c:get_phy_configuration_resp() Adapter supports LE 2M PHY
bluetoothd[637]: src/adapter.c:get_phy_configuration_resp() Adapter supports LE CODED PHY

Change-Id: I9ec3565b5d1b9a0de3daea666d34754958bb1550
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
5 years agoAdd defines for BREDR packet types 16/186016/3
Anupam Roy [Mon, 6 Aug 2018 17:03:39 +0000 (22:33 +0530)]
Add defines for BREDR packet types

This patch defines BREDR packet types
in management interface as following

- MGMT_PHY_BR_1M_1SLOT    0x00000001
- MGMT_PHY_BR_1M_3SLOT    0x00000002
- MGMT_PHY_BR_1M_5SLOT    0x00000004
- MGMT_PHY_EDR_2M_1SLOT   0x00000008
- MGMT_PHY_EDR_2M_3SLOT   0x00000010
- MGMT_PHY_EDR_2M_5SLOT   0x00000020
- MGMT_PHY_EDR_3M_1SLOT   0x00000040
- MGMT_PHY_EDR_3M_3SLOT   0x00000080
- MGMT_PHY_EDR_3M_5SLOT   0x00000100

Also, it fixes parameters for response of
MGMT_OP_GET_PHY_CONFIGURATION operation.
mgmt_rp_get_phy_confguration structure will now
contain three parameters as following

 - Supported_phys;
 - Configurable_phys;
 - Selected_phys;

Change-Id: Ia3d0c83473807d91d48eb7594c44595eca9c2a0d
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
5 years agodevice : Return proper error code for get_ida 07/186007/1
Seungyoun Ju [Mon, 6 Aug 2018 11:25:58 +0000 (20:25 +0900)]
device : Return proper error code for get_ida

[Problem] There is no way to know if remote device is not bonded or it
 doesn't support IDA (i.e. BR/EDR device, LE Static random address or
 non-RPA used device).
[Cause & Measure] We consider only LE RPA device. So return not
 supported error code for others.
[Checking Method] N/A

Change-Id: I734a468a64cc85fa6aac08a9f0621dd95c44217c

5 years agoUpdate rpa on VSC advertising 86/185986/1
injun.yang [Mon, 21 May 2018 08:36:44 +0000 (17:36 +0900)]
Update rpa on VSC advertising

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

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

[Problem] The updated rpa is not applied on VSC advertising
[Cause & Measure] When rpa changed, report it to bluetoothd.
 If device doing multiple adv, bluetoothd will update rpa.
[Checking Method] When rpa updated, check the address of advertiser

[Team] Basic Connection
[Developer] Injun Yang
[Solution company] Samsung
[Change Type] Specification change

Change-Id: I967e8eca52d9de1a0e140ee70abcd18392a1ea1b
Signed-off-by: injun.yang <injun.yang@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
5 years agomonitor: Add PHY management support 85/185985/1
Anupam Roy [Mon, 6 Aug 2018 06:16:02 +0000 (11:46 +0530)]
monitor: Add PHY management support

This patch adds support of PHY management
and consolidation of code printing bitfield

Taken from following upstream commits-
 commit dad3ca2f417d9330f6f3bc33cfee5d0b24985a5d
 commit 426693e8457326ee686e46a2c9f535b9367a55d7
 commit e566be15ce03283978c35b2ab8462504da3fee63
 commit e862f704eeff14818fcc00a57271bd6907285ad7

Change-Id: I3582308f50423b916cec7d900fcf41dc9b4c4dc6
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
5 years agobtmgmt: Add PHY configuration get/set commands 17/185817/1
Anupam Roy [Wed, 1 Aug 2018 14:54:58 +0000 (20:24 +0530)]
btmgmt: Add PHY configuration get/set commands

Taken from following upstream commit-
commit dca915f54c1f969d977e9433d336bf3f6264632b

Change-Id: Ic8842ad0687c607b4606648f0813221d0c18c4c7
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
6 years agoFix Coverity issue (Id:860268) 42/183742/1 accepted/tizen/unified/20180717.063044 accepted/tizen/unified/20180801.080107 submit/tizen/20180715.232650 submit/tizen/20180731.041022
Atul Rai [Tue, 10 Jul 2018 11:37:38 +0000 (17:07 +0530)]
Fix Coverity issue (Id:860268)

Change-Id: I9e784c6eca9a94fb9b5b5ad340aee09b7bc2b65d
Signed-off-by: Atul Rai <a.rai@samsung.com>
6 years agoChange the name of dbus property of EIR manufacturer data 40/182940/1 submit/tizen/20180710.070923
injun.yang [Fri, 29 Jun 2018 04:38:42 +0000 (13:38 +0900)]
Change the name of dbus property of EIR manufacturer data

Same property for adv is introduced in upstream

Change-Id: I841c525a334ad337b41b3153c7958731358ea260
Signed-off-by: injun.yang <injun.yang@samsung.com>
6 years agoCFLAGS is accumulated each profile is built 04/181804/2 accepted/tizen/unified/20180620.131454 submit/tizen/20180619.032800
Seungyoun Ju [Mon, 18 Jun 2018 10:10:53 +0000 (19:10 +0900)]
CFLAGS is accumulated each profile is built

[Problem] CFLAGS is accumulated each profile is built
[Cause & Measure] Store default CFLAGS and before compiling a profile
 reset CFLAGS using saved one.

Change-Id: I5d2e37852a2829978ef5bf6a7a75942494b9fdba

6 years agoemulator: sync with upstream 83/181483/1 submit/tizen/20180614.065332 submit/tizen/20180617.234448
Anupam Roy [Thu, 14 Jun 2018 06:49:59 +0000 (12:19 +0530)]
emulator: sync with upstream

This patch comes from below commits of upstream
=====================================================================
commit 98a77944e6d3d5706647bfa7235c175b32173436
Author: ERAMOTO Masaya <eramoto.masaya@jp.fujitsu.com>
Date:   Mon Apr 23 18:00:37 2018 +0900

   emulator/b1ee: Enable to specify host and port

   Removes the DEFAULT_SERVER macro because the default host seems to be
   unofficial since 2017.

commit b54111d2a432cdbd4926cce8be5b119b298e8477
Author: Łukasz Rymanowski <lukasz.rymanowski@codecoup.pl>
Date:   Fri Feb 9 18:26:25 2018 +0100

    emulator: Add initial LE states to btdev and API to set new one
=====================================================================

Change-Id: I9f94927c0b6f6dcf712ca137548691dfda53783a
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
6 years agobuild: Add testing config option 94/181194/1
Anupam Roy [Mon, 11 Jun 2018 04:19:20 +0000 (09:49 +0530)]
build: Add testing config option

This patch comes from below commit of upstream
========================================================
commit df43b3dad829e8b7f79fd15c20d997f50e745ae7
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date:   Wed Jan 4 15:24:45 2017 +0200

    build: Add testing config option

    This adds --enable-testing that can be used to enable emulator and tester
    which are no longer experimental but also are not meant for production.
========================================================

Change-Id: I41edb9f1b726340dde4a22bc705a68b5bceea4c9
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
6 years agoAdd headless device handling logic 01/180801/2 accepted/tizen/unified/20180611.015238 submit/tizen/20180607.003351
Wootak Jung [Mon, 4 Jun 2018 09:30:00 +0000 (18:30 +0900)]
Add headless device handling logic

Change-Id: Iee83a7af02901787e3697d95f86ecf79103b9b67

6 years agoDisable SSP mode in headless device 53/180753/2
Wootak Jung [Mon, 4 Jun 2018 00:58:33 +0000 (09:58 +0900)]
Disable SSP mode in headless device

Change-Id: I873f64b49887825f5a079306b41a03961b22bbee

6 years agoMerge "Fix LE device found event" into tizen
Pyun DoHyun [Fri, 1 Jun 2018 00:29:53 +0000 (00:29 +0000)]
Merge "Fix LE device found event" into tizen

6 years agoAdd a debug log for debugging 54/180654/3
Wootak Jung [Fri, 1 Jun 2018 00:02:41 +0000 (09:02 +0900)]
Add a debug log for debugging

Change-Id: Ibf98b251668fd5f73f518431da4330bc1e56d54b

6 years agoFix LE device found event 31/180631/2
Atul Rai [Thu, 31 May 2018 10:09:29 +0000 (15:39 +0530)]
Fix LE device found event

Issue: Paired devices are not detected during LE scan while
paired device is advertising
This patch fixes this issue.

Change-Id: I1b9f06c3d057204cb01fe88faedaa5ace399c26b
Signed-off-by: Abhishek Chandra <abhishek.ch@samsung.com>
Signed-off-by: Atul Rai <a.rai@samsung.com>
6 years agoAdd headless device handling logic 22/180622/2 submit/tizen/20180531.061844
Wootak Jung [Thu, 31 May 2018 08:12:42 +0000 (17:12 +0900)]
Add headless device handling logic

Change-Id: I0b7fa8f982e4b455b245e5c66b1fdc7ecb6289ca

6 years agoFix access deny issue on dbus policy 68/180568/1
Wootak Jung [Thu, 31 May 2018 01:16:38 +0000 (10:16 +0900)]
Fix access deny issue on dbus policy

Deny policy in context="default" has been applied
because of incorrect policy in other context.

Change-Id: I6185a0d784c0f082276bb4a1e002e3b86ddd9bff

6 years agoFix the crash 10/180410/1
injun.yang [Tue, 29 May 2018 07:46:13 +0000 (16:46 +0900)]
Fix the crash

gdb) bt
0  0x00520b98 in ext_prop_read_cb (success=false, att_ecode=0 '\000', value=0x0, length=0, user_data=0xad5310) at src/shared/gatt-client.c:746
1  0x0051e62a in read_cb (opcode=<optimized out>, pdu=<optimized out>, length=<optimized out>, user_data=<optimized out>) at src/shared/gatt-client.c:2418
2  0x0051d5a6 in disc_att_send_op (data=0xad5cd0) at src/shared/att.c:569
3  0x0051dffc in disconnect_cb (io=<optimized out>, user_data=0xadb400) at src/shared/att.c:602
4  0x00524298 in watch_callback (channel=<optimized out>, cond=<optimized out>, user_data=<optimized out>) at src/shared/io-glib.c:170
5  0xf75318e8 in g_main_dispatch (context=0xac5f80) at gmain.c:3234
6  g_main_context_dispatch (context=context@entry=0xac5f80) at gmain.c:3887
7  0xf7531c78 in g_main_context_iterate (context=0xac5f80, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3960
8  0xf7531fd8 in g_main_loop_run (loop=0xac5ee0) at gmain.c:4156
9  0x004b032c in main (argc=<optimized out>, argv=<optimized out>) at src/main.c:723
gdb) bt full 3
0  0x00520b98 in ext_prop_read_cb (success=false, att_ecode=0 '\000', value=0x0, length=0, user_data=0xad5310) at src/shared/gatt-client.c:746
op = 0xad5310
client = <optimized out>
discovering = 247
desc_attr = <optimized out>
1  0x0051e62a in read_cb (opcode=<optimized out>, pdu=<optimized out>, length=<optimized out>, user_data=<optimized out>) at src/shared/gatt-client.c:2418
req = <optimized out>
op = <optimized out>
success = <optimized out>
att_ecode = <optimized out>
value = 0x0
value_len = <optimized out>
2  0x0051d5a6 in disc_att_send_op (data=0xad5cd0) at src/shared/att.c:569
op = 0xad5cd0

Change-Id: I6f817e21a4a75c3c36f62d1d102e189be5088968

6 years agoModify the deny policy 59/179859/1
DoHyun Pyun [Wed, 23 May 2018 04:49:17 +0000 (13:49 +0900)]
Modify the deny policy

Change-Id: I56e778e62aca7c9fba729e740b11e84e96872fa9
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
6 years agoMerge "Fix : Address is wrong in GATT Callback" into tizen
Pyun DoHyun [Tue, 22 May 2018 23:31:48 +0000 (23:31 +0000)]
Merge "Fix : Address is wrong in GATT Callback" into tizen

6 years agoRemoved unnecessary compilation flags 85/179485/3
Atul Rai [Fri, 18 May 2018 06:44:46 +0000 (12:14 +0530)]
Removed unnecessary compilation flags

Change-Id: I2af88a3f6bd6645857826c58eefee97d5dbb46b5
Signed-off-by: Atul Rai <a.rai@samsung.com>
6 years ago[Mesh] Adapt meshctl for Tizen platform 82/179482/2
Atul Rai [Fri, 18 May 2018 03:00:26 +0000 (08:30 +0530)]
[Mesh] Adapt meshctl for Tizen platform

Change-Id: I094dd7ecd8f41f9db79cead816b870de18e0330b
Signed-off-by: Atul Rai <a.rai@samsung.com>
6 years agoFix : Address is wrong in GATT Callback 61/179461/1
injun.yang [Thu, 17 May 2018 09:33:56 +0000 (18:33 +0900)]
Fix : Address is wrong in GATT Callback

[Problem] Address is wrong in GATT read/write callback
[Cause & Measure] Bluez pass IDA instead of first RPA.
 If rpa existed then pass it into GATT read/write callback.
[Checking Method] GATT read/write in server

Change-Id: Id26144ca307572ae9ff6839a033f986f21285cb9

6 years agoMerge "Import meshctl & bt-shell related apis and fixes" into tizen
Pyun DoHyun [Fri, 18 May 2018 03:01:11 +0000 (03:01 +0000)]
Merge "Import meshctl & bt-shell related apis and fixes" into tizen

6 years agoMerge "Fix Memory leak" into tizen
Pyun DoHyun [Thu, 17 May 2018 23:54:50 +0000 (23:54 +0000)]
Merge "Fix Memory leak" into tizen

6 years agoMerge "Fix possible invalid memory access" into tizen
Pyun DoHyun [Thu, 17 May 2018 23:54:41 +0000 (23:54 +0000)]
Merge "Fix possible invalid memory access" into tizen

6 years agoFix possible invalid memory access 06/179406/1
Nagaraj D R [Thu, 17 May 2018 15:03:36 +0000 (20:33 +0530)]
Fix possible invalid memory access

Uninitialized data is read from local variable 'addr'

Change-Id: Id8288428e93a8dda08d67a507fd97caf5fae080e

6 years agoFix Memory leak 02/179402/1
Nagaraj D R [Thu, 17 May 2018 14:28:03 +0000 (19:58 +0530)]
Fix Memory leak

Memory associated with 'adv_data' will be leaked in case of
'generate_scan_rsp' failure

Change-Id: I57fdaa060ecfbf59f03ca16e074ddce7a8e14c9d

6 years agoFix improper usage of g_free 90/179390/2
Nagaraj D R [Thu, 17 May 2018 12:42:59 +0000 (18:12 +0530)]
Fix improper usage of g_free

g_free should be used for only those memory allocations
done through glib APIs

Change-Id: I5d5275574b0d273594f86786956d86355794db94

6 years agosrc/device.c : Fix BREDR-ATT MTU issue 89/179389/2
Nagaraj D R [Thu, 17 May 2018 10:50:05 +0000 (16:20 +0530)]
src/device.c : Fix BREDR-ATT MTU issue

For BREDR-ATT, according to spec, ATT MTU is same has
L2CAP configured MTU on which ATT is running and there won't be
ATT MTU exchange procedure. So, set the MTU to L2CAP MTU for
BREDR-ATT and for LE-ATT adjust the ATT MTU based on
EXCHANGE_MTU request and response.

Change-Id: Icd402edbfa7ddb82e808ebf695096b7a872ebc14

6 years agoFix bluetoothd crash issue 88/179388/3
Nagaraj D R [Thu, 17 May 2018 12:13:23 +0000 (17:43 +0530)]
Fix bluetoothd crash issue

Bluetoothd crashes when any application invokes "Introspect"
dbus method call on device-interface hosted by any device object path.

Declaration of device_signals is corrected

call stack
0  0xb6bfc3ee in strlen () from /lib/libc.so.6
1  0xb6bc69e4 in vfprintf () from /lib/libc.so.6
2  0xb6c65db0 in __vasprintf_chk () from /lib/libc.so.6
3  0xb6dbe404 in g_vasprintf () from /lib/libglib-2.0.so.0
4  0xb6da5dac in g_string_append_vprintf () from /lib/libglib-2.0.so.0
5  0xb6da5e7c in g_string_append_printf () from /lib/libglib-2.0.so.0
6  0xb6efbe94 in print_arguments (gstr=gstr@entry=0xb7f521a0,
    args=0xb6f221fc, direction=direction@entry=0x0) at gdbus/object.c:123
7  0xb6efc624 in generate_interface_xml (iface=<optimized out>,
    gstr=0xb7f521a0) at gdbus/object.c:187
8  generate_introspection_xml (data=0xb7f538a0, data=0xb7f538a0,
    path=0xb7f462e0 "/org/bluez/hci0/dev_E4_FA_ED_DF_2C_2D", conn=0xb7f40590)
    at gdbus/object.c:236
9  introspect (connection=0xb7f40590, message=0xb7f44908,
    user_data=0xb7f538a0) at gdbus/object.c:263
10 0xb6efd13a in process_message (connection=connection@entry=0xb7f40590,
    message=message@entry=0xb7f44908,
    iface_user_data=iface_user_data@entry=0xb7f538a0,
    method=0xb6f42324 <introspect_methods>,
    method=0xb6f42324 <introspect_methods>) at gdbus/object.c:282
11 0xb6efd3b8 in generic_message (connection=0xb7f40590, message=0xb7f44908,
    user_data=<optimized out>) at gdbus/object.c:1106

Change-Id: I8bd5c0e575f23f29945df49bbc3a807d55829989

6 years agoImport meshctl & bt-shell related apis and fixes 92/179392/2
Atul Rai [Thu, 17 May 2018 11:48:04 +0000 (17:18 +0530)]
Import meshctl & bt-shell related apis and fixes

This patch imports the new meshctl and bt-shell apis and fixes from
open source bluez (https://git.kernel.org/pub/scm/bluetooth/bluez.git).

Change-Id: Iffa5b474c3246938f2b907eabd58c43a7e36c34a
Signed-off-by: Atul Rai <a.rai@samsung.com>
6 years agoRevert "Fix : GATT Client invokes the callback of send_op when att_send_op is canceled" 84/179184/1
injun.yang [Wed, 16 May 2018 07:28:36 +0000 (16:28 +0900)]
Revert "Fix : GATT Client invokes the callback of send_op when att_send_op is canceled"

This reverts commit f822b480166cd56c3ca8ef2b507ce242453ed582.

Upstream patch (22737d...) has been applied
 to fix an issue which was resolved by Tizen patch.
 So this patch reverts the related Tizen patch.

Change-Id: I64987117adbec00cd8299b72434eb132f5a1d59e
Signed-off-by: injun.yang <injun.yang@samsung.com>