platform/upstream/bluez.git
12 months agomonitor/att: Revert treating Notification/Indication as a request
Luiz Augusto von Dentz [Tue, 18 Oct 2022 23:43:09 +0000 (16:43 -0700)]
monitor/att: Revert treating Notification/Indication as a request

Notification/Indication shall be treated as response (rsp=true) so the
correct database is used:

> ACL Data RX: Handle 3585 flags 0x02 dlen 14
      ATT: Handle Value Notification (0x1b) len 9
        Handle: 0x002a Type: Report (0x2a4d)
          Data: 0000feffff0000

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomonitor/att: Detect cache changes
Luiz Augusto von Dentz [Tue, 18 Oct 2022 21:25:10 +0000 (14:25 -0700)]
monitor/att: Detect cache changes

This attempts to detect if the were any changes on cache files since
they were last loaded and then attempt to reload them.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agosettings: Fix scan-build warning
Luiz Augusto von Dentz [Tue, 18 Oct 2022 21:23:50 +0000 (14:23 -0700)]
settings: Fix scan-build warning

This fixes the following warning:

src/settings.c:281:7: warning: Branch condition evaluates to a garbage
value [core.uninitialized.Branch]
                if (ret) {
                    ^~~

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomonitor/att: Add decoding support for GMCS
Abhay Maheta [Tue, 18 Oct 2022 04:38:31 +0000 (10:08 +0530)]
monitor/att: Add decoding support for GMCS

This adds decoding support for GMCS attributes.

< ACL Data TX: Handle 3585 flags 0x00 dlen 7
      ATT: Read Request (0x0a) len 2
        Handle: 0x0056 Type: Media Control Point Opcodes Supported (0x2ba5)
> ACL Data RX: Handle 3585 flags 0x02 dlen 9
      ATT: Read Response (0x0b) len 4
        Value: 33180000
        Handle: 0x0056 Type: Media Control Point Opcodes Supported (0x2ba5)
              Supported Opcodes: 0x00001833
                Play (0x00000001)
                Pause (0x00000002)
                Stop (0x00000010)
                Move Relative (0x00000020)
                Previous Track (0x00000800)
                Next Track (0x00001000)

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoshared/mcp: Add initial code for handling MCP
Abhay Maheta [Tue, 18 Oct 2022 04:38:29 +0000 (10:08 +0530)]
shared/mcp: Add initial code for handling MCP

This adds initial code for Media Control Profile for Client Role.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agolib/uuid: Add GMCS UUIDs
Abhay Maheta [Tue, 18 Oct 2022 04:38:28 +0000 (10:08 +0530)]
lib/uuid: Add GMCS UUIDs

This adds GMCS UUIDs which will be used by Media Control Profile.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomonitor: Fix incorrect vendor name for vendor cmd and evt
Tedd Ho-Jeong An [Fri, 14 Oct 2022 18:57:20 +0000 (11:57 -0700)]
monitor: Fix incorrect vendor name for vendor cmd and evt

This patch fixes the issue that the vendor name for all vendor HCI
command and event are display as Microsoft.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Keep cancelled SAR data for at least 10 sec
Isak Westin [Tue, 11 Oct 2022 14:06:12 +0000 (16:06 +0200)]
mesh: Keep cancelled SAR data for at least 10 sec

When a SAR transmission has been completed or cancelled, the recipent
should store the block authentication values for at least 10 seconds
and ignore new segments with the same values during this period. See
MshPRFv1.0.1 section 3.5.3.4.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomgmt-tester: Fix Set Static Address tests
Luiz Augusto von Dentz [Sat, 8 Oct 2022 01:14:10 +0000 (18:14 -0700)]
mgmt-tester: Fix Set Static Address tests

Set Static Address tests needs to power after setting the address since
the programming of the address using the HCI command only happens during
power on procedure.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agovhci: Add function to interact with force_static_address
Luiz Augusto von Dentz [Sat, 8 Oct 2022 01:14:09 +0000 (18:14 -0700)]
vhci: Add function to interact with force_static_address

This adds functions that can be used to set debugfs
force_static_address.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agobtdev: Add support for setting bdaddr
Luiz Augusto von Dentz [Sat, 8 Oct 2022 01:14:08 +0000 (18:14 -0700)]
btdev: Add support for setting bdaddr

This adds btdev_set_bdaddr so it is possible to set an arbritrary
address.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoshared/bap: Fixing memory overwrite during ASE Enable Operation
Abhay Maheta [Fri, 7 Oct 2022 17:45:17 +0000 (23:15 +0530)]
shared/bap: Fixing memory overwrite during ASE Enable Operation

This fixes memory overwrite during ASE Enable operation handling.
It avoids crashing of bluetoothd if metadata of more than sizeo of
size_t is received.

This also fixes storing metadata to stream structure.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Fix msg cache ring buffer
Isak Westin [Thu, 6 Oct 2022 14:59:27 +0000 (16:59 +0200)]
mesh: Fix msg cache ring buffer

The message cache should be a strict ring buffer, suppressed message
should not move to the front of the queue.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agotools: mgmt-tester - Test for HCI cmd after static addr set
Brian Gix [Thu, 6 Oct 2022 22:51:35 +0000 (15:51 -0700)]
tools: mgmt-tester - Test for HCI cmd after static addr set

This change checks for the expected HCI command after Static Address
change requested.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: provisionee: Check prov start parameters
Isak Westin [Thu, 6 Oct 2022 14:59:25 +0000 (16:59 +0200)]
mesh: provisionee: Check prov start parameters

Verify that all parameters in a Provisioning Start PDU are valid, also
compared to the capabilities that has been sent.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: provisionee: Handle failed provisioning
Isak Westin [Thu, 6 Oct 2022 14:59:24 +0000 (16:59 +0200)]
mesh: provisionee: Handle failed provisioning

When a provisioning fails, all additionally received PDU should be
unexpected until link is closed by provisioner. See MshPRFv1.0.1 section
5.4.4.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: provisionee: Handle unknown PDUs
Isak Westin [Thu, 6 Oct 2022 14:59:23 +0000 (16:59 +0200)]
mesh: provisionee: Handle unknown PDUs

If an unknown PDU is received during provisioning, the provisioning
should fail with "Invalid PDU".

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Update Key Refresh flag after provision
Isak Westin [Thu, 6 Oct 2022 14:59:22 +0000 (16:59 +0200)]
mesh: Update Key Refresh flag after provision

The Key Refresh flag in the Secure Network beacon is now correctly
updated based on provisioning data after being successfully provisioned.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Always relay messages from Low Power nodes
Isak Westin [Tue, 4 Oct 2022 08:25:30 +0000 (10:25 +0200)]
mesh: Always relay messages from Low Power nodes

If we receive a message from one of our Low Power nodes, which is
encrypted using frendship credentials and where the destination is not
us, we must relay that message using master credentials.
See MshPRFv1.0.1 section 3.6.6.2.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Queue a friend update on IV Update change
Isak Westin [Tue, 4 Oct 2022 08:25:29 +0000 (10:25 +0200)]
mesh: Queue a friend update on IV Update change

A friend update should be queued when we receive a Secure Network beacon
that changes the IV Update state.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Verify padding bits in Friend Poll messages
Isak Westin [Tue, 4 Oct 2022 08:25:28 +0000 (10:25 +0200)]
mesh: Verify padding bits in Friend Poll messages

The padding bits in a Friend Poll message must be zero.
See MshPRFv1.0.1 section 3.6.5.1.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Correct size of friend cache
Isak Westin [Tue, 4 Oct 2022 08:25:27 +0000 (10:25 +0200)]
mesh: Correct size of friend cache

The cache size communicated to the Low Power node should be the same as
the cache size actually used.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Fix mesh to work with MESH_IO_TYPE_UNIT_TEST
Inga Stotland [Wed, 5 Oct 2022 20:43:09 +0000 (13:43 -0700)]
mesh: Fix mesh to work with MESH_IO_TYPE_UNIT_TEST

This fixes mesh io flow for MESH_IO_TYPE_UNIT_TEST which
got broken after:
commit 9966cb8b6999a5f54fc13acbd7e1526512a84342
("mesh: Add new kernel MGMT based IO transport")

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoREADME: Update Mesh required Kernel Config section
Inga Stotland [Tue, 4 Oct 2022 00:14:59 +0000 (17:14 -0700)]
README: Update Mesh required Kernel Config section

Add CONFIG_CRYPTO_USER_API_SKCIPHER to the list of the required
.config options

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Allow Key Refresh Phase 0 to 3 transition
Isak Westin [Thu, 29 Sep 2022 11:03:44 +0000 (13:03 +0200)]
mesh: Allow Key Refresh Phase 0 to 3 transition

Transition to Phase 3 from Phase 0 does not cause any state change, but
is a valid transition. See MshPRFv1.0.1 section 4.2.14.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Allow Key refresh to skip Phase 2
Isak Westin [Thu, 29 Sep 2022 11:03:43 +0000 (13:03 +0200)]
mesh: Allow Key refresh to skip Phase 2

If we are in Key Refresh Phase 1, and receive a Secure Network beacon
using the new NetKey and with KR flag set to 0, Phase 2 should be
skipped. See MshPRFv1.0.1 section 3.10.4.1.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Ignore SNB with invalid IV Index values
Isak Westin [Thu, 29 Sep 2022 11:03:42 +0000 (13:03 +0200)]
mesh: Ignore SNB with invalid IV Index values

If we are in IV update in progress state, and receive a Secure Network
beacon with an IV index equal to last known IV index + 1, and IV update
flag set to 1, it should be ignored. See MshPRFv1.0.1 section 3.10.5.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Ignore Secure Network Beacon from subnet
Isak Westin [Thu, 29 Sep 2022 11:03:41 +0000 (13:03 +0200)]
mesh: Ignore Secure Network Beacon from subnet

If this node is a member of a primary subnet and receives a Secure Network
beacon on a secondary subnet with an IV Index greater than the last known
IV Index of the primary subnet, the Secure Network beacon shall be ignored.
See MshPRFv1.0.1 section 3.10.5.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoclient/player: Fix attempting to acquire already acquired transport
Luiz Augusto von Dentz [Wed, 28 Sep 2022 20:54:47 +0000 (13:54 -0700)]
client/player: Fix attempting to acquire already acquired transport

If the transport has links check if the link is acquiring before
attempting to call Acquire otherwise it may cause an error to be
printed.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agotools: Fix mesh-tester to expect end of ADV
Brian Gix [Tue, 27 Sep 2022 22:52:27 +0000 (15:52 -0700)]
tools: Fix mesh-tester to expect end of ADV

Tester was failing by not clearing the HCI queue of expected events

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomonitor/packet: Fix scan-build warnings
Luiz Augusto von Dentz [Tue, 27 Sep 2022 19:24:19 +0000 (12:24 -0700)]
monitor/packet: Fix scan-build warnings

This fixes the following warnings:

monitor/packet.c:410:4: warning: Value stored to 'ts_pos' is never read
[deadcode.DeadStores]
                        ts_pos += n;
                        ^         ~
monitor/packet.c:455:4: warning: Value stored to 'pos' is never read
[deadcode.DeadStores]
                        pos += n;
                        ^      ~
monitor/packet.c:7477:2: warning: Value stored to 'mask' is never read
[deadcode.DeadStores]
        mask = tx_phys;
        ^      ~~~~~~~
monitor/packet.c:7485:2: warning: Value stored to 'mask' is never read
[deadcode.DeadStores]
        mask = rx_phys;
        ^      ~~~~~~~
monitor/packet.c:11229:3: warning: Value stored to 'str' is never read
[deadcode.DeadStores]
                str = "AoA Constant Tone Extension";
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
monitor/packet.c:11232:3: warning: Value stored to 'str' is never read
[deadcode.DeadStores]
                str = "AoA Constant Tone Extension with 1us slots";
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
monitor/packet.c:11235:3: warning: Value stored to 'str' is never read
[deadcode.DeadStores]
                str = "AoD Constant Tone Extension with 2us slots";
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
monitor/packet.c:11238:3: warning: Value stored to 'str' is never read
[deadcode.DeadStores]
                str = "No Constant Tone Extension";
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
monitor/packet.c:11241:3: warning: Value stored to 'str' is never read
[deadcode.DeadStores]
                str = "Reserved";
                ^     ~~~~~~~~~~
monitor/packet.c:11242:3: warning: Value stored to 'color_on' is never read
[deadcode.DeadStores]
                color_on = COLOR_RED;
                ^          ~~~~~~~~~

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomonitor/analyze: Fix scan-build warnings
Luiz Augusto von Dentz [Mon, 26 Sep 2022 23:01:54 +0000 (16:01 -0700)]
monitor/analyze: Fix scan-build warnings

This fixes the following warnings:

monitor/analyze.c:381:2: warning: Value stored to 'data' is never read
[deadcode.DeadStores]
        data += sizeof(*hdr);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:382:2: warning: Value stored to 'size' is never read
[deadcode.DeadStores]
        size -= sizeof(*hdr);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:398:2: warning: Value stored to 'data' is never read
[deadcode.DeadStores]
        data += sizeof(*evt);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:399:2: warning: Value stored to 'size' is never read
[deadcode.DeadStores]
        size -= sizeof(*evt);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:418:2: warning: Value stored to 'data' is never read
[deadcode.DeadStores]
        data += sizeof(*evt);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:419:2: warning: Value stored to 'size' is never read
[deadcode.DeadStores]
        size -= sizeof(*evt);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:527:2: warning: Value stored to 'data' is never read
[deadcode.DeadStores]
        data += sizeof(subtype);
        ^       ~~~~~~~~~~~~~~~
monitor/analyze.c:528:2: warning: Value stored to 'size' is never read
[deadcode.DeadStores]
        size -= sizeof(subtype);
        ^       ~~~~~~~~~~~~~~~
monitor/analyze.c:629:2: warning: Value stored to 'data' is never read
[deadcode.DeadStores]
        data += sizeof(*hdr);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:630:2: warning: Value stored to 'size' is never read
[deadcode.DeadStores]
        size -= sizeof(*hdr);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:646:2: warning: Value stored to 'data' is never read
[deadcode.DeadStores]
        data += sizeof(*hdr);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:647:2: warning: Value stored to 'size' is never read
[deadcode.DeadStores]
        size -= sizeof(*hdr);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:710:2: warning: Value stored to 'data' is never read
[deadcode.DeadStores]
        data += sizeof(*hdr);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:711:2: warning: Value stored to 'size' is never read
[deadcode.DeadStores]
        size -= sizeof(*hdr);
        ^       ~~~~~~~~~~~~

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agorctest: Fix scan-build warning
Luiz Augusto von Dentz [Mon, 26 Sep 2022 22:53:41 +0000 (15:53 -0700)]
rctest: Fix scan-build warning

This fixes the following warning:

tools/rctest.c:131:2: warning: 1st function call argument is an
uninitialized value [core.CallAndMessage]
        sdp_list_free(protos, NULL);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Clear HB sub status field if disabled
Isak Westin [Mon, 26 Sep 2022 13:01:10 +0000 (15:01 +0200)]
mesh: Clear HB sub status field if disabled

When replying to a HB subscription get message, and the current state of
source or destination fields is zero (which means that HB subscription
is disabled), all fields in the status reply should be zero.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Correct HB sub state updates
Isak Westin [Mon, 26 Sep 2022 13:01:09 +0000 (15:01 +0200)]
mesh: Correct HB sub state updates

If heartbeat subscription is disabled, all fields should be set to zero
but collected data should be preserved. If HB subscription is enabled,
the collected data should be reset (which includes Min Hops = 0x7f).
HB subscription is disabled by setting any of the following fields to
zero: Source, destination or period log.
HB subscription is enabled by setting all the same fields to valid values.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Reply to HB pub set with same fields
Isak Westin [Mon, 26 Sep 2022 13:01:08 +0000 (15:01 +0200)]
mesh: Reply to HB pub set with same fields

If a Config Heartbeat Publication Set message is unsuccessfully
processed, the fields in the status reply should be the same as in the
original message. See MshPRFv1.0.1 section 4.4.1.2.15.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Correct u32 to u8 log transformation
Isak Westin [Mon, 26 Sep 2022 13:01:07 +0000 (15:01 +0200)]
mesh: Correct u32 to u8 log transformation

Fixed the log transformation to correctly follow the value mapping
defined in the mesh profile (section 4.1.2).

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Add new kernel MGMT based IO transport
Brian Gix [Thu, 22 Sep 2022 22:31:02 +0000 (15:31 -0700)]
mesh: Add new kernel MGMT based IO transport

1. Re-structures MGMT handling such that it is used to detect kernel
   support of the mesh MGMT opcodes and events before selecting between
   using MGMT or the legacy raw HCI socket method.

2. Re-structures main() to allow command line to prefer MGMT over HCI or
   visa versa, plus optionally pass an explicte controller.

3. Adds mesh-io-mgmt as a transport.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Improve PB-ADV timing for reliability
Brian Gix [Thu, 22 Sep 2022 22:31:01 +0000 (15:31 -0700)]
mesh: Improve PB-ADV timing for reliability

Because provisioning is not speed dependent, Timing on outbound PB-ADV
packets have been modified to be less likely missed by remote controlers
with looser timing capabilities.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agotools/mpris-proxy: unregister object path if player registration fails
Haochen Tong [Sun, 25 Sep 2022 16:31:39 +0000 (00:31 +0800)]
tools/mpris-proxy: unregister object path if player registration fails

The `owner' string, passed as user data, is freed if the player fails
registration, but the object path still exists. Upon program exiting,
the lingering path will be enumerated and the attached user data will be
freed again.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agotools: fix printf format strings
Christian Eggers [Fri, 23 Sep 2022 10:51:41 +0000 (12:51 +0200)]
tools: fix printf format strings

time_t is 64 bit (long long) on many 32 bit platforms (e.g. ARM) now

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomonitor: fix printf format strings
Christian Eggers [Fri, 23 Sep 2022 10:51:40 +0000 (12:51 +0200)]
monitor: fix printf format strings

time_t is 64 bit (long long) on many 32 bit platforms (e.g. ARM) now

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoclient/player: fix printf format string
Christian Eggers [Fri, 23 Sep 2022 10:51:39 +0000 (12:51 +0200)]
client/player: fix printf format string

Use macros from inttypes.h for correct printf format specifier for
int64_t

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoclient/gatt: Fix scan-build warning
Luiz Augusto von Dentz [Fri, 23 Sep 2022 20:47:10 +0000 (13:47 -0700)]
client/gatt: Fix scan-build warning

This fixes the following warning:

client/gatt.c:2146:2: warning: Null pointer passed to 2nd parameter
expecting 'nonnull' [core.NonNullParamChecker]
        memcpy(*dst_value + offset, src_val, src_len);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agobattery: provided_battery_property_changed_cb: check iterator
Christian Eggers [Fri, 23 Sep 2022 14:58:14 +0000 (16:58 +0200)]
battery: provided_battery_property_changed_cb: check iterator

The passed iterator can be NULL as in
gdbus/client.c::properties_changed():
...
   proxy->prop_func(..., ..., iter=NULL, ...)
   +--src/battery.c::provided_battery_property_changed_cb(, , iter, );
      +--dbus_message_iter_get_arg_type(iter);
...

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agogatt: proxy_property_changed: check for NULL iterator
Christian Eggers [Fri, 23 Sep 2022 14:58:13 +0000 (16:58 +0200)]
gatt: proxy_property_changed: check for NULL iterator

The passed iterator can be NULL as in
src/gatt-database.c::properties_changed():
...
   proxy->prop_func(..., ..., iter=NULL, ...)
   +--client/gatt.c::property_changed_cb(..., ..., iter, ...);
      +--dbus_message_iter_get_arg_type(iter);
...

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoclient/gatt: proxy_property_changed: check for NULL iterator
Christian Eggers [Fri, 23 Sep 2022 14:58:12 +0000 (16:58 +0200)]
client/gatt: proxy_property_changed: check for NULL iterator

The passed iterator can be NULL as in
gdbus/client.c::properties_changed():
...
   proxy->prop_func(..., ..., iter=NULL, ...)
   +--client/gatt.c::proxy_property_changed(..., ..., iter, ...);
      +--dbus_message_iter_get_arg_type(iter);
...

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoadvertising: parse_tx_power: reset value if iter is NULL
Christian Eggers [Fri, 23 Sep 2022 14:58:11 +0000 (16:58 +0200)]
advertising: parse_tx_power: reset value if iter is NULL

Set property to its default value (as done in all other methods listed
in parsers[]).

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoadvertising: parse_[min|max]_interval: reset value if iter is NULL
Christian Eggers [Fri, 23 Sep 2022 14:57:31 +0000 (16:57 +0200)]
advertising: parse_[min|max]_interval: reset value if iter is NULL

Set property to its default value (as done in all other methods listed
in parsers[]).

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoadvertising: parse_min_interval: reset min_interval if iter is NULL
Christian Eggers [Fri, 23 Sep 2022 14:55:57 +0000 (16:55 +0200)]
advertising: parse_min_interval: reset min_interval if iter is NULL

Set property to its default value (as done in all other methods listed
in parsers[]).

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoadvertising: parse_secondary: check for NULL iterator
Christian Eggers [Fri, 23 Sep 2022 14:55:56 +0000 (16:55 +0200)]
advertising: parse_secondary: check for NULL iterator

The passed iterator can be NULL as in
gdbus/client.c::properties_changed():
...
   proxy->prop_func(..., ..., iter=NULL, ...)
   +--src/advertising.c::properties_changed(..., ..., iter, ...);
      +--parse_secondary(iter, ...);
...

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoadvertising: parse_secondary: fix mask value
Christian Eggers [Fri, 23 Sep 2022 14:55:55 +0000 (16:55 +0200)]
advertising: parse_secondary: fix mask value

It looks like a wrong mask value is used here as only the bits mentioned
in adv_secondary::flag can be set again within the loop.

Replace magic number by preprocessor macro.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoadvertising: parse_secondary: fix loop condition
Christian Eggers [Fri, 23 Sep 2022 14:55:54 +0000 (16:55 +0200)]
advertising: parse_secondary: fix loop condition

"secondary" isn't an array of pointers, so the iterator can never be
NULL.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Reply error if appkey added for wrong netkey
Isak Westin [Fri, 23 Sep 2022 11:31:49 +0000 (13:31 +0200)]
mesh: Reply error if appkey added for wrong netkey

If a known appkey is added for a different netkey, the status reply
should be Invalid NetKey.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Clear addr field if virt sub failed
Isak Westin [Fri, 23 Sep 2022 11:31:48 +0000 (13:31 +0200)]
mesh: Clear addr field if virt sub failed

If processing failed for a Config Model Subscription Virtual Address
Add/Delete/Overwrite message, the address field in the status reply
should be set to zero. See MshPRFv1.0.1 section 4.4.1.2.8.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agolib: Add defines of new MGMT opcodes and events
Brian Gix [Thu, 22 Sep 2022 20:38:50 +0000 (13:38 -0700)]
lib: Add defines of new MGMT opcodes and events

Populated new opcodes and events into static mgmt_ev and mgmt_op string
arrays.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomgmt: Add support for Mesh in the kernel
Brian Gix [Thu, 22 Sep 2022 20:38:49 +0000 (13:38 -0700)]
mgmt: Add support for Mesh in the kernel

These commands and events allow User space apps to test for Mesh
support, and request incoming mesh packets be delivered and request
outbound mesh packets to be sent. This is the basis for sharing
one controller between the legacy bluetoothd daemon and the mesh
bluetooth-meshd daemon.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Remove RFU check for publication set
Isak Westin [Wed, 21 Sep 2022 11:16:30 +0000 (13:16 +0200)]
mesh: Remove RFU check for publication set

It is not stated in the mesh profile that the RFU bits in a Model
Publication Set message have to be zero. In fact, PTS test
MESH/NODE/CFG/MP/BV-01-C is sending that command with non-zero RFU and
expects a reply.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Do not accept publication for unbound appkey
Isak Westin [Wed, 21 Sep 2022 11:16:29 +0000 (13:16 +0200)]
mesh: Do not accept publication for unbound appkey

If a user tries to configure publication of a model with an appkey that
is not bound to that model, an error should be returned.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Add interface output filter
Isak Westin [Wed, 21 Sep 2022 11:16:28 +0000 (13:16 +0200)]
mesh: Add interface output filter

According to the mesh profile (3.4.5.2), if TTL is set to 1 for an
outgoing message, that message shall be dropped.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomesh: Fix potential memory leak
Brian Gix [Thu, 30 Jun 2022 21:10:13 +0000 (14:10 -0700)]
mesh: Fix potential memory leak

This memory leak will never happen, however since we added a new
return from function that malloc'd memory, the free should still be
done.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agotools/ioctl-tester - Add ioctl-tester
Tedd Ho-Jeong An [Wed, 21 Sep 2022 19:28:26 +0000 (12:28 -0700)]
tools/ioctl-tester - Add ioctl-tester

This patch adds ioctl-tester which tests the IOCTL commands.

HCI Down
Device List
Device List - Invalid Param 1
Device Info
Reset Stat
Set Link Mode - ACCEPT
Set Link Mode - MASTER
Set Pkt Type - DM
Set Pkt Type - DH
Set Pkt Type - HV
Set Pkt Type - 2-DH
Set Pkt Type - 2-DH
Set Pkt Type - ALL
Set ACL MTU - 1
Set ACL MTU - 2
Set SCO MTU - 1
Set SCO MTU - 2
Block BDADDR - Success
Block BDADDR - Fail
Unblock BDADDR - Success
Unblock BDADDR - Fail
Connection List - No Conn
Connection List
Connection Info
Connection Info - No Connection
Connection Info - Wrong Type
Authentication Info - No Connection
Authentication Info

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoProfiles: Enable bt_vcp_set_debug
Sathish Narasimman [Wed, 21 Sep 2022 10:27:32 +0000 (15:57 +0530)]
Profiles: Enable bt_vcp_set_debug

Set bt_vcp_set_debug to be used for VCP.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoshared/vcp: Add bt_vcp_set_debug
Sathish Narasimman [Wed, 21 Sep 2022 10:27:31 +0000 (15:57 +0530)]
shared/vcp: Add bt_vcp_set_debug

Add support for bt_vcp_set_debug and replace the exisiting DBG.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoshared/gatt-db: Fix scan-build warnings
Luiz Augusto von Dentz [Wed, 21 Sep 2022 21:52:53 +0000 (14:52 -0700)]
shared/gatt-db: Fix scan-build warnings

This fixes the following warnings:

src/shared/gatt-db.c:1339:2: warning: Undefined or garbage value
returned to caller [core.uninitialized.UndefReturn]
        return data.num_of_res;
        ^~~~~~~~~~~~~~~~~~~~~~

src/shared/gatt-db.c:725:5: warning: Access to field 'handle' results
in a dereference of a null pointer
        service->attributes[0]->handle == handle)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agogatt: Fix scan-build warnings
Luiz Augusto von Dentz [Wed, 21 Sep 2022 21:49:48 +0000 (14:49 -0700)]
gatt: Fix scan-build warnings

This fixes the following warnings:

src/gatt-database.c:3541:14: warning: Value stored to 'iface' during
its initialization is never read [deadcode.DeadStores]
        const char *iface = g_dbus_proxy_get_interface(proxy);
                    ^~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/gatt-database.c:3542:14: warning: Value stored to 'path' during
its initialization is never read [deadcode.DeadStores]
        const char *path = g_dbus_proxy_get_path(proxy);
                    ^~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoclient/gatt: Fix notification enabled/disabled output
Luiz Augusto von Dentz [Wed, 21 Sep 2022 21:45:03 +0000 (14:45 -0700)]
client/gatt: Fix notification enabled/disabled output

When notifications are enabled/disable the output was not print a new
line.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agogatt-db: Check if permissions are set when adding CCC
Luiz Augusto von Dentz [Wed, 21 Sep 2022 21:43:24 +0000 (14:43 -0700)]
gatt-db: Check if permissions are set when adding CCC

CCC shall always have some permission set.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agogatt: Fix not setting permissions for CCC
Luiz Augusto von Dentz [Wed, 21 Sep 2022 21:40:14 +0000 (14:40 -0700)]
gatt: Fix not setting permissions for CCC

CCC shall always have both Read and Write permissions set in addition to
what application set.

Fixes: https://github.com/bluez/bluez/issues/399
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomonitor/att: Add decoding support for Volume Control Serice
Sathish Narasimman [Mon, 19 Sep 2022 08:07:22 +0000 (13:37 +0530)]
monitor/att: Add decoding support for Volume Control Serice

This adds decoding support for VCS attributes

> ACL Data RX: Handle 3585 flags 0x02 dlen 7
      ATT: Read Request (0x0a) len 2
        Handle: 0x0017 Type: Volume State (0x2b7d)
< ACL Data TX: Handle 3585 flags 0x00 dlen 8
      ATT: Read Response (0x0b) len 3
        Value: 000000
        Handle: 0x0017 Type: Volume State (0x2b7d)
            Volume Setting: 0
            Not Muted: 0
            Change Counter: 0
> HCI Event: Number of Completed Packets (0x13) plen 5
        Num handles: 1
        Handle: 3585 Address: 49:71:FC:C0:66:C6 (Resolvable)
        Count: 1
> ACL Data RX: Handle 3585 flags 0x02 dlen 7
      ATT: Read Request (0x0a) len 2
        Handle: 0x001c Type: Volume Flags (0x2b7f)
< ACL Data TX: Handle 3585 flags 0x00 dlen 6
      ATT: Read Response (0x0b) len 1
        Value: 01
        Handle: 0x001c Type: Volume Flags (0x2b7f)
            Volume Falg: 1

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoprofiles: Add initial code for vcp plugin
Sathish Narasimman [Mon, 19 Sep 2022 08:07:21 +0000 (13:37 +0530)]
profiles: Add initial code for vcp plugin

This adds initial code for vcp plugin which handles Volume Control
Profile and Volume Control Service.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoshared/vcp: Add initial code for handling VCP
Sathish Narasimman [Mon, 19 Sep 2022 08:07:20 +0000 (13:37 +0530)]
shared/vcp: Add initial code for handling VCP

This adds initial code for Volume Control Profile.

Change-Id: I95452360c7963470ca535eb7fb47f162fff5a86d
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoshared/gatt-client: Make use of gatt_db_attribute_get_ccc
Luiz Augusto von Dentz [Fri, 16 Sep 2022 23:41:53 +0000 (16:41 -0700)]
shared/gatt-client: Make use of gatt_db_attribute_get_ccc

This makes use of gatt_db_attribute_get_ccc to locate a CCC of a given
attribute.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoshared/tester: Remove include to io.h
Luiz Augusto von Dentz [Fri, 16 Sep 2022 00:21:28 +0000 (17:21 -0700)]
shared/tester: Remove include to io.h

Users of tester.h shall also include io.h, including io.h by default may
cause errors if has been previously included.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoshared/bap: Remove include to io.h
Luiz Augusto von Dentz [Fri, 16 Sep 2022 00:14:39 +0000 (17:14 -0700)]
shared/bap: Remove include to io.h

Users of bap.h shall also include io.h, including io.h by default may
cause errors if has been previously included.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agolib/uuid: Add VCS UUIDs
Sathish Narasimman [Thu, 15 Sep 2022 09:54:09 +0000 (15:24 +0530)]
lib/uuid: Add VCS UUIDs

This adds Volume Control Service UUIDs which will be used by
Volume Control Profile.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agorfcomm-tester: Add test to close socket while connecting
Luiz Augusto von Dentz [Tue, 13 Sep 2022 23:32:38 +0000 (16:32 -0700)]
rfcomm-tester: Add test to close socket while connecting

This adds Basic RFCOMM Socket Client - Close test which attempt to close
socket while connecting.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoshared/bap: Fix attempting to disable stream when it is idle
Luiz Augusto von Dentz [Mon, 12 Sep 2022 21:21:13 +0000 (14:21 -0700)]
shared/bap: Fix attempting to disable stream when it is idle

If the stream is already in idle state do not attempt to disable it
again.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomonitor: Add mesh MGMT cmds/events to btmon parser
Brian Gix [Thu, 8 Sep 2022 14:55:55 +0000 (07:55 -0700)]
monitor: Add mesh MGMT cmds/events to btmon parser

Sample Output:
@ MGMT Command: Read Mesh Features (0x0058) plen 0
@ MGMT Event: Command Complete (0x0001) plen 7
      Read Mesh Features (0x0058) plen 4
        Status: Success (0x00)
        Index: 0
        Max Handles: 3
        Used Handles: 0

@ MGMT Command: Set Mesh Receiver (0x0057) plen 9
        Enable: 1
        Window: 4096
        Period: 4096
        Num AD Types: 3
          AD Type: 42
          AD Type: 43
          AD Type: 41
@ MGMT Event: Command Complete (0x0001) plen 3
      Set Mesh Receiver (0x0057) plen 0
        Status: Success (0x00)

@ MGMT Command: Mesh Send (0x0059) plen 43
        Address: 00:00:00:00:00:00 (OUI 00-00-00)
        Addr Type: 2
        Instant: 0x0000000000000000
        Delay: 0
        Count: 1
        Data Length: 24
        Data: 172b01002dda0c2491537ae2000000009de2120a725038b2
@ MGMT Event: Command Complete (0x0001) plen 4
      Mesh Send (0x0059) plen 1
        Status: Success (0x00)
        Handle: 3

@ MGMT Event: Mesh Packet Complete (0x0032) plen 1
        Handle: 3

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomonitor: Add ADV Monitor events to btmon parser
Brian Gix [Thu, 8 Sep 2022 14:55:54 +0000 (07:55 -0700)]
monitor: Add ADV Monitor events to btmon parser

Add missing ADV Monitor MGMT events

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoshared/bap: Fix not unregistering disconnect callback
Luiz Augusto von Dentz [Tue, 6 Sep 2022 19:54:36 +0000 (12:54 -0700)]
shared/bap: Fix not unregistering disconnect callback

bt_bap_detach shall always unregister the disconnect callback otherwise
the session pointer may still be accessible.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agorfcomm-tester: Use latest Bluetooth version
Luiz Augusto von Dentz [Fri, 2 Sep 2022 20:54:05 +0000 (13:54 -0700)]
rfcomm-tester: Use latest Bluetooth version

This makes rfcomm-tester use the latest Bluetooth supported by the
emulator which is useful the detect regression related to ACL data
transfer.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomgmt-tester: Adds turning on Mesh Experimental feature
Brian Gix [Thu, 1 Sep 2022 21:07:22 +0000 (14:07 -0700)]
mgmt-tester: Adds turning on Mesh Experimental feature

Turns on experimental Mesh feature, and expects it in report when
querying which experimental features are supported and have been
enabled.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agotools: Add mesh-tester to test Kernel mesh support
Brian Gix [Wed, 31 Aug 2022 23:59:32 +0000 (16:59 -0700)]
tools: Add mesh-tester to test Kernel mesh support

Ever growing set of tests for Mesh kernel support

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agolib: Add mgmt opcodes and events for Mesh
Brian Gix [Wed, 31 Aug 2022 23:59:31 +0000 (16:59 -0700)]
lib: Add mgmt opcodes and events for Mesh

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoadapter: Fix typo in function name
Bastien Nocera [Thu, 1 Sep 2022 11:07:18 +0000 (13:07 +0200)]
adapter: Fix typo in function name

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoadapter-api: Add PowerState property documentation
Bastien Nocera [Thu, 1 Sep 2022 11:07:17 +0000 (13:07 +0200)]
adapter-api: Add PowerState property documentation

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoclient: Print the PowerState property
Bastien Nocera [Thu, 1 Sep 2022 11:07:16 +0000 (13:07 +0200)]
client: Print the PowerState property

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoadapter: Implement PowerState property
Bastien Nocera [Thu, 1 Sep 2022 11:07:15 +0000 (13:07 +0200)]
adapter: Implement PowerState property

This property should allow any program to show whether an adapter is in
the process of being turned on.

As turning on an adapter isn't instantaneous, it's important that the UI
reflects the transitional state of the adapter's power, and doesn't
assume the device is already turned on but not yet working, or still off
despite having requested for it to be turned on, in both cases making
the UI feel unresponsive.

This can also not be implemented in front-ends directly as, then,
the status of an adapter wouldn't be reflected correctly in the Settings
window if it's turned on in the system menu. Implementing it in the
front-ends would also preclude from having feedback about the state of
the adapter when bluetoothd is the one powering up the adapter after the
rfkill was unblocked.

See https://gitlab.gnome.org/GNOME/gnome-bluetooth/-/issues/121
and the original https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5773

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoadapter: Keep track of whether the adapter is rfkill'ed
Bastien Nocera [Thu, 1 Sep 2022 11:07:14 +0000 (13:07 +0200)]
adapter: Keep track of whether the adapter is rfkill'ed

Instead of only replying to D-Bus requests with an error saying the
adapter is blocked, keep track of the rfkill being enabled or disabled
so we know the rfkill state of the adapter at all times.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomedia: Fix scan-build warnings
Luiz Augusto von Dentz [Tue, 30 Aug 2022 23:55:32 +0000 (16:55 -0700)]
media: Fix scan-build warnings

This fixes the following warnings:

profiles/audio/media.c:1465:6: warning: 8th function call argument
is an uninitialized value
        if (media_endpoint_create(adapter, sender, path, uuid, delay_reporting,
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/audio/media.c:3012:3: warning: Use of memory after it is freed
                release_endpoint(adapter->endpoints->data);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/audio/media.c:3015:3: warning: Use of memory after it is freed
                media_player_destroy(adapter->players->data);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agomedia: Fix registering PAC endpoints if ISO socket are not supported
Luiz Augusto von Dentz [Tue, 30 Aug 2022 21:49:20 +0000 (14:49 -0700)]
media: Fix registering PAC endpoints if ISO socket are not supported

If adapter don't support ISO sockets the PAC UUIDs shall not be allowed
to be registered as they depend on ISO sockets to work properly.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoshared/shell: Fix scan-build error
Luiz Augusto von Dentz [Tue, 30 Aug 2022 21:37:27 +0000 (14:37 -0700)]
shared/shell: Fix scan-build error

This fixes the following error:

src/shared/shell.c:1135:19: warning: Null pointer passed to 1st
parameter expecting 'nonnull'
                        data.timeout = atoi(optarg);
                                       ^~~~~~~~~~~~

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoclient/player: Fix checkpatch warning
Luiz Augusto von Dentz [Tue, 30 Aug 2022 21:24:08 +0000 (14:24 -0700)]
client/player: Fix checkpatch warning

This fixes the following checkpatch warning:

WARNING:LINE_SPACING: Missing a blank line after declarations
216: FILE: client/player.c:625:
+               GDBusProxy *proxy = l->data;
+               print_player(proxy, NULL);

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoprofiles: Fix function definition style
Frédéric Danis [Tue, 30 Aug 2022 14:47:34 +0000 (16:47 +0200)]
profiles: Fix function definition style

This was found by checkpatch in previous commit:
WARNING:SPACING: Unnecessary space before function pointer arguments
124: FILE: src/shared/bap.h:123:
+ int (*select) (struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,

Do the same for (*config) and (*clear) for consistence.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agodoc: Add remote endpoint path to SelectProperties
Frédéric Danis [Tue, 30 Aug 2022 14:47:33 +0000 (16:47 +0200)]
doc: Add remote endpoint path to SelectProperties

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoprofiles: Add remote endpoint path to SelectProperties
Frédéric Danis [Tue, 30 Aug 2022 14:47:32 +0000 (16:47 +0200)]
profiles: Add remote endpoint path to SelectProperties

This adds the remote endpoint path to the dictionary sent in
SelectProperties.
It allows audio application to know for which remote endpoint the call is
done and so for which it should act as an initiator.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoclient: Add -e/--endpoint option to auto register endpoints
Luiz Augusto von Dentz [Mon, 29 Aug 2022 21:36:06 +0000 (14:36 -0700)]
client: Add -e/--endpoint option to auto register endpoints

This adds -e/--endpoint option that can be used to auto register
supported endpoints.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agoshell: Set empty argument if optarg is NULL
Luiz Augusto von Dentz [Mon, 29 Aug 2022 21:33:04 +0000 (14:33 -0700)]
shell: Set empty argument if optarg is NULL

This sets enmpty string ("") when argument don't set any optarg so the
application can tell when an option was set or not.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
12 months agotools/btmgmt: add missing return statement
Christian Eggers [Thu, 25 Aug 2022 20:38:48 +0000 (22:38 +0200)]
tools/btmgmt: add missing return statement

Leave function on error instead of printing (possibly) invalid flags.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>