Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 411b4121 authored by Florian Grandel's avatar Florian Grandel Committed by Marcel Holtmann
Browse files

Bluetooth: mgmt: multi adv for get_adv_instance_flags()



The get_adv_instance_flags() would not work with instance identifiers
other than 0x01. This is being fixed so that arbitrary instance
identifiers can be dealt with while still correctly dealing with the
special case of the 0x00 identifier.

Signed-off-by: default avatarFlorian Grandel <fgrandel@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 3ff37e6b
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -960,12 +960,17 @@ static bool get_connectable(struct hci_dev *hdev)
static u32 get_adv_instance_flags(struct hci_dev *hdev, u8 instance)
{
	u32 flags;
	struct adv_info *adv_instance;

	if (instance != 0x00) {
		adv_instance = hci_find_adv_instance(hdev, instance);

	if (instance > 0x01)
		/* Return 0 when we got an invalid instance identifier. */
		if (!adv_instance)
			return 0;

	if (instance == 0x01)
		return hdev->adv_instance.flags;
		return adv_instance->flags;
	}

	/* Instance 0 always manages the "Tx Power" and "Flags" fields */
	flags = MGMT_ADV_FLAG_TX_POWER | MGMT_ADV_FLAG_MANAGED_FLAGS;