Manish Mandlik [Wed, 25 Nov 2020 20:18:46 +0000 (12:18 -0800)]
adv_monitor: Update log messages
Update log messages to avoid breaking of user-visible log strings
to make it easy to grep for them.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Manish Mandlik [Thu, 3 Dec 2020 03:46:52 +0000 (19:46 -0800)]
client: Use correct root path for RegisterMonitor
Bluetoothctl uses "/" as the app root path. So, use the same
app root path while invoking RegisterMonitor method. This will
also ensure that InterfacesAdded/InterfacesRemoved signals are
emitted on the correct app root path.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Manish Mandlik [Thu, 3 Dec 2020 03:46:51 +0000 (19:46 -0800)]
adv_monitor: Register client app with app-root-path
When a client app is registered with g_dbus_client_new(), bluez root
path, i.e. "/", is used as the app root path and signal watches are
added at that root path.
Because of this, InterfacesAdded/InterfacesRemoved signals emitted by
app - while creating/removing advertisement monitor objects at the
app root path - are not received by bluetoothd.
Use g_dbus_client_new_full() to register a client app with the correct
app root path.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 1 Dec 2020 23:10:30 +0000 (15:10 -0800)]
main.conf: Fix using wrong field for PageTimeout
The correct field is btd_opts.defaults.br.page_timeout.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 1 Dec 2020 22:24:50 +0000 (14:24 -0800)]
main.conf: Use BR instead of BREDR as group name
This align with latest version of main.conf that does use [BR] instead
of [BREDR].
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Daniel Winkler [Tue, 24 Nov 2020 17:31:23 +0000 (09:31 -0800)]
tools/mgmt-tester: Add tests for individual ext adv MGMT commands
The new extended advertising MGMT commands are paired, requiring both a
Set Parameters and Set Data command to configure a new advertisement.
This patch adds the following new tests to test these APIs:
1. Verify that if the adapter is unpowered, MGMT_OP_ADD_EXT_ADV_PARAMS
will return a rejected status.
2. Verify that MGMT_OP_ADD_EXT_ADV_PARAMS will return an invalid
parameters status if the data payload is malformed.
3. Verify that MGMT_OP_ADD_EXT_ADV_PARAMS is successful on BT4 if
request is valid by checking MGMT return value.
4. Verify that MGMT_OP_ADD_EXT_ADV_PARAMS is successful on BT5 if
request is valid by checking MGMT return value and that HCI traffic
contains a correct advertising parameters request.
5. Verify that if a MGMT_OP_ADD_EXT_ADV_DATA request is received for an
advertising instance that is unknown, i.e. MGMT_OP_ADD_EXT_ADV_PARAMS
was not yet called, an invalid parameters status is returned.
Tests 6-8 first call MGMT_OP_ADD_EXT_ADV_PARAMS successfully in setup to
then validate the contents of the subsequent MGMT_OP_ADD_EXT_ADV_DATA
call.
6. Verify that if MGMT_OP_ADD_EXT_ADV_DATA is passed an invalid tlv
structure, an invalid parameters status is returned.
7. Verify that if MGMT_OP_ADD_EXT_ADV_DATA contains a valid structure,
the hci traffic contain a correctly formed Adv Data hci request.
8. Verify that if MGMT_OP_ADD_EXT_ADV_DATA contains a valid structure,
the hci traffic contain a correctly formed Adv Scan Response hci
request.
Reviewed-by: Manish Mandlik <mmandlik@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Daniel Winkler [Tue, 24 Nov 2020 17:31:22 +0000 (09:31 -0800)]
tools/mgmt-tester: Add mgmt-tester coverage for controller capabilities
This patch adds two test cases for the new Read Controller
Capabilities MGMT command. Since the command itself is simple, the test
cases are simple as well:
1. Ensures that providing invalid parameters to the request will result
in a failed MGMT response.
2. Ensures that if the controller is BT5 compliant, the Read Controller
Capabilities command will return a valid TX power range as expected,
otherwise fail.
Reviewed-by: Manish Mandlik <mmandlik@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Sonny Sasaka [Mon, 30 Nov 2020 21:56:02 +0000 (13:56 -0800)]
battery: Implement Battery Provider API
This patch implements the BatteryProvider1 and BatteryProviderManager1
API. This is a means for external clients to feed battery information to
BlueZ if they handle some profile and can decode battery reporting.
The battery information is then exposed externally via the existing
Battery1 interface. UI components can consume this API to display
Bluetooth peripherals' battery via a unified BlueZ API.
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Sonny Sasaka [Mon, 30 Nov 2020 21:56:01 +0000 (13:56 -0800)]
adapter: Add a public function to find a device by path
The public function is motivated by the Battery Provider API code which
needs to probe whether a device exists.
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Sonny Sasaka [Mon, 30 Nov 2020 21:56:00 +0000 (13:56 -0800)]
test: Add test app for Battery Provider API
The python test app simulates an application registering to BlueZ as a
Battery Provider providing three fake batteries drained periodically.
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Sonny Sasaka [Mon, 30 Nov 2020 21:55:59 +0000 (13:55 -0800)]
doc: Add Battery Provider API doc
This patch add the documentation of the Battery Provider which lets
external clients feed battery information to BlueZ if they are able to
decode battery reporting via any profile. BlueZ UI clients can then use
the org.bluez.Battery1 API as a single source of battery information
coming from many different profiles.
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Sonny Sasaka [Mon, 30 Nov 2020 21:55:58 +0000 (13:55 -0800)]
battery: Add Source property to Battery API
As Battery API will be generalized for other battery reporting
protocols, the Source property is useful for diagnostics purposes.
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Sonny Sasaka [Mon, 30 Nov 2020 21:55:57 +0000 (13:55 -0800)]
profiles/battery: Refactor to use battery library
This refactors profiles/battery to use the internal battery library that
handles the D-Bus intricacies so that profiles/battery only handles the
GATT BAS concerns.
Reviewed-by: Daniel Winkler <danielwinkler@google.com>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Sonny Sasaka [Mon, 30 Nov 2020 21:55:56 +0000 (13:55 -0800)]
battery: Add the internal Battery API
This patch adds an API for internal BlueZ code to expose battery
information to org.bluez.Battery1 interface. The motivation behind this
is that there is going to be other places than GATT BAS handler that
exposes battery information, for example internal plugins and the
BatteryProvider1 D-Bus API for external clients.
Reviewed-by: Daniel Winkler <danielwinkler@google.com>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Mon, 30 Nov 2020 19:16:11 +0000 (11:16 -0800)]
a2dp: Fix crash if setup is freed while reconfiguring
This fixes the crash reported on:
https://github.com/bluez/bluez/issues/60
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Ronan Pigott [Tue, 24 Nov 2020 22:46:58 +0000 (15:46 -0700)]
main.conf: use correct key for BREDR configuration
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Tedd Ho-Jeong An [Fri, 20 Nov 2020 20:07:12 +0000 (12:07 -0800)]
lib: Fix the unchecked return value
This patch fixes the unchecked return value.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Tedd Ho-Jeong An [Fri, 20 Nov 2020 20:07:11 +0000 (12:07 -0800)]
profile/bnep: Fix the unchecked return value
This patch fixes the unchecked return value.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Tedd Ho-Jeong An [Fri, 20 Nov 2020 20:07:10 +0000 (12:07 -0800)]
emulator: Fix the unchecked return value
This patch fixes the unchecked return value.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Tedd Ho-Jeong An [Fri, 20 Nov 2020 20:07:09 +0000 (12:07 -0800)]
btio: Fix the unchecked return value
This patch fixes the unchecked return value.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Tedd Ho-Jeong An [Fri, 20 Nov 2020 20:07:08 +0000 (12:07 -0800)]
monitor: Fix the unchecked return value
This patch fixes the unchecked return value.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Tedd Ho-Jeong An [Fri, 20 Nov 2020 20:07:07 +0000 (12:07 -0800)]
monitor: Fix potential memory leak
If the mainloop_add_fd() returns with failure, the destroy callback is
never called so any reosurces need to be released never freed/closed.
This potential leakage is checked with valgrind after failing the
mainloop_add_fd() function manually.
==258684== 1,500 bytes in 1 blocks are definitely lost in loss record 3 of 3
==258684== at 0x483BB1A: calloc (vg_replace_malloc.c:760)
==258684== by 0x123F1A: open_channel (control.c:1058)
==258684== by 0x125B09: control_tracing (control.c:1540)
==258684== by 0x122764: main (main.c:255)
==258684==
==258684== LEAK SUMMARY:
==258684== definitely lost: 1,500 bytes in 1 blocks
==258684== indirectly lost: 0 bytes in 0 blocks
==258684== possibly lost: 0 bytes in 0 blocks
==258684== still reachable: 48 bytes in 2 blocks
==258684== suppressed: 0 bytes in 0 blocks
This patch frees/closes the resources if the function returns with
failure.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Mon, 23 Nov 2020 18:20:06 +0000 (10:20 -0800)]
a2dp: Fix crash when SEP codec has not been initialized
If SEP has not been properly discovered avdtp_get_codec may return NULL
thus causing crashes such as:
https://github.com/bluez/bluez/issues/57
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Dean Camera [Fri, 20 Nov 2020 01:42:46 +0000 (12:42 +1100)]
hog: Fix stripping off read report bytes
If the HID subsystem requests a HID report to be read from the
device, we currently incorrectly strip off the first byte of the
response, if the device has report IDs set in the HID report
descriptor.
This is incorrect; unlike USB HID, the report ID is *not* included
in the HOG profile's HID reports, and instead exists out of band
in a descriptor on the report's bluetooth characteristic in the
device.
In this patch, we remove the erroneous stripping of the first
byte of the report, and (if report IDs are enabled) prepend the
report ID to the front of the result. This makes the HID report
returned indentical in format to that of a USB HID report, so
that the upper HID drivers can consume HOG device reports in the
same way as USB.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Pavel Maltsev [Thu, 19 Nov 2020 21:43:37 +0000 (21:43 +0000)]
gatt: Fix duplicate free for GATT service includes
Objects in the service->includes queue are obtained via
dbus_message_iter_get_basic call and according to the
contract for the value is that it is returned by the reference
and should not be freed thus we should make a copy.
This will fix the issue when the GATT service app is disconnected
(reproduced with gatt-service included in bluez), bluetoothd is crashing:
bluetoothd: src/gatt-database.c:gatt_db_service_removed() Local GATT service removed
bluetoothd: src/adapter.c:adapter_service_remove() /org/bluez/hci0
bluetoothd: src/adapter.c:remove_uuid() sending remove uuid command for index 0
bluetoothd: src/sdpd-service.c:remove_record_from_server() Removing record with handle 0x10006
bluetoothd: src/gatt-database.c:proxy_removed_cb() Proxy removed - removing service: /service1
munmap_chunk(): invalid pointer
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 17 Nov 2020 21:58:37 +0000 (13:58 -0800)]
test-runner: Move code kill processes created
This moves the code that kill processes outside of the loop iteration.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 17 Nov 2020 20:31:28 +0000 (12:31 -0800)]
btdev: Fix not emitting Ext Connection Complete properly
le_meta_event must be using when emitting a meta event.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 17 Nov 2020 19:01:57 +0000 (11:01 -0800)]
test-runner: Use multidevs=remap when mounting rootfs
This avoid inode collisions when the host has multiple fs to be mapped
to the rootfs on the guest.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 17 Nov 2020 18:51:11 +0000 (10:51 -0800)]
test-runner: Change qemu output
This changes the serial device to include mux=on which enables the
output of early kernel logs.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Szymon Janc [Tue, 17 Nov 2020 15:57:03 +0000 (16:57 +0100)]
device: Update cache only if content changed
This fix hammering storage device (eg sdcard) when doing scanning
and LE devices are around.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Mon, 16 Nov 2020 22:01:34 +0000 (14:01 -0800)]
main.conf: Add option to configure AVDP session/stream channel modes
This adds a new group AVDTP where platform can configure the preferred
L2CAP channel modes for both session (signalling) and stream
(transport). For backward compatibility the both SessionMode and
StreamMode defaults to basic mode.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Mon, 16 Nov 2020 19:08:16 +0000 (11:08 -0800)]
avdtp: Fix connecting using streaming mode with signalling channel
Signalling channel shall only use Basic or ERTM modes.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Manish Mandlik [Mon, 16 Nov 2020 18:41:08 +0000 (10:41 -0800)]
adv_monitor: Fix remove monitor from the kernel
A monitor is removed in the following scenarios:
- monitor dbus object removed by the app
- monitor removed by the kernel
- client app invokes UnregisterMonitor()
- client app is killed/disconnected
- AdvMonitorManager is destroyed
In the first case, we need to remove the corresponding monitor from the
kernel and free the bluez monitor object.
In the second case, we need to call the Release() method on the
corresponding dbus monitor object and free the bluez monitor object.
Kernel may remove all monitors and send MGMT_EV_ADV_MONITOR_REMOVED
event to bluez. In such case, we need to call Release() method on all
monitors from all registered apps, and free the bluez monitor objects.
In the third case, we need to call the Release() method on the monitor
objects created by the app, remove corresponding monitors from the
kernel and then free the bluez monitor object.
In the fourth case, since the app is not available, all the dbus monitor
objects created by that app are also unavailable. So, we just need to
remove corresponding monitors from the kernel and then free the bluez
monitor objects.
In the fifth case, we need to call Release() method on all monitors from
all registered apps, remove corresponding monitors from the kernel and
then free the bluez monitor objects.
When app exits or gets killed without removing the dbus monitor objects
and without invoking the UnregisterMonitor() method, a race condition
could happen between app_destroy and monitor_proxy_removed since dbus
objects hosted by the app are destroyed on app exit.
This patch fixes the first, second and fourth cases ensuring that
monitors from the kernel are removed correctly, Release() method is
invoked whenever necessary and bluez monitor objects are freed only
once.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Fri, 13 Nov 2020 23:07:03 +0000 (15:07 -0800)]
test-runner: Add option to start monitor
This adds an option (-m/--monitor) to start btmon before the command
running the command/tester which is convenient when a tests results in
HCI traffic which are decoded by hciemu as it only prints the hexdump.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 11 Nov 2020 22:42:36 +0000 (14:42 -0800)]
bthost: Fix sending uninitilized data
Syscall param writev(vector[...]) points to uninitialised byte(s)
at 0x4A8A497: writev (in /usr/lib64/libc-2.31.so)
by 0x1365C1: send_packet (bthost.c:509)
by 0x1365C1: send_packet (bthost.c:492)
by 0x1365C1: next_cmd (bthost.c:737)
by 0x137578: evt_cmd_complete (bthost.c:882)
by 0x137578: process_evt (bthost.c:1343)
by 0x137578: bthost_receive_h4 (bthost.c:2414)
by 0x12DF49: receive_bthost.part.0 (hciemu.c:134)
by 0x48B978E: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.6400.6)
by 0x48B9B17: ??? (in /usr/lib64/libglib-2.0.so.0.6400.6)
by 0x48B9E32: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.6400.6)
by 0x14A664: mainloop_run (mainloop-glib.c:66)
by 0x14AA41: mainloop_run_with_signal (mainloop-notify.c:188)
by 0x149A7B: tester_run (tester.c:871)
by 0x129C77: main (mgmt-tester.c:10219)
Address 0x4c48c05 is 21 bytes inside a block of size 280 alloc'd
at 0x483CAE9: calloc (vg_replace_malloc.c:760)
by 0x136487: queue_command (bthost.c:472)
by 0x136487: send_command (bthost.c:715)
by 0x13948A: bthost_set_ext_adv_enable (bthost.c:2581)
by 0x12CEBF: trigger_device_found (mgmt-tester.c:8513)
by 0x148C9A: wait_callback (tester.c:749)
by 0x48BA330: ??? (in /usr/lib64/libglib-2.0.so.0.6400.6)
by 0x48B978E: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.6400.6)
by 0x48B9B17: ??? (in /usr/lib64/libglib-2.0.so.0.6400.6)
by 0x48B9E32: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.6400.6)
by 0x14A664: mainloop_run (mainloop-glib.c:66)
by 0x14AA41: mainloop_run_with_signal (mainloop-notify.c:188)
by 0x149A7B: tester_run (tester.c:871)
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 11 Nov 2020 22:15:46 +0000 (14:15 -0800)]
hciemu: Fix crash when test is aborted during pre setup
If the tester_pre_setup_failed is called all timeout related to the
test must be cancelled as the test should have been freed by the
application and the next test is about to start.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 11 Nov 2020 02:16:54 +0000 (18:16 -0800)]
mgmt-tester: Update expected advertisement flags
This updates the expected advertisement flags which now includes
MGMT_ADV_FLAG_CAN_SET_TX_POWER and MGMT_ADV_FLAG_HW_OFFLOAD.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 11 Nov 2020 02:15:06 +0000 (18:15 -0800)]
mgmt-tester: Print unexpected command responses
This prints the difference between the command response and the
expected command response to make it easier to debug.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 11 Nov 2020 02:09:56 +0000 (18:09 -0800)]
mgmt-tester: Update supported-features to not include HS
High speed has been disabled by default, also since it can be enabled
this turn checks of supported-features into warnings to allow it work
even if BT_HS has been enabled in the kernel.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 11 Nov 2020 02:06:00 +0000 (18:06 -0800)]
shared/tester: Add option to filter by string
This adds option to filter by string which does not require to enter
the entire prefix.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 10 Nov 2020 23:10:09 +0000 (15:10 -0800)]
smp-tester: Fix not registering for MGMT_EV_USER_CONFIRM_REQUEST
For client test MGMT_EV_USER_CONFIRM_REQUEST shall be resgistered as
well as the kernel has been updated to request user confirmation even
when acting as initiator.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 10 Nov 2020 22:57:10 +0000 (14:57 -0800)]
l2cap-tester: Fix L2CAP LE Server - Success
This test was failing due to the kernel now using different values for
MPS and credits.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 10 Nov 2020 22:54:10 +0000 (14:54 -0800)]
bthost: Fix running request callbacks for remote requests
Ident are only unique per request/response pair so if a remote request
is initiated we shall not attempt to run the callback even if the ident
matches.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Thu, 20 Aug 2020 00:53:55 +0000 (17:53 -0700)]
btdev: Rework command handling
This create command tables per version/supported command bits to make
it easier to keep them in sync.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Mon, 9 Nov 2020 22:57:56 +0000 (14:57 -0800)]
main: Don't warn for unset config option
Unset options shall not be printed if debug is not enabled.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Inga Stotland [Mon, 9 Nov 2020 19:27:42 +0000 (11:27 -0800)]
client: Remove reference to g_steal_pointer()
In order to avoid requiring higher version of GLib, replace
g_steal_pointer() with explicitly setting the pointer value
to NULL.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Michael Nosthoff [Mon, 9 Nov 2020 10:51:14 +0000 (11:51 +0100)]
doc/adapter-api: Add InProgess error to StartDiscovery
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Sonny Sasaka [Thu, 5 Nov 2020 22:49:23 +0000 (14:49 -0800)]
Cancel GATT client operations when cleaning up GATT cache
A crash is found when discovery_complete_op is invoked but
gatt_db_attribute objects have been freed. A solution is to always
cancel GATT client operations every time we clean GATT cache.
The crash is reproducible by connecting to an LE mouse and then calling
RemoveDevice immediately, triggering disconnection while GATT service
discovery is in progress.
Sample crash stack trace:
0 gatt_db_service_get_handles (service=0x1751130, service=0x1751130, end_handle=0x7ffcd600806e, start_handle=0x7ffcd600806c) at src/shared/gatt-db.c:569
1 gatt_db_attribute_get_service_data (attrib=<optimized out>, start_handle=0x7ffcd600806c, end_handle=0x7ffcd600806e, primary=0x0, uuid=0x0) at src/shared/gatt-db.c:1657
2 0x00000000004983a8 in discovery_op_complete (op=op@entry=0x173b320, success=<optimized out>, err=err@entry=10 '\n') at src/shared/gatt-client.c:406
3 0x000000000049a548 in discover_descs_cb (success=<optimized out>, att_ecode=<optimized out>, result=<optimized out>, user_data=0x173b320) at src/shared/gatt-client.c:915
4 0x00000000004a1d87 in discovery_op_complete (op=0x1748450, success=<optimized out>, ecode=<optimized out>) at src/shared/gatt-helpers.c:615
5 0x00000000004a2379 in discover_descs_cb (opcode=<optimized out>, pdu=0x174d551, length=<optimized out>, user_data=0x1748450) at src/shared/gatt-helpers.c:1465
6 0x00000000004966db in handle_rsp (pdu_len=4, pdu=<optimized out>, opcode=<optimized out>, chan=0x17483c0) at src/shared/att.c:814
7 can_read_data (io=<optimized out>, user_data=0x17483c0) at src/shared/att.c:1011
8 0x00000000004a0853 in watch_callback (channel=<optimized out>, cond=<optimized out>, user_data=<optimized out>) at src/shared/io-glib.c:157
9 0x00007fb3f2d7fe87 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
10 0x00007fb3f2d80230 in ?? () from /usr/lib64/libglib-2.0.so.0
11 0x00007fb3f2d80542 in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
12 0x00000000004a0e25 in mainloop_run () at src/shared/mainloop-glib.c:66
13 0x00000000004a11f2 in mainloop_run_with_signal (func=func@entry=0x43f200 <signal_callback>, user_data=user_data@entry=0x0) at src/shared/mainloop-notify.c:188
14 0x000000000040c72e in main (argc=<optimized out>, argv=<optimized out>) at src/main.c:959
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Archie Pusaka [Thu, 5 Nov 2020 06:40:34 +0000 (14:40 +0800)]
audio/avdtp: Report failure in disconnected state
A2DP are relying on the disconnected state callback to do cleanup.
If failure occurs when AVDTP are already in the disconnected state,
we didn't make any transition state, therefore A2DP would miss this
event.
This patch allows the transition to disconnected state, even though
we are previously already in the disconnected state.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Archie Pusaka [Thu, 5 Nov 2020 06:40:33 +0000 (14:40 +0800)]
audio: unref session when failed to setup
There is a possibility to miss unref-ing when source/sink fails at
setup.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Archie Pusaka [Thu, 5 Nov 2020 06:40:32 +0000 (14:40 +0800)]
service: add adapter powered check before connecting
When policy_connect() is called, there might be a case where the
power is just turned off, hence the adapter is down. Add a check in
btd_service_connect to detect such condition.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 4 Nov 2020 23:05:37 +0000 (15:05 -0800)]
emulator: Return error for ext adv feature not supported
This return an error if LE Set Extended Advertising Enable is used with
unsupported features.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 4 Nov 2020 19:27:53 +0000 (11:27 -0800)]
mgmt-tester: Fix failing pairing tests
Just-works pairing does request user confirmation.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 4 Nov 2020 19:25:15 +0000 (11:25 -0800)]
mgmt-tester: Don't run tests which command fails
This indicates that emulator don't support the test and until proper
support is added the test shall not be run.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 4 Nov 2020 19:06:14 +0000 (11:06 -0800)]
mgmt-tester: Fix ext advertisement handle
Handle has been change to 0x01 not 0x00:
< HCI Command: LE Set Extended Advertising Enable (0x08|0x0039) plen 6
Extended advertising: Enabled (0x01)
Number of sets: 1 (0x01)
Entry 0
Handle: 0x01
Duration: 0 ms (0x00)
Max ext adv events: 0
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 3 Nov 2020 23:38:56 +0000 (15:38 -0800)]
mgmt-tester: Update set_connectable_off_adv_param
Parameters have been changed in the kernel which now uses the following:
< HCI Command: LE Set Advertising Parameters (0x08|0x0006) plen 15
Min advertising interval: 62.500 msec (0x0064)
Max advertising interval: 93.750 msec (0x0096)
Type: Scannable undirected - ADV_SCAN_IND (0x02)
Own address type: Random (0x01)
Direct address type: Public (0x00)
Direct address: 00:00:00:00:00:00 (OUI 00-00-00)
Channel map: 37, 38, 39 (0x07)
Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00)
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 3 Nov 2020 23:36:28 +0000 (15:36 -0800)]
mgmt-tester: Print out the HCI received and expected cmd value
This make it simpler to debug when the kernel has been updated and
parameters no longer match:
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 3 Nov 2020 23:15:08 +0000 (15:15 -0800)]
test-runner: Fix using removed options
This removes -nodefconfig and -balloon which are not longer valid
options:
qemu-system-x86_64: -nodefconfig: invalid option
qemu-system-x86_64: -balloon: invalid option
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 3 Nov 2020 23:09:43 +0000 (15:09 -0800)]
doc: Add tester.config
This adds tester.config which can be used as a reference to create
kernel images to be run with test-runner.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Miao-chen Chou [Mon, 2 Nov 2020 22:30:03 +0000 (14:30 -0800)]
adapter: Fix a crash caused by lingering discovery client pointer
This cleans up the lingering pointer, adapter->client, during powering
off the adapter. The crash occurs when a D-Bus client set Powered
property to false and immediately calls StopDiscovery() when there is
ongoing discovery. As a part of powering off the adapter,
adapter->discovery_list gets cleared, and given that adapter->client
refers to one of the clients in adapter->discovery_list, adapter->client
should be cleared along with it.
(1) Connect to a BT audio device from BT system tray.
(2) Once the audio device is connected, power off BT and immediately
power off the audio device.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Mon, 2 Nov 2020 19:09:12 +0000 (11:09 -0800)]
tools/smp-tester: Enable hciemu debug
This enable hciemu debug when debug is enabled.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Mon, 2 Nov 2020 19:08:39 +0000 (11:08 -0800)]
tools/sco-tester: Enable hciemu debug
This enable hciemu debug when debug is enabled.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Mon, 2 Nov 2020 19:08:12 +0000 (11:08 -0800)]
tools/rfcomm-tester: Enable hciemu debug
This enable hciemu debug when debug is enabled.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Mon, 2 Nov 2020 19:07:19 +0000 (11:07 -0800)]
tools/bnep-tester: Enable hciemu debug
This enable hciemu debug when debug is enabled.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Mon, 2 Nov 2020 19:06:35 +0000 (11:06 -0800)]
tools/mgmt-tester: Enable hciemu debug
This enable hciemu debug when debug is enabled.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Fri, 30 Oct 2020 00:20:11 +0000 (17:20 -0700)]
tools/l2cap-tester: Enable hciemu debug
This enable hciemu debug when debug is enabled.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Fri, 30 Oct 2020 22:05:06 +0000 (15:05 -0700)]
emulator/bthost: Add support for LE CIS Request
This enables bthost to act as acceptor of LE CIS Request.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Fri, 30 Oct 2020 21:48:38 +0000 (14:48 -0700)]
emulator: Fix not gerating proper advertisement
When a btdev instance advertise using the legacy command and the other
instance uses the extended version to scan the report type are not
actually setting the legacy PDU properly.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Thu, 29 Oct 2020 21:45:55 +0000 (14:45 -0700)]
emulator/hciemu: Add debug support
This adds bthost_set_debug which can be used to debug internals of
hciemu.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Thu, 29 Oct 2020 21:16:50 +0000 (14:16 -0700)]
emulator/bthost: Add debug support
This adds bthost_set_debug which can be used to debug internals of
bthost.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Thu, 29 Oct 2020 21:15:34 +0000 (14:15 -0700)]
emulator/btdev: Add debug support
This adds btdev_set_debug which can be used to debug internals of
btdev.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Alain Michaud [Sat, 31 Oct 2020 00:52:56 +0000 (17:52 -0700)]
adv_monitor: Issue Remove Adv Monitor mgmt call
This calls Remove Adv Monitor command to kernel and handles the callback
during a monitor removal initiated by a D-Bus client. This also
registers callback for getting notified on Adv Monitor Removed event, so
that the Adv monitor manager can invalidate the monitor by calling
Release() on its proxy.
The following tests were performed.
- In bluetoothctl console, add a monitor and remove the monitor by its
index and verify the removal in both the output of btmgmt and syslog.
- In bluetoothctl console, add a monitor, remove the monitor via
btmgmt and verify the removal in syslog.
Change-Id: Ib51b9e6ce76e816e66bb7248e48be7364ca9812e
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Miao-chen Chou [Sat, 31 Oct 2020 00:52:54 +0000 (17:52 -0700)]
adv_monitor: Fix return type of RegisterMonitor() method
This modifies the D-Bus call return type to be asynchronous for
RegisterMonitor() method call.
The following test was performed:
- Enter bluetoothctl, exit the console and re-enter the console without
AlreadyExist error for RegisterMonitor() upon bring-up of the console.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Howard Chung [Sat, 31 Oct 2020 00:52:52 +0000 (17:52 -0700)]
adv_monitor: Implement Add Adv Patterns Monitor cmd handler
- Send the MGMT_OP command to kernel upon registration of a Adv patterns
monitor.
- Call Activate() or Release() to client depending on the reply from
kernel
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Miao-chen Chou [Sat, 31 Oct 2020 00:52:50 +0000 (17:52 -0700)]
adapter: Clear all Adv monitors upon bring-up
This clears all Adv monitors upon daemon bring-up by issuing
MGMT_OP_REMOVE_ADV_MONITOR command with monitor_handle 0.
The following test was performed:
- Add an Adv Monitor using btmgmt, restart bluetoothd and observe the
monitor got removed.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Manish Mandlik [Sat, 31 Oct 2020 00:52:48 +0000 (17:52 -0700)]
adv_monitor: Implement RSSI filtering and content matching
This implements the following logic for background scanning.
- Implement RSSI tracking based on high/low RSSI thresholds and timers.
- Create an entry point in adapter to start the matching of Adv based
on all monitors and invoke the RSSI tracking for Adv reporting.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Miao-chen Chou [Sat, 31 Oct 2020 00:52:46 +0000 (17:52 -0700)]
shared/ad: Add support of bt_ad_pattern
This adds struct bt_ad_pattern and helpers functions to facilitate
pattern matching.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Fri, 30 Oct 2020 19:57:33 +0000 (12:57 -0700)]
adapter: Split loading of BREDR and LE defaults
Avoid loading default parameters for modes that are disabled.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Howard Chung [Fri, 30 Oct 2020 09:11:02 +0000 (17:11 +0800)]
core: Fix mistakes of using mgmt_tlv_add_fixed
Fix mistakes on checking the result of mgmt_tlv_add_fixed.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Howard Chung [Fri, 30 Oct 2020 09:11:01 +0000 (17:11 +0800)]
core: Add param to disable interleave scan
This patch adds parameter to enable/disable the interleave scan feature.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Howard Chung [Fri, 30 Oct 2020 09:11:00 +0000 (17:11 +0800)]
core: Add parmas to set interleaving durations
This patch adds parameters to control the durations of allowlist scan
and no-filter scan when the kernel is doing interleaving scan.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Daniel Winkler [Thu, 29 Oct 2020 23:06:22 +0000 (16:06 -0700)]
monitor: Add new MGMT adv commands and events to monitor
This change adds the following to packet monitor:
-Add Ext Adv Params command and response
-Add Ext Adv Data command and response
This patch was manually tested by registering advertisements with
various features and verifying in btmon log.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Daniel Winkler [Thu, 29 Oct 2020 23:06:21 +0000 (16:06 -0700)]
client: Add SupportedCapabilities to bluetoothctl
This patch adds the new "SupportedCapabilities" property to the
bluetoothctl "show" view.
The change is tested by verifying bluetoothctl shows the desired
properties.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Daniel Winkler [Thu, 29 Oct 2020 23:06:20 +0000 (16:06 -0700)]
advertising: Expose SupportedCapabilities for advertising
To help our advertising clients understand the device capabilities, this
patch adds a SupportedCapabilities dbus endpoint for the advertising
manager. The primary reason behind this is to provide the valid LE tx
power range the controller supports (populated if controller supports
BT5), so a client can know the valid power range before requesting a tx
power for their advertisement.
I also thought it would be useful to indicate the max advertising data
length and scan response length in this endpoint, since some clients
will find it useful to set their advertising data (currently
experimental feature) or scan response data (possible future feature)
directly.
This patch has been tested on Hatch (BT5 support) and Kukui (No BT5
support) chromebooks to verify that the dbus endpoint contains the
correct data.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Daniel Winkler [Thu, 29 Oct 2020 23:06:19 +0000 (16:06 -0700)]
advertising: Query LE TX range at manager initialization
This patch calls the new MGMT command to get controller capabilities,
and parses the min and max LE tx power range when the manager is
initialized. This will be used to populate a client-facing dbus entry so
that the client will know the advertising capabilities of the controller
before registering an advertisement.
This patch is tested by manually verifying the data is parsed correctly
from the MGMT response.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Daniel Winkler [Thu, 29 Oct 2020 23:06:18 +0000 (16:06 -0700)]
advertising: Use new mgmt interface for advertising add
This patch allows bluetoothd to use the new extended advertising add
mgmt interface if it is available. The new interface will be used by
default, as it allows the client to set advertising intervals, and tx
power if the controller and kernel support extended advertising.
Each new registered advertisement will submit two requests to kernel;
the first sets the advertising parameters for the advertising instance,
and the second sets the advertising data and scan response for the
instance.
The parameters MGMT request will return the tx power selected by the
controller (if applicable), which is propagated to the client via a dbus
Set method.
Note: This patch also fixes a small bug in the packet monitor, where the
tx power value 0xff is considered as "Host has no preference". However,
the spec states this value to be 0x7f. It is corrected in this patch
This change has been tested extensively on Hatch (extended advertising)
and Kukui (no extended advertising) chromebooks. Manual tests do the
following:
- Configure advertisement with custom intervals, tx power with valid and
invalid values and combinations
- Ensure that with valid parameters, they are propagated and set in hci
requests. With invalid parameters, ensure that the registration fails.
Automatic tests verify 25 advertising usage scenarios involving single
and multi-advertising registration, over-registration, parameter
validation, etc. These tests don't test new intervals and tx power, but
validate that the new MGMT interface does not regress compatibility in
these 25 scenarios.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Daniel Winkler [Thu, 29 Oct 2020 23:06:17 +0000 (16:06 -0700)]
advertising: Parse intervals and tx power from adv
This change adds parsers for the advertising intervals and tx power
properties of the LEAdvertisement1 object. It validates that each field
adheres to the 5.2 spec, and that min and max intervals are compatible
with each other, i.e. that min interval is less than max interval.
A note here for maintainers: The tx power that is sent in the hci
parameter command is an int8_t, but as far as I can tell, there is no
clean way to use a signed 8-bit integer in dbus. The dbus byte type
seems incompatible with negative values in high-level languages (python)
without awkward usage manipulation on the client side. For this reason,
I chose to use an int16_t type for the tx power dbus field, which is
then downcasted to the int8_t in bluetoothd, which at least makes the
signed-ness of the type crystal clear to the dbus client that uses it.
This change is manually verified by ensuring the intervals and tx power
parameters are correctly parsed from the LEAdvertisement1 object, and
that the parse fails if the parameters are incorrect or not compatible
with each other.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Daniel Winkler [Thu, 29 Oct 2020 23:06:16 +0000 (16:06 -0700)]
advertising: Detect if extended advertising mgmt commands are supported
We need to know if kernel supports the new MGMT interface. To do so, we
check the return from adapter's MGMT_OP_READ_COMMANDS call for the new
commands. This will later be used to route our requests for new
advertisements.
The change is tested by manually verifying that the correct MGMT
commands are used when the feature is and is not available in kernel.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Daniel Winkler [Thu, 29 Oct 2020 23:06:15 +0000 (16:06 -0700)]
doc/mgmt-api: Update controller capabilities MGMT command in mgmt-api
This patch changes Read Security Info MGMT to be called Read Controller
Capabilities Command
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Daniel Winkler [Thu, 29 Oct 2020 23:06:14 +0000 (16:06 -0700)]
doc/mgmt-api: Add new Advertising MGMT interfaces to mgmt-api
This patch adds the following to mgmt-api:
- Add Extended Advertising Parameters Command
- Add Extended Advertising Data Command
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Daniel Winkler [Thu, 29 Oct 2020 23:06:13 +0000 (16:06 -0700)]
doc/advertising-api: update API with new interface
This updates the advertising documentation to include the following
features:
LE Advertising Manager:
- New SupportedCapabilities property
LE Advertisement:
- New min/max interval properties
- New tx power property
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Howard Chung [Thu, 29 Oct 2020 10:09:45 +0000 (18:09 +0800)]
monitor: Decode Remove ADV Monitor
Add support for Remove Advertisement Monitor MGMT command and event.
@ MGMT Command: Remove Advertisement Monitor (0x0053) plen 2
Handle: 1
@ MGMT Event: Advertisement Monitor Added (0x002c) plen 2
Handle: 1
@ MGMT Event: Command Complete (0x0001) plen 5
Remove Advertisement Monitor (0x0053) plen 2
Status: Success (0x00)
Handle: 1
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Howard Chung [Thu, 29 Oct 2020 10:09:44 +0000 (18:09 +0800)]
monitor: Decode Add ADV monitor command
Add support for Add Advertisement Monitor MGMT command and event.
@ MGMT Command: Add Advertisement Monitor (0x0052) plen 69
Number of patterns: 2
Pattern 1:
AD type: 0
Offset: 1
Length: 2
Value : ...
Pattern 2:
AD type: 1
Offset: 10
Length: 4
Value : ...
@ MGMT Event: Advertisement Monitor Added (0x002b) plen 2
Handle: 1
@ MGMT Event: Command Complete (0x0001) plen 5
Add Advertisement Monitor (0x0052) plen 2
Status: Success (0x00)
Handle: 1
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Howard Chung [Thu, 29 Oct 2020 10:09:43 +0000 (18:09 +0800)]
monitor: Decode ADV Monitor read feature command
Add support for Read Advertisement Monitor Features mgmt operation.
@ MGMT Command: Read Advertisement Monitor Features (0x0051) plen 0
@ MGMT Event: Command Complete (0x0001) plen 20
Read Advertisement Monitor Features (0x0051) plen 17
Status: Success (0x00)
Supported Features: 0x00000000
Enabled Features: 0x00000000
Max number of handles: 32
Max number of patterns: 16
Number of handles: 2
Handle: 1
Handle: 3
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 28 Oct 2020 21:53:36 +0000 (14:53 -0700)]
core: Rename hcid.h to btd.h
Since we use btd term for daemon APIs it makes sense to use it also
for the header name instead of hcid.
Change-Id: Ib2c8e730fa5fd4bf4119fb245c958fa0450e3e11
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 28 Oct 2020 21:50:00 +0000 (14:50 -0700)]
core: Rename main_opts to btd_opts
Use btd_ prefix since this is a daemon API.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 28 Oct 2020 21:45:36 +0000 (14:45 -0700)]
core: Split LE and BR/EDR parameters
This splits LE and BR/EDR config parameters and checks main_conf.mode
when parsing them.
Change-Id: Ib42be9ad8c6cffe7b6b04d5d40caa7fac66fb7a9
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 28 Oct 2020 21:43:35 +0000 (14:43 -0700)]
shared/mgmt: Add mgmt_tlv_add_fixed
This adds mgmt_tlv_add_fixed macro which can be used to add fixed sized
value.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Howard Chung [Wed, 28 Oct 2020 11:52:46 +0000 (19:52 +0800)]
mgmt: Add support of mgmt TLV API
This adds API to send multiple TLVs to kernel, it is useful for
mgmt set system config command.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Marijn Suijten [Mon, 26 Oct 2020 19:54:08 +0000 (20:54 +0100)]
audio/media: Destroy transport if SetConfiguration fails
set_configuration creates a transport before calling SetConfiguration on
the MediaEndpoint1 DBus interface. If this DBus call fails the
transport sticks around while it should instead be cleaned up.
When the peer retries or reconnects (in case of BlueZ which cuts the
connection due to a missing recount [1]) set_configuration finds this
old transport and returns FALSE. The peer will never succeed this call
unless it randomly decides to call clear_configuration or BlueZ is
restarted.
[1]: https://marc.info/?l=linux-bluetooth&m=
160364326629847&w=2
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>