Luiz Augusto von Dentz [Mon, 29 Jul 2019 10:09:24 +0000 (13:09 +0300)]
lib: Add definitions for ISO socket
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 13 Jul 2022 23:40:03 +0000 (16:40 -0700)]
main: Default device_privacy to true
If privacy mode is not strictly set to network set it to device
otherwise network mode would prevent reconnections if the the identity
address is used:
BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 6, Part B page 2837-2838
'The Host specifies the privacy mode to be used with each peer
identity on the resolving list. If it specifies that device privacy
mode is to be used, then the Controller shall accept both the peer's
device Identity Address and a resolvable private address generated by
the peer device using its distributed IRK. Otherwise, network privacy
mode is used: the Controller shall only accept resolvable private
addresses generated by the peer device using its distributed IRK.'
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Andrew Drake [Thu, 30 Jun 2022 07:39:58 +0000 (00:39 -0700)]
adapter: Fix advertising monitor on Linux 5.12-5.17
The existing code assumes that, if a device supports advertising monitor
offload, DEVICE_FOUND events can be ignored since the kernel will send
ADV_MONITOR_DEVICE_FOUND events instead. Unfortunately, these new events
were added in 5.18, but offload was added in 5.12. This patch adds a
check on the MGMT API version so we can process the older DEVICE_FOUND
events when the new events are not supported.
Fixes: https://github.com/bluez/bluez/issues/357
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Fri, 8 Jul 2022 00:23:53 +0000 (17:23 -0700)]
btdev: Fix not checking if a CIG has any active CIS
Bluetooth Core specification says the CIG must be in configurable state
in order to accept the SetCIGParameters:
BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E page 2553:
'If the Host issues this command when the CIG is not in the
configurable state, the Controller shall return the error
code Command Disallowed (0x0C).'
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 5 Jul 2022 17:43:46 +0000 (10:43 -0700)]
monitor: Fix build error in some targets
This fixes the following error:
monitor/att.c: In function 'print_attribute':
monitor/att.c:1850:35: error: lvalue required as unary '&' operand
print_uuid(label, &cpu_to_le16(uuid->value.u16), 2);
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 5 Jul 2022 17:31:39 +0000 (10:31 -0700)]
client: Fix build warning
This fixes the following build warning:
warning: ‘g_memdup’ is deprecated: Use 'g_memdup2' instead
[-Wdeprecated-declarations]
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Youwan Wang [Tue, 5 Jul 2022 09:29:52 +0000 (17:29 +0800)]
obexd: Fix the code style
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Tedd Ho-Jeong An [Fri, 1 Jul 2022 00:43:52 +0000 (17:43 -0700)]
tools/test-runner: Fix errors reported by scan-build
This patch fixes the errors reported by the scan-build.
tools/test-runner.c:315:2: warning: Null pointer passed to 1st parameter
expecting 'nonnull' [core.NonNullParamChecker]
execve(argv[0], argv, qemu_envp);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/test-runner.c:554:6: warning: Null pointer passed to 1st parameter
expecting 'nonnull' [core.NonNullParamChecker]
if (chdir(home + 5) < 0) {
^~~~~~~~~~~~~~~
tools/test-runner.c:638:6: warning: Null pointer passed to 1st parameter
expecting 'nonnull' [core.NonNullParamChecker]
if (chdir(home + 5) < 0) {
^~~~~~~~~~~~~~~
tools/test-runner.c:695:6: warning: Null pointer passed to 1st parameter
expecting 'nonnull' [core.NonNullParamChecker]
if (chdir(home + 5) < 0) {
^~~~~~~~~~~~~~~
tools/test-runner.c:984:3: warning: Value stored to 'serial_fd' is never
read [deadcode.DeadStores]
serial_fd = -1;
^ ~~
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Tedd Ho-Jeong An [Fri, 1 Jul 2022 00:43:51 +0000 (17:43 -0700)]
tools/btmgmt: Fix errors reported by scan-build
This patch fixes the errors reported by the scan-build.
tools/btmgmt.c:2699:2: warning: Value stored to 'argc' is never read
[deadcode.DeadStores]
argc -= optind;
^ ~~~~~~
tools/btmgmt.c:2859:2: warning: Value stored to 'argc' is never read
[deadcode.DeadStores]
argc -= optind;
^ ~~~~~~
tools/btmgmt.c:2860:2: warning: Value stored to 'argv' is never read
[deadcode.DeadStores]
argv += optind;
^ ~~~~~~
tools/btmgmt.c:2934:2: warning: Value stored to 'argc' is never read
[deadcode.DeadStores]
argc -= optind;
^ ~~~~~~
tools/btmgmt.c:2935:2: warning: Value stored to 'argv' is never read
[deadcode.DeadStores]
argv += optind;
^ ~~~~~~
tools/btmgmt.c:3000:2: warning: Value stored to 'argc' is never read
[deadcode.DeadStores]
argc -= optind;
^ ~~~~~~
tools/btmgmt.c:3001:2: warning: Value stored to 'argv' is never read
[deadcode.DeadStores]
argv += optind;
^ ~~~~~~
tools/btmgmt.c:3261:11: warning: Value stored to 'index' during its
initialization is never read [deadcode.DeadStores]
uint16_t index = mgmt_index;
^~~~~ ~~~~~~~~~~
tools/btmgmt.c:3450:2: warning: Value stored to 'argc' is never read
[deadcode.DeadStores]
argc -= optind;
^ ~~~~~~
tools/btmgmt.c:3451:2: warning: Value stored to 'argv' is never read
[deadcode.DeadStores]
argv += optind;
^ ~~~~~~
tools/btmgmt.c:4822:2: warning: Null pointer passed to 2nd parameter
expecting 'nonnull' [core.NonNullParamChecker]
memcpy(cp->data + uuid_bytes, adv_data, adv_len);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/btmgmt.c:4823:2: warning: Null pointer passed to 2nd parameter
expecting 'nonnull' [core.NonNullParamChecker]
memcpy(cp->data + uuid_bytes + adv_len, scan_rsp, scan_rsp_len);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/btmgmt.c:5244:2: warning: Null pointer passed to 2nd parameter
expecting 'nonnull' [core.NonNullParamChecker]
memcpy(cp->data + uuid_bytes, adv_data, adv_len);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/btmgmt.c:5245:2: warning: Null pointer passed to 2nd parameter
expecting 'nonnull' [core.NonNullParamChecker]
memcpy(cp->data + uuid_bytes + adv_len, scan_rsp, scan_rsp_len);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Brian Gix [Wed, 29 Jun 2022 19:19:43 +0000 (12:19 -0700)]
monitor: Fix usage of %z formater for uint64_t
%z expect a size_t as argument not uint64_t, so passing
an argument of type uint64_t shall use PRIx64 instead.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Brian Gix [Wed, 29 Jun 2022 21:02:37 +0000 (14:02 -0700)]
mesh: Fix snprintf return values not being checked
Some versions of the GCC compiler complain when the return value of
snprintf is not checked. This patch cleans up the Mesh JSON parser.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Brian Gix [Wed, 29 Jun 2022 21:16:40 +0000 (14:16 -0700)]
core: Fix signed vs unsigned compare
__time_t is not a portable data type, and can cause sign mismatch on
some compares.
Fixes:
CC src/bluetoothd-device.o
src/device.c: In function ‘device_is_name_resolve_allowed’:
src/device.c:4092:17: error: comparison of integer expressions of
different signedness: ‘__time_t’ {aka ‘long int’} and
‘long unsigned int’ [-Werror=sign-compare]
if (now.tv_sec >= device->name_resolve_failed_time +
^~
cc1: all warnings being treated as errors
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Brian Gix [Wed, 29 Jun 2022 21:16:39 +0000 (14:16 -0700)]
core: make bt_uuid_hash() portable across archs
bt_uuid_t is defined as a byte array, so it can cause alignment errors
on some architectures, when the two 64 bit halves are treated as u64s.
This patch ensures proper alignment across all architectures.
Fixes:
src/adapter.c: In function ‘bt_uuid_hash’:
src/adapter.c:3617:8: error: cast increases required alignment of
target type [-Werror=cast-align]
val = (uint64_t *)&uuid_128.value.u128;
^
cc1: all warnings being treated as errors
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
lishengyu [Wed, 29 Jun 2022 12:46:56 +0000 (20:46 +0800)]
avdtp: fix possible minor problems
It should always be considered that if send_request fails, sep
should be removed from the list and the requested memory freed;
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Isak Westin [Thu, 30 Jun 2022 07:29:19 +0000 (09:29 +0200)]
mesh: Use correct net_id for received CTL messages
For received CTL mesh messages, the wrong network ID variable was
passed to ctl_received. This patch changes to the correct variable.
Also, changed type of net_key_id argument in ctl_received function
to be consistent wich the whole call chain.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Szymon Janc [Fri, 24 Jun 2022 08:25:41 +0000 (10:25 +0200)]
monitor: Fix crash when using RTT backend
This fix regression introduced by "monitor: Fix memory leaks".
J-Link shared library is in use if jlink_init() returns 0 and thus
handle shall not be closed.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Youwan Wang [Thu, 23 Jun 2022 06:29:53 +0000 (14:29 +0800)]
device: Fix not removing connected device
[bluetooth]# connect 40:EF:4C:0C:11:F0
Attempting to connect to 40:EF:4C:0C:11:F0
[CHG] Device 40:EF:4C:0C:11:F0 Connected: yes
Connection successful
[CHG] Device 40:EF:4C:0C:11:F0 ServicesResolved: yes
[UFO]# remove 40:EF:4C:0C:11:F0
[CHG] Device 40:EF:4C:0C:11:F0 ServicesResolved: no
Device has been removed
[CHG] Device 40:EF:4C:0C:11:F0 Connected: no
[bluetooth]# info 40:EF:4C:0C:11:F0
Device 40:EF:4C:0C:11:F0 (public)
Name: UFO
Alias: UFO
Class: 0x00240418
Icon: audio-headphones
Paired: yes
Trusted: no
Blocked: no
Connected: no
LegacyPairing: no
UUID: Headset
UUID: Audio Sink
UUID: A/V Remote Control Target
UUID: A/V Remote Control
UUID: Handsfree
UUID: Phonebook Access Server
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Tedd Ho-Jeong An [Thu, 23 Jun 2022 04:45:20 +0000 (21:45 -0700)]
mgmt-tester: Fix null dereference issue reported by scan-build
This patch fixes the null dereference reported by the scan-build.
tools/mgmt-tester.c:12025:28: warning: Access to field 'cap_len' results
in a dereference of a null pointer (loaded from variable 'rp')
[core.NullDereference]
if (sizeof(rp->cap_len) + rp->cap_len != length) {
^~~~~~~~~~~
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 22 Jun 2022 18:16:18 +0000 (11:16 -0700)]
client/advertising: Fixes errors found by scan-build
This fixes the following errors:
client/advertising.c:129:4: warning: Value stored to 'n' is never read
[deadcode.DeadStores]
n = sizeof(str) - 1;
^ ~~~~~~~~~~~~~~~
client/advertising.c:1012:25: warning: Dereference of null pointer
(loaded from variable 'min') [core.NullDereference]
if (ad.min_interval != *min) {
^~~~
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 22 Jun 2022 18:09:04 +0000 (11:09 -0700)]
client/player: Fixes errors found by scan-build
This fixes the following errors:
client/player.c:1406:44: warning: Dereference of null pointer
[core.NullDereference]
reply = endpoint_select_config_reply(msg, p->data.iov_base,
^~~~~~~~~~~~~~~~
client/player.c:1866:2: warning: 3rd function call argument is an
uninitialized value [core.CallAndMessage]
iov_append(&cfg->caps, data, len);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Mon, 20 Jun 2022 22:22:52 +0000 (15:22 -0700)]
client/player: Enable acquiring multiple transports
This enables acquiring multiple transports simultaneously.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Tedd Ho-Jeong An [Tue, 21 Jun 2022 20:10:54 +0000 (13:10 -0700)]
tools/mgmt-tester: Add test case for scan response data is not updating
This patch adds a test case to test if the scan response data is updated
when the following scenarios are performed.
1. Add Extended Advertising Parameters Command
2. Add Extended Advertising Data Command w/ Scan Resp Data
3. Remove Advertising Command
4. Add Extended Advertising Parameters Command
5. Add Extended Advertising Data Command w/ Scan Resp Data
6. Host should set Scan Resp Data
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Jonas Maes [Fri, 10 Jun 2022 15:29:02 +0000 (17:29 +0200)]
mesh: Fix bug where bluetooth-meshd stops sending
When there is a backlog of mesh packets to be sent, the packet sender
Fix bug where bluetooth-meshd stops sending
When there is a backlog of mesh packets to be sent, the packet sender
incorrectly infers that the tx worker thread is already running
and therefore needn't be invoked. As a result, the mesh daemon will
sometimes stop broadcasting while there are still packets in the queue.
It will not resume broadcasting.
This patch will invoke the tx worker thread correctly in that case.
The logic to send packets at least twice when the transmitter is idle
was slightly modified accordingly, and should behave the same way as
before.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Chengyi [Tue, 21 Jun 2022 04:31:33 +0000 (12:31 +0800)]
avdtp: Free discover when send_request returns error
When send_request returns an error, session->discover should
be released here, so that the next time the program enters
avdtp_discover, the -EBUSY error will not be returned.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Frédéric Danis [Fri, 17 Jun 2022 19:49:29 +0000 (21:49 +0200)]
test-runner: Fix issues found by coverity
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Tedd Ho-Jeong An [Thu, 16 Jun 2022 19:58:03 +0000 (12:58 -0700)]
tools/btmgmt: Add support Add Ext Adv command
This patch adds new command to support the following MGMT API:
Add Extended Advertising Parameters Command
Add Extended Advertising Data Command
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Tedd Ho-Jeong An [Thu, 16 Jun 2022 19:58:02 +0000 (12:58 -0700)]
monitor: Update flag information for Extended Advertismement
This patch updates the missing flag details for Advertisement flags
@ MGMT Event: Command Complete (0x0001) plen 11
Read Advertising Features (0x003d) plen 8
Status: Success (0x00)
Flags: 0x0001ffff
...
Unknown advertising flag (0x00010c00)
...
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Tedd Ho-Jeong An [Thu, 16 Jun 2022 19:58:01 +0000 (12:58 -0700)]
doc/mgmt-api: Update for Add Extended Advertisement Command
This patch aligns the input parameter for Add Extended Advertisement
command with actual data struct and add missing flag descriptions.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Thu, 16 Jun 2022 22:59:12 +0000 (15:59 -0700)]
monitor/att: Add LTV deconding support for PAC/ASE
This adds decoding support for PAC/ASE attributes:
> ACL Data RX: Handle 42 flags 0x02 dlen 31
Channel: 65 len 27 sdu 25 [PSM 39 mode Enhanced Credit (0x81)] {chan 1}
ATT: Read Response (0x0b) len 24
Value: 010600000000100301ff0002020302030305041e00f00000
Number of PAC(s): 1
PAC #0:
Codec: LC3 (0x06)
Codec Specific Capabilities #0: len 0x03 type 0x01
Sampling Frequencies: 0x00ff
8 Khz (0x0001)
11.25 Khz (0x0002)
16 Khz (0x0004)
22.05 Khz (0x0008)
24 Khz (0x0010)
32 Khz (0x0020)
44.1 Khz (0x0040)
48 Khz (0x0080)
Codec Specific Capabilities #1: len 0x02 type 0x02
Frame Duration: 0x0003
7.5 ms (0x01)
10 ms (0x02)
Codec Specific Capabilities #2: len 0x02 type 0x03
Audio Channel Count: 0x03
1 channel (0x01)
2 channels (0x02)
Codec Specific Capabilities #3: len 0x05 type 0x04
Frame Length: 30 (0x001e) - 240 (0x00f0)
> ACL Data RX: Handle 42 flags 0x02 dlen 30
Channel: 64 len 26 sdu 24 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Write Command (0x52) len 23
Handle: 0x0036 Type: ASE Control Point (0x2bc6)
Data: 010101020206000000000a02010302020103042800
Opcode: Codec Configuration (0x01)
Number of ASE(s): 1
ASE: #0
ASE ID: 0x01
Target Latency: Balance Latency/Reliability (0x02)
PHY: 0x02
LE 2M PHY (0x02)
Codec: LC3 (0x06)
Codec Specific Configuration #0: len 0x02 type 0x01
Sampling Frequency: 16 Khz (0x03)
Codec Specific Configuration #1: len 0x02 type 0x02
Frame Duration: 10 ms (0x01)
Codec Specific Configuration #2: len 0x03 type 0x04
Frame Length: 40 (0x0028)
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Thu, 16 Jun 2022 19:31:02 +0000 (12:31 -0700)]
monitor/att: Add decoding support for PAC Audio Context
This adds decoding support for PAC Audio Context attributes:
> ACL Data RX: Handle 42 flags 0x02 dlen 9
Channel: 65 len 5 sdu 3 [PSM 39 mode Enhanced Credit (0x81)] {chan 1}
ATT: Read Request (0x0a) len 2
Handle: 0x0026 Type: Supported Audio Contexts (0x2bce)
< ACL Data TX: Handle 42 flags 0x00 dlen 11
Channel: 64 len 7 sdu 5 [PSM 39 mode Enhanced Credit (0x81)] {chan 1}
ATT: Read Response (0x0b) len 4
Value:
ff0f0e00
Handle: 0x0026 Type: Supported Audio Contexts (0x2bce)
Sink Context: 0x0fff
Unspecified (0x0001)
Conversational (0x0002)
Media (0x0004)
Game (0x0008)
Instructional (0x0010)
Voice Assistants (0x0020)
Live (0x0040)
Sound Effects (0x0080)
Notifications (0x0100)
Ringtone (0x0200)
Alerts (0x0400)
Emergency alarm (0x0800)
Source Context: 0x000e
Conversational (0x0002)
Media (0x0004)
Game (0x0008)
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 15 Jun 2022 23:56:37 +0000 (16:56 -0700)]
monitor/att: Add decoding support for PAC Sink/Source Location
This adds decoding support for PAC Sink/Source Location attributes:
> ACL Data RX: Handle 42 flags 0x02 dlen 9
Channel: 65 len 5 sdu 3 [PSM 39 mode Enhanced Credit (0x81)] {chan 1}
ATT: Read Request (0x0a) len 2
Handle: 0x001a Type: Sink Audio Locations (0x2bca)
< ACL Data TX: Handle 42 flags 0x00 dlen 11
Channel: 64 len 7 sdu 5 [PSM 39 mode Enhanced Credit (0x81)] {chan 1}
ATT: Read Response (0x0b) len 4
Value:
03000000
Handle: 0x001a Type: Sink Audio Locations (0x2bca)
Location: 0x00000003
Front Left (0x00000001)
Front Right (0x00000002)
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Fri, 17 Jun 2022 00:30:31 +0000 (17:30 -0700)]
monitor/att: Print attribute information on ATT_REQ_RSP
This prints the attribute information on ATT_REQ_RSP to make it easier
to identify to which handle the response is for:
> ACL Data RX: Handle 42 flags 0x02 dlen 9
Channel: 65 len 5 sdu 3 [PSM 39 mode Enhanced Credit (0x81)] {chan 1}
ATT: Read Response (0x0b) len 2
Value: 0300
Handle: 0x0030 Type: Source ASE (0x2bc5)
ASE ID: 3
State: Idle (0x00)
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 14 Jun 2022 21:55:00 +0000 (14:55 -0700)]
bluetoothd.rst: Document -K/--kernel option
This documents -K/--kernel experimental features options.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 14 Jun 2022 21:45:44 +0000 (14:45 -0700)]
main.conf: Split Kernel Experimental UUIDs from Experimental
This splits kernel experimental UUIDs from D-Bus Experimental interface
so they can be controlled indenpendetly.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Brian Gix [Tue, 14 Jun 2022 17:13:38 +0000 (10:13 -0700)]
mesh: Fix keyring snprintf usage range checking
snprintf performs it's own range checking and returns a negative value
if string construction fails. Not checking the return value throws a
warning at compile time on GCC 12 and later. This patch removes
redundent range chacking and checks all snprintf return values.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 14 Jun 2022 18:38:56 +0000 (11:38 -0700)]
advertising: Fix attempting to set scan_rsp
BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E page 2450
• If extended advertising PDU types are being used (bit 4 = 0) then:
The advertisement shall not be both connectable and scannable.
So instead this attempts to set name as part of Advertising Data rather
then setting it as Scan Response:
bluetoothctl> advertise.secondary 2M
bluetoothctl> advertise.name Intel-3
bluetoothctl> advertise on
< HCI Command: LE Set Extended Advertising Parameters (0x08|0x0036) plen 25
Handle: 0x01
Properties: 0x0001
Connectable
Min advertising interval: 1280.000 msec (0x0800)
Max advertising interval: 1280.000 msec (0x0800)
Channel map: 37, 38, 39 (0x07)
Own address type: Public (0x00)
Peer address type: Public (0x00)
Peer address: 00:00:00:00:00:00 (OUI 00-00-00)
Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00)
TX power: Host has no preference (0x7f)
Primary PHY: LE 1M (0x01)
Secondary max skip: 0x00
Secondary PHY: LE 2M (0x02)
SID: 0x00
Scan request notifications: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 5
LE Set Extended Advertising Parameters (0x08|0x0036) ncmd 1
Status: Success (0x00)
TX power (selected): 7 dbm (0x07)
< HCI Command: LE Set Extended Advertising Data (0x08|0x0037) plen 4
Handle: 0x01
Operation: Complete extended advertising data (0x03)
Fragment preference: Minimize fragmentation (0x01)
Data length: 0x00
@ MGMT Event: Command Complete (0x0001) plen 7
Add Extended Advertising Parameters (0x0054) plen 4
Status: Success (0x00)
Instance: 1
TX power: 7 dbm (0x07)
Available adv data len: 31
Available scan rsp data len: 31
> HCI Event: Command Complete (0x0e) plen 4
LE Set Extended Advertising Data (0x08|0x0037) ncmd 1
Status: Success (0x00)
@ MGMT Command: Add Extended Advertising Data (0x0055) plen 23
Instance: 1
Advertising data length: 12
Name (complete): Intel-3
Flags: 0x06
LE General Discoverable Mode
BR/EDR Not Supported
Scan response length: 0
< HCI Command: LE Set Extended Advertising Data (0x08|0x0037) plen 16
Handle: 0x01
Operation: Complete extended advertising data (0x03)
Fragment preference: Minimize fragmentation (0x01)
Data length: 0x0c
Name (complete): Intel-3
Flags: 0x06
LE General Discoverable Mode
BR/EDR Not Supported
> HCI Event: Command Complete (0x0e) plen 4
LE Set Extended Advertising Data (0x08|0x0037) ncmd 1
Status: Success (0x00)
< HCI Command: LE Set Extended Scan Response Data (0x08|0x0038) plen 4
Handle: 0x01
Operation: Complete scan response data (0x03)
Fragment preference: Minimize fragmentation (0x01)
Data length: 0x00
> HCI Event: Command Complete (0x0e) plen 4
LE Set Extended Scan Response Data (0x08|0x0038) ncmd 1
Status: Success (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
> HCI Event: Command Complete (0x0e) plen 4
LE Set Extended Advertising Enable (0x08|0x0039) ncmd 2
Status: Success (0x00)
@ MGMT Event: Command Complete (0x0001) plen 4
Add Extended Advertising Data (0x0055) plen 1
Status: Success (0x00)
Instance: 1
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 7 Jun 2022 22:24:31 +0000 (15:24 -0700)]
monitor/att: Fix decoding for notifications
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Thu, 9 Jun 2022 18:08:23 +0000 (11:08 -0700)]
device: Add connectable flag to bearer state
This adds connectable flag to state so it can be used to detect which is
the last seen connectable bearer.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Mon, 13 Jun 2022 19:48:43 +0000 (12:48 -0700)]
mgmt-tester: Fix regression with tests failing to setup
This fixes the regression introduced by
ab31e2f7e828df3d971cba6f12859edc69f149d5 which causes tests using
add_advertising_mgmt_cmd_arr:
Add Advertising - Success (Name+data+appear) Timed out
Add Ext Advertising - Success (Name+data+appear) Timed out
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
wangyouwan [Mon, 13 Jun 2022 11:37:13 +0000 (19:37 +0800)]
obexd: Fix callback->func =! NULL in the xfer_complete() func
xfer_complete (obex=0x557d242c8cf0, err=0x557d242ca470,
user_data=0x557d242ca300) at obexd/client/transfer.c:659
659 obexd/client/transfer.c:
(gdb) n
661 in obexd/client/transfer.c
(gdb) n
663 in obexd/client/transfer.c
(gdb) p callback->func
$1 = (transfer_callback_t) 0x0
(gdb) n
668 in obexd/client/transfer.c
(gdb) n
671 in obexd/client/transfer.c
(gdb) n
672 in obexd/client/transfer.c
(gdb) n
676 in obexd/client/transfer.c
(gdb) n
677 in obexd/client/transfer.c
(gdb) n
0x0000000000000000 in ?? ()
(gdb) s
Cannot find bounds of current function
(gdb) c
Continuing.
Program received signal SIGSEGV, Segmentation fault.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Frédéric Danis [Fri, 10 Jun 2022 16:38:20 +0000 (18:38 +0200)]
test-runner: Add udevd and trigger events
Kernel events should have been managed so the audio card is accessible
from PipeWire
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Frédéric Danis [Fri, 10 Jun 2022 16:38:19 +0000 (18:38 +0200)]
test-runner: Add audio card support
With this commit audio daemons can detect an audio card with output and
input, allowing to test interaction between BlueZ and the audio daemon.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Frédéric Danis [Fri, 10 Jun 2022 16:38:18 +0000 (18:38 +0200)]
doc/test-runner: Add audio config options
List the build options for an AC97 audio card necessary for test with
audio daemon.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Frédéric Danis [Fri, 10 Jun 2022 16:38:17 +0000 (18:38 +0200)]
test-runner: Add DBus session support
Audio daemons requests access to DBus session to start
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Frédéric Danis [Fri, 3 Jun 2022 14:54:47 +0000 (16:54 +0200)]
btproxy: Allow to select multiple BT controllers
When running on a computer with a real Bluetooth controller (e.g. hci0) and
multiple emulators (e.g. hci1 and hci2) it isn't possible to use the
emulators with 2 test-runner vms.
If btproxy is started without index parameter the first test-runner will
use hci0, and btprox can't be started with multiple index parameters
(e.g. -i1 -i2).
This patch keeps the old beahvior when used without -i option, in this case
it will try to use the first controller available.
It also allows to select multiple controllers to be used by btproxy.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Pauli Virtanen [Sun, 5 Jun 2022 12:29:27 +0000 (15:29 +0300)]
a2dp: error return paths in a2dp_reconfig must free allocated setup
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Pauli Virtanen [Sun, 5 Jun 2022 12:29:26 +0000 (15:29 +0300)]
a2dp: disallow multiple SetConfiguration to same local SEP
Using the remote SEP SetConfiguration DBus API, it's possible to make
multiple remote endpoints use the same local SEP, if they are endpoints
from different connected devices. This is invalid: successful
configuration shall prevent a different device configuring the same SEP
(AVDTP v1.3 Sec. 5.3). Moreover, this breaks the assumption in the
AVDTP code that each SEP has at most a single stream, and causes
misbehavior later on (subsequent transport acquires fail with EPERM).
Fix this by first checking the SEP is free before proceeding in the DBus
API call. Also add a sanity check in avdtp_set_configuration, to reject
configuring an already configured SEP similarly as in avdtp_setconf_cmd.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Thu, 2 Jun 2022 21:18:52 +0000 (14:18 -0700)]
monitor: Stop spamming logs when GATT db cannot be loaded
This stops calling hci_devba everytime the GATT db needs to be loaded
since that causes a raw socket to be open to read back the address
pointed by the index, instead this is done only once at assign_handle
and store in packet_conn_data.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Marcel Holtmann [Fri, 10 Jun 2022 17:55:13 +0000 (19:55 +0200)]
mesh: Fix issue with snprintf return value check and format-truncation error
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Michael Brudevold [Fri, 3 Jun 2022 21:26:04 +0000 (16:26 -0500)]
doc/coding-style: Update URL to kernel coding style
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Tedd Ho-Jeong An [Wed, 8 Jun 2022 05:14:18 +0000 (22:14 -0700)]
device: Fix not deleting the folder after removing the device
This patch fixes the issue not deleting the device folder when the
device is removed.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Thu, 2 Jun 2022 18:52:06 +0000 (11:52 -0700)]
mgmt-tester: Fix build error
This fixes the following build error:
CC tools/mgmt-tester.o
tools/mgmt-tester.c: In function ‘setup_command_generic’:
tools/mgmt-tester.c:7503:16: error: the comparison will always evaluate
as ‘true’ for the pointer operand in
‘(const struct setup_mgmt_cmd *)test->setup_mgmt_cmd_arr +
(sizetype)(i * 24)’ must not be NULL [-Werror=address]
7503 | for (; test->setup_mgmt_cmd_arr + i; ++i) {
| ^~~~
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 1 Jun 2022 21:20:27 +0000 (14:20 -0700)]
test-runner: Enable BT_HCIUART and BT_HCIUART_H4
These options are required when running with -u option since that uses
H4 headers to serialize the communication of host and guest.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 1 Jun 2022 21:09:23 +0000 (14:09 -0700)]
test-runner: Fix not waiting for system_bus_socket
This makes test-runner wait for system_bus_socket to be available before
continuing otherwise the likes of bluetoothd would likely fail to start.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Joseph Hwang [Thu, 26 May 2022 11:24:49 +0000 (19:24 +0800)]
doc: Introduce the quality report command and event
Add the MGMT quality report command and event in doc/mgmt-api.txt.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Gopal Tiwari [Tue, 31 May 2022 07:41:17 +0000 (13:11 +0530)]
mesh-gatt: Fix use_after_free
Following scenario happens when prov is false and we have double free as
mentioned in the below
bluez-5.64/tools/mesh-gatt/prov-db.c:847: freed_arg: "g_free" frees
"in_str".
bluez-5.64/tools/mesh-gatt/prov-db.c:867: double_free: Calling "g_free"
frees pointer "in_str" which has already been freed.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Gopal Tiwari [Tue, 31 May 2022 07:41:16 +0000 (13:11 +0530)]
meshctl: Fix possible use_after_free
Reported by coverity tool as follows :
bluez-5.64/tools/meshctl.c:1968: freed_arg: "g_free" frees "mesh_dir".
bluez-5.64/tools/meshctl.c:2018: double_free: Calling "g_free" frees
pointer "mesh_dir" which has already been freed.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Gopal Tiwari [Tue, 31 May 2022 07:41:15 +0000 (13:11 +0530)]
pbap: Fix memory leak
Reported by coverity tool as follows:
bluez-5.64/obexd/client/pbap.c:929: leaked_storage: Variable "apparam"
going out of scope leaks the storage it points to.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Gopal Tiwari [Tue, 31 May 2022 07:41:13 +0000 (13:11 +0530)]
obex-client: Fix leaked_handle
While performing static tool analysis using coverity found following
reports for resouse leak
bluez-5.64/tools/obex-client-tool.c:315: leaked_handle: Handle variable
"sk" going out of scope leaks the handle.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Gopal Tiwari [Tue, 31 May 2022 07:41:12 +0000 (13:11 +0530)]
mesh/mesh-db: Fix resource leaks
While performing static tool analysis using coverity found following
reports for resouse leak
bluez-5.64/tools/mesh/mesh-db.c:2388: leaked_handle: Handle variable
"fd" going out of scope leaks the handle.
bluez-5.64/tools/mesh/mesh-db.c:2388: leaked_storage: Variable "str"
going out of scope leaks the storage it points to.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Gopal Tiwari [Tue, 31 May 2022 07:41:11 +0000 (13:11 +0530)]
l2cap-tester: Fix leaked_handle
While performing static tool analysis using coverity found following
reports for resouse leak
bluez-5.64/tools/l2cap-tester.c:1712: leaked_handle: Handle variable
"new_sk" going out of scope leaks the handle.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Gopal Tiwari [Tue, 31 May 2022 07:41:10 +0000 (13:11 +0530)]
create-image: Fix leaked_handle
While performing static tool analysis using coverity found following
reports for resouse leak
bluez-5.64/tools/create-image.c:124: leaked_storage: Variable "map"
going out of scope leaks the storage it points to.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Gopal Tiwari [Tue, 31 May 2022 07:41:09 +0000 (13:11 +0530)]
cltest: Fix leaked_handle
While performing static tool analysis using coverity found
following reports for resouse leak
bluez-5.64/tools/cltest.c:75: leaked_handle: Handle variable "fd"
going out of scope leaks the handle.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Gopal Tiwari [Tue, 31 May 2022 07:41:08 +0000 (13:11 +0530)]
sixaxis: Fix memory leaks
While performing static tool analysis using coverity
found following reports for resouse leak
bluez-5.64/plugins/sixaxis.c:425: alloc_arg:
"get_pairing_type_for_device" allocates memory that is
stored into "sysfs_path".
bluez-5.64/plugins/sixaxis.c:428: leaked_storage: Variable "sysfs_path"
going out of scope leaks the storage it points to.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Gopal Tiwari [Tue, 31 May 2022 07:41:07 +0000 (13:11 +0530)]
monitor: Fix memory leaks
While performing static tool analysis using coverity
found following reports for resouse leak
bluez-5.64/monitor/jlink.c:111: leaked_storage: Variable "so"
going out of scope leaks the storage it points to.
bluez-5.64/monitor/jlink.c:113: leaked_storage: Variable "so"
going out of scope leaks the storage it points to.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Gopal Tiwari [Tue, 31 May 2022 07:41:06 +0000 (13:11 +0530)]
mesh/appkey: Fix memory leaks
While performing the static analysis using the coverity tool found
following memory leak reports
bluez-5.64/mesh/appkey.c:143: leaked_storage: Variable "key" going
out of scope leaks the storage it points to.
Error: RESOURCE_LEAK (CWE-772):
bluez-5.64/mesh/appkey.c:146: leaked_storage: Variable "key" going
out of scope leaks the storage it points to.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Gopal Tiwari [Tue, 31 May 2022 07:41:05 +0000 (13:11 +0530)]
client/gatt: Fix memory leak issues
While performing the static tool analysis using coverity tool
found following reports
Error: RESOURCE_LEAK (CWE-772):
bluez-5.64/client/gatt.c:1531: leaked_storage: Variable "service"
going out of scope leaks the storage it points to.
Error: RESOURCE_LEAK (CWE-772):
bluez-5.64/client/gatt.c:2626: leaked_storage: Variable "chrc"
going out of scope leaks the storage it points to.
Error: RESOURCE_LEAK (CWE-772):
bluez-5.64/client/gatt.c:2906: leaked_storage: Variable "desc"
going out of scope leaks the storage it points to.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 24 May 2022 01:41:37 +0000 (18:41 -0700)]
monitor/att: Add decoding support for ASE Control Point
This adds decoding support for ASE Control Point attribute:
> ACL Data RX: Handle 42 flags 0x02 dlen 30
Channel: 64 len 26 sdu 24 [PSM 39 mode Enhanced Credit (0x81)] {chan 1}
ATT: Write Command (0x52) len 23
Handle: 0x0030 Type: ASE Control Point (0x2bc6)
Data: 010103020206000000000a02010302020103042800
Opcode: Codec Configuration (0x01)
Number of ASE(s): 1
ASE: #0
ASE ID: 0x03
Target Latency: Balance Latency/Reliability (0x02)
PHY: 0x02
LE 2M PHY (0x02)
Codec: LC3 (0x06)
Codec Specific Configuration #0: len 0x02 type 0x01
Codec Specific Configuration: 03
Codec Specific Configuration #1: len 0x02 type 0x02
Codec Specific Configuration: 01
Codec Specific Configuration #2: len 0x03 type 0x04
Codec Specific Configuration: 2800
< ACL Data TX: Handle 42 flags 0x00 dlen 55
Channel: 64 len 51 sdu 49 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Handle Multiple Value Notification (0x23) len 48
Length: 0x0005
Handle: 0x0030 Type: ASE Control Point (0x2bc6)
Data:
0101030000
Opcode: Codec Configuration (0x01)
Number of ASE(s): 1
ASE: #0
ASE ID: 0x03
ASE Response Code: Success (0x00)
ASE Response Reason: None (0x00)
> ACL Data RX: Handle 42 flags 0x02 dlen 27
Channel: 64 len 23 sdu 21 [PSM 39 mode Enhanced Credit (0x81)] {chan 1}
ATT: Write Command (0x52) len 20
Handle: 0x0030 Type: ASE Control Point (0x2bc6)
Data:
020103000010270000022800020a00409c00
Opcode: QoS Configuration (0x02)
Number of ASE(s): 1
ASE: #0
ASE ID: 0x03
CIG ID: 0x00
CIS ID: 0x00
SDU Interval: 10000 usec
Framing: Unframed (0x00)
PHY: 0x02
LE 2M PHY (0x02)
Max SDU: 40
RTN: 2
Max Transport Latency: 10
Presentation Delay: 40000 us
< ACL Data TX: Handle 42 flags 0x00 dlen 37
Channel: 64 len 33 sdu 31 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Handle Multiple Value Notification (0x23) len 30
Length: 0x0005
Handle: 0x0030 Type: ASE Control Point (0x2bc6)
Data:
0201030000
Opcode: QoS Configuration (0x02)
Number of ASE(s): 1
ASE: #0
ASE ID: 0x03
ASE Response Code: Success (0x00)
ASE Response Reason: None (0x00)
> ACL Data RX: Handle 42 flags 0x02 dlen 17
Channel: 64 len 13 sdu 11 [PSM 39 mode Enhanced Credit (0x81)] {chan 1}
ATT: Write Command (0x52) len 10
Handle: 0x0030 Type: ASE Control Point (0x2bc6)
Data:
0301030403020200
Opcode: Enable (0x03)
Number of ASE(s): 1
ASE: #0
ASE ID: 0x03
Metadata #0: len 0x03 type 0x02
Metadata: 0200
< ACL Data TX: Handle 42 flags 0x00 dlen 33
Channel: 64 len 29 sdu 27 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Handle Multiple Value Notification (0x23) len 26
Length: 0x0005
Handle: 0x0030 Type: ASE Control Point (0x2bc6)
Data:
0301030000
Opcode: Enable (0x03)
Number of ASE(s): 1
ASE: #0
ASE ID: 0x03
ASE Response Code: Success (0x00)
ASE Response Reason: None (0x00)
> ACL Data RX: Handle 42 flags 0x02 dlen 12
Channel: 64 len 8 sdu 6 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Write Command (0x52) len 5
Handle: 0x0030 Type: ASE Control Point (0x2bc6)
Data: 050101
Opcode: Disable (0x05)
Number of ASE(s): 1
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Mon, 23 May 2022 22:53:23 +0000 (15:53 -0700)]
monitor/att: Add decoding support for ASE Sink/Source
This adds decoding support for ASE Sink/Source attributes:
> ACL Data RX: Handle 42 flags 0x02 dlen 9
Channel: 65 len 5 sdu 3 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Read Request (0x0a) len 2
Handle: 0x002a Type: Sink ASE (0x2bc4)
< ACL Data TX: Handle 42 flags 0x00 dlen 9
Channel: 64 len 5 sdu 3 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Read Response (0x0b) len 2
Value: 0300
ASE ID: 1
State: Idle (0x00)
< ACL Data TX: Handle 42 flags 0x00 dlen 55
Channel: 64 len 51 sdu 49 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Handle Multiple Value Notification (0x23) len 48
Length: 0x0023
Handle: 0x0024 Type: Sink ASE (0x2bc4)
Data: 01010000000a00204e00409c00204e00409c0006000000000a02010302020103042800
ASE ID: 1
State: Codec Configured (0x01)
Framing: Unframed PDUs supported (0x00)
PHY: 0x00
RTN: 0
Max Transport Latency: 10
Presentation Delay Min: 20000 us
Presentation Delay Max: 40000 us
Preferred Presentation Delay Min: 20000 us
Preferred Presentation Delay Max: 40000 us
Codec: LC3 (0x06)
Codec Specific Configuration #0: len 0x02 type 0x01
Codec Specific Configuration: 03
Codec Specific Configuration #1: len 0x02 type 0x02
Codec Specific Configuration: 01
Codec Specific Configuration #2: len 0x03 type 0x04
Codec Specific Configuration: 2800
< ACL Data TX: Handle 42 flags 0x00 dlen 37
Channel: 64 len 33 sdu 31 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Handle Multiple Value Notification (0x23) len 30
Length: 0x0011
Handle: 0x0024 Type: Sink ASE (0x2bc4)
Data:
0102000010270000022800020a00409c00
ASE ID: 1
State: QoS Configured (0x02)
CIG ID: 0x00
CIS ID: 0x00
SDU Interval: 10000 usec
Framing: Unframed (0x00)
PHY: 0x02
LE 2M PHY (0x02)
Max SDU: 40
RTN: 2
Max Transport Latency: 10
Presentation Delay: 40000 us
< ACL Data TX: Handle 42 flags 0x00 dlen 33
Channel: 64 len 29 sdu 27 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Handle Multiple Value Notification (0x23) len 26
Length: 0x000d
Handle: 0x002a Type: Source ASE (0x2bc5)
Data:
03030000060304030202000000
ASE ID: 3
State: Enabling (0x03)
CIG ID: 0x00
CIS ID: 0x00
Metadata #0: len 0x03 type 0x04
Metadata: 0302
Metadata #1: len 0x02 type 0x00
< ACL Data TX: Handle 42 flags 0x00 dlen 39
Channel: 64 len 35 sdu 33 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Handle Multiple Value Notification (0x23) len 32
Length: 0x000d
Handle: 0x002a Type: Source ASE (0x2bc5)
Data:
03040000060304030202000000
ASE ID: 3
State: Streaming (0x04)
CIG ID: 0x00
CIS ID: 0x00
Metadata #0: len 0x03 type 0x04
Metadata: 0302
Metadata #1: len 0x02 type 0x00
< ACL Data TX: Handle 42 flags 0x00 dlen 33
Channel: 64 len 29 sdu 27 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Handle Multiple Value Notification (0x23) len 26
Length: 0x000d
Handle: 0x002a Type: Source ASE (0x2bc5)
Data:
03050000060304030202000000
ASE ID: 3
State: Disabling (0x05)
CIG ID: 0x00
CIS ID: 0x00
Metadata #0: len 0x03 type 0x04
Metadata: 0302
Metadata #1: len 0x02 type 0x00
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Fri, 20 May 2022 22:51:42 +0000 (15:51 -0700)]
monitor/att: Add decoding support for PAC Sink/Source
This adds decoding support for PAC Sink/Source attributes:
< ACL Data TX: Handle 42 flags 0x00 dlen 9
Channel: 64 len 5 sdu 3 [PSM 39 mode Enhanced Credit (0x81)]
{chan 0}
ATT: Read Request (0x0a) len 2
Handle: 0x0017 Type: Sink PAC (0x2bc9)
> ACL Data RX: Handle 42 flags 0x02 dlen 31
Channel: 65 len 27 sdu 25 [PSM 39 mode Enhanced Credit (0x81)]
{chan 0}
Value: 010600000000100301ff0002020302030305041e00f00000
Number of PAC(s): 1
PAC #0:
Codec: LC3 (0x06)
Codec Specific Configuration #0: len 0x03 type 0x01
Codec Specific Configuration: ff00
Codec Specific Configuration #1: len 0x02 type 0x02
Codec Specific Configuration: 03
Codec Specific Configuration #2: len 0x02 type 0x03
Codec Specific Configuration: 03
Codec Specific Configuration #3: len 0x05 type 0x04
Codec Specific Configuration:
1e00f000
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Thu, 26 May 2022 20:47:13 +0000 (13:47 -0700)]
monitor/att: Simplify CCC decoders
This simplify callbacks moving the decoding of the value to
print_ccc_value.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 25 May 2022 00:51:44 +0000 (17:51 -0700)]
monitor/att: Fix parsing of notifications
If there are multiple notifications in the same frame the callback may
alter it when using l2cap_frame_pull helpers, so instead this passes a
cloned frame with just the expected length so callbacks cannot alter
original frame.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 25 May 2022 00:49:57 +0000 (17:49 -0700)]
monitor/att: Attempt to reload if database is empty
If database is empty attempt to reload since the daemon may have
updated its cache in the meantime.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Inga Stotland [Fri, 20 May 2022 23:41:51 +0000 (16:41 -0700)]
client: Fix setting of advertisement interval
This fixes incorrect argument read when using "interval" command
in "advertisement" submenu
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Fri, 20 May 2022 23:51:38 +0000 (16:51 -0700)]
monitor/att: Fix parsing of Notify Mutiple
Notify Multiple was parsing handle multiple times causing the length to
be assumed to be a handle.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Fri, 20 May 2022 23:36:57 +0000 (16:36 -0700)]
monitor/att: Fix not matching read frame direction
There could be read frames pending on both direction so this ensures
the direction is matched properly.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Fri, 20 May 2022 23:18:46 +0000 (16:18 -0700)]
monitor/att: Fix treating Notification/Indication as a request
Notification/Indication shall be treated as response so the correct
database is used.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Fri, 20 May 2022 23:17:11 +0000 (16:17 -0700)]
monitor/att: Fix not removing read from queue
The code was using queue_find instead of queue_remove_if so follow up
read wouldn't match the attribute properly.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Thu, 19 May 2022 21:36:06 +0000 (14:36 -0700)]
gatt-server: Fix crash while disconnecting
If there is a pending notify multiple the code was not removing before
freeing the object causing the following crash:
Invalid read of size 8
at 0x4A3D10: notify_multiple (gatt-server.c:1703)
by 0x4D05F0: timeout_callback (timeout-glib.c:25)
by 0x4956900: ??? (in /usr/lib64/libglib-2.0.so.0.7000.5)
by 0x49560AE: g_main_context_dispatch
(in /usr/lib64/libglib-2.0.so.0.7000.5)
by 0x49AB307: ??? (in /usr/lib64/libglib-2.0.so.0.7000.5)
by 0x49557C2: g_main_loop_run
(in /usr/lib64/libglib-2.0.so.0.7000.5)
by 0x4D0A34: mainloop_run (mainloop-glib.c:66)
by 0x4D0F2B: mainloop_run_with_signal (mainloop-notify.c:188)
by 0x2B0CD1: main (main.c:1276)
Address 0x6ca35c8 is 136 bytes inside a block of size 144 free'd
at 0x48470E4: free (vg_replace_malloc.c:872)
by 0x415E73: gatt_server_cleanup (device.c:698)
by 0x415E73: attio_cleanup (device.c:715)
by 0x47745B: queue_foreach (queue.c:207)
by 0x490C54: disconnect_cb (att.c:701)
by 0x4CF4AF: watch_callback (io-glib.c:157)
by 0x49560AE: g_main_context_dispatch
(in /usr/lib64/libglib-2.0.so.0.7000.5)
by 0x49AB307: ??? (in /usr/lib64/libglib-2.0.so.0.7000.5)
by 0x49557C2: g_main_loop_run
(in /usr/lib64/libglib-2.0.so.0.7000.5)
by 0x4D0A34: mainloop_run (mainloop-glib.c:66)
by 0x4D0F2B: mainloop_run_with_signal (mainloop-notify.c:188)
by 0x2B0CD1: main (main.c:1276)
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Fri, 20 May 2022 00:52:39 +0000 (17:52 -0700)]
monitor/att: Add decoding support for CCC
This adds decoding support for CCC so its value can be decoded:
< ACL Data TX: Handle 3585 flags 0x00 dlen 7
ATT: Read Request (0x0a) len 2
Handle: 0x002c Type: Client Characteristic Configuration (0x2902)
> ACL Data RX: Handle 3585 flags 0x02 dlen 6
ATT: Read Response (0x0b) len 1
Value: 01
Notification (0x01)
< ACL Data TX: Handle 3585 flags 0x00 dlen 9
ATT: Write Request (0x12) len 4
Handle: 0x002c Type: Client Characteristic Configuration (0x2902)
Data: 0100
Notification (0x01)
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 18 May 2022 00:45:22 +0000 (17:45 -0700)]
monitor/att: Decode attribute type
This attempt to decode the attribute type if its gatt_db can be loaded:
< ACL Data TX: Handle 3585 flags 0x00 dlen 9
ATT: Write Request (0x12) len 4
Handle: 0x000b Type: Client Characteristic Configuration (0x2902)
Data: 0200
Change-Id: I7c35c3e872237c82763a65b5f22a450684eb8cd7
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 18 May 2022 01:22:01 +0000 (18:22 -0700)]
monitor: Cache connection information
This caches connection information including the device addres so it can
be printed alongside the handle:
> HCI Event: Disconnect Complete (0x05) plen 4
Status: Success (0x00)
Handle: 3585 Address: 68:79:12:XX:XX:XX (OUI 68-79-12)
Reason: Connection Terminated By Local Host (0x16)
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 17 May 2022 00:50:38 +0000 (17:50 -0700)]
monitor: Move ATT decoding function into its own file
This moves ATT decoding function from l2cap.c to att.c.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Tue, 17 May 2022 00:37:56 +0000 (17:37 -0700)]
monitor: Move print_hex_field to display.h
This moves print_hex_field to display.h and removes the duplicated code
from packet.c and l2cap.c.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 18 May 2022 21:50:12 +0000 (14:50 -0700)]
gatt: Store local GATT database
This enables storing the local (adapter) GATT database which later will
be used by btmon to decode GATT handles.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 11 May 2022 22:33:27 +0000 (15:33 -0700)]
settings: Add btd_settings_gatt_db_{store,load}
This adds helper functions to store and load from/to file so they can
get reused by the likes of gatt-database.c and btmon.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Archie Pusaka [Wed, 18 May 2022 04:33:07 +0000 (12:33 +0800)]
input/device: Notify failure if ctrl disconnect when waiting intr
On some rare occasions, the peer HID device might disconnect the ctrl
channel when we are trying to connect the intr channel. If this
happens, interrupt_connect_cb() will not be called by btio, and we
will be stuck in "connecting" state. Any future connection attempt to
the peer device will fail because of "busy".
This patch prevents that by checking if we need to report connection
failure when the ctrl channel is disconnected.
Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Fri, 13 May 2022 01:01:03 +0000 (18:01 -0700)]
hog-lib: Fix not reading report_map of instances
If there is multiple instances the gatt_db of the instances was not
initialized causing the report_map_attr to be NULL which prevents the
report_map to be read and uhid device to be created.
Fixes: https://github.com/bluez/bluez/issues/298
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Thu, 12 May 2022 23:40:49 +0000 (16:40 -0700)]
device: Fix enabling wake support without RPA Resolution
If device uses RPA it shall only enable wakeup if RPA Resolution has
been enabled otherwise it cannot be programmed in the acceptlist which
can cause suspend to fail.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=215768
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Thu, 12 May 2022 00:55:14 +0000 (17:55 -0700)]
gatt-db: Allow passing Characteristic Value to gatt_db_attribute_get_char_data
This makes gatt_db_attribute_get_char_data work with Characteristic
Value rather than only with Characteristic Declaration.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Thu, 12 May 2022 00:55:15 +0000 (17:55 -0700)]
service: Add initiator argument to service_accept
This adds initiator argument to service_accept so profiles accepting
the connection can use btd_service_is_initiator to determine if the
connection was initiated locally (central) or remotely (peripheral).
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
wangyouwan [Tue, 10 May 2022 01:27:35 +0000 (09:27 +0800)]
device: Fix pairing has failed due to the error of Already Paired (0x13)
After connect the Bluetooth mouse, open two Bluetoothctl at the same time,
when remove the mouse, quickly go to power off,
try to paired the mouse again when I was power on,
found that the error 0x13 was always reported.
try to connect directly,can connect successfully.
but use the info command to query the information of the mouse
and find that the pairing status of the mouse is No.
so I try to delete the paired information in the kernel
through the "* cancel_pairing()" interface.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Ildar Kamaletdinov [Sat, 7 May 2022 17:35:05 +0000 (20:35 +0300)]
device: Fix uninitialized value usage
Definitely `dbus_bool_t b;` must be initialized before comparing it
with current value.
Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Ildar Kamaletdinov [Sat, 7 May 2022 17:35:04 +0000 (20:35 +0300)]
tools: Fix handle leak in rfcomm
Some branches of execution can make handle (socket) leakage.
Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Ildar Kamaletdinov [Sat, 7 May 2022 17:35:03 +0000 (20:35 +0300)]
tools: Fix memory leaks in btgatt-server/client
According to man buffer allocated by getline() should be freed by
the user program even if getline() failed.
Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Ildar Kamaletdinov [Sat, 7 May 2022 17:35:02 +0000 (20:35 +0300)]
tools: Fix memory leak in hciconfig
printf() was using function that return dynamic allocated memory as
a parameter.
Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Fri, 6 May 2022 23:05:14 +0000 (16:05 -0700)]
advertising: Treat empty LocalName the same as omitting it
This treats empty LocalName ("") the same as omitting it so not name is
set in the advertising data since some D-Bus binding seems to have
problems to omit properties at runtime.
Fixes: https://github.com/bluez/bluez/issues/337
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Luiz Augusto von Dentz [Wed, 4 May 2022 23:39:30 +0000 (16:39 -0700)]
device-api: Clarify Paired/Bonded documentation
This attempt to clarify the distinction of Paired and Bonded
properties.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Zhengping Jiang [Wed, 4 May 2022 21:09:48 +0000 (14:09 -0700)]
client: Add filter to devices and show Bonded in info
Use the property name as optional filters to the command "devices" and
show the "Bonded" property for the command "info".
Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
Reviewed-by: Yun-Hao Chung <howardchung@chromium.org>
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Zhengping Jiang [Wed, 4 May 2022 21:09:46 +0000 (14:09 -0700)]
device: Add "Bonded" flag to dbus property
Add "Bonded" to dbus device property table. When setting the "Bonded
flag, check the status of the Bonded property first. If the Bonded
property is changed, send property changed signal.
Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
Reviewed-by: Yun-Hao Chung <howardchung@chromium.org>
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>