Commit 5e233ed5 authored by Brian Gix's avatar Brian Gix Committed by Marcel Holtmann

Bluetooth: hci_sync: Convert adv_expire

mgmt-test paths:
Set Advertising on - Appearance 1
Set Advertising on - Local name 1
Set Advertising on - Name + Appear 1
Set Local Name - Success 2
Set Local Name - Success 3
Add Advertising - Success (Empty ScRsp)
Add Advertising - Success (ScRsp appear)
Add Advertising - Invalid Params (ScRsp appear long)
Add Advertising - Success (Complete name)
Add Advertising - Success (Shortened name)
Add Advertising - Success (Short name)
Add Advertising - Success (Name + data)
Add Advertising - Invalid Params (Name + data)
Add Advertising - Success (Name+data+appear)
Set appearance - BR/EDR LE
Set appearance - LE only
Add Ext Advertising - Success (Empty ScRsp)
Add Ext Advertising - Success (ScRsp appear)
Add Ext Advertising - Invalid Params (ScRsp appear long)
Add Ext Advertising - Success (Complete name)
Add Ext Advertising - Success (Shortened name)
Add Ext Advertising - Success (Short name)
Add Ext Advertising - Success (Name + data)
Add Ext Advertising - Invalid Params (Name + data)
Add Ext Advertising - Success (Name+data+appear)
Signed-off-by: default avatarBrian Gix <brian.gix@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 26ac4c56
...@@ -3217,33 +3217,32 @@ static int user_passkey_neg_reply(struct sock *sk, struct hci_dev *hdev, ...@@ -3217,33 +3217,32 @@ static int user_passkey_neg_reply(struct sock *sk, struct hci_dev *hdev,
HCI_OP_USER_PASSKEY_NEG_REPLY, 0); HCI_OP_USER_PASSKEY_NEG_REPLY, 0);
} }
static void adv_expire(struct hci_dev *hdev, u32 flags) static int adv_expire_sync(struct hci_dev *hdev, u32 flags)
{ {
struct adv_info *adv_instance; struct adv_info *adv_instance;
struct hci_request req;
int err;
adv_instance = hci_find_adv_instance(hdev, hdev->cur_adv_instance); adv_instance = hci_find_adv_instance(hdev, hdev->cur_adv_instance);
if (!adv_instance) if (!adv_instance)
return; return 0;
/* stop if current instance doesn't need to be changed */ /* stop if current instance doesn't need to be changed */
if (!(adv_instance->flags & flags)) if (!(adv_instance->flags & flags))
return; return 0;
cancel_adv_timeout(hdev); cancel_adv_timeout(hdev);
adv_instance = hci_get_next_instance(hdev, adv_instance->instance); adv_instance = hci_get_next_instance(hdev, adv_instance->instance);
if (!adv_instance) if (!adv_instance)
return; return 0;
hci_req_init(&req, hdev); hci_schedule_adv_instance_sync(hdev, adv_instance->instance, true);
err = __hci_req_schedule_adv_instance(&req, adv_instance->instance,
true);
if (err)
return;
hci_req_run(&req, NULL); return 0;
}
static int name_changed_sync(struct hci_dev *hdev, void *data)
{
return adv_expire_sync(hdev, MGMT_ADV_FLAG_LOCAL_NAME);
} }
static void set_name_complete(struct hci_dev *hdev, void *data, int err) static void set_name_complete(struct hci_dev *hdev, void *data, int err)
...@@ -3262,7 +3261,7 @@ static void set_name_complete(struct hci_dev *hdev, void *data, int err) ...@@ -3262,7 +3261,7 @@ static void set_name_complete(struct hci_dev *hdev, void *data, int err)
cp, sizeof(*cp)); cp, sizeof(*cp));
if (hci_dev_test_flag(hdev, HCI_LE_ADV)) if (hci_dev_test_flag(hdev, HCI_LE_ADV))
adv_expire(hdev, MGMT_ADV_FLAG_LOCAL_NAME); hci_cmd_sync_queue(hdev, name_changed_sync, NULL, NULL);
} }
mgmt_pending_remove(cmd); mgmt_pending_remove(cmd);
...@@ -3347,6 +3346,11 @@ static int set_local_name(struct sock *sk, struct hci_dev *hdev, void *data, ...@@ -3347,6 +3346,11 @@ static int set_local_name(struct sock *sk, struct hci_dev *hdev, void *data,
return err; return err;
} }
static int appearance_changed_sync(struct hci_dev *hdev, void *data)
{
return adv_expire_sync(hdev, MGMT_ADV_FLAG_APPEARANCE);
}
static int set_appearance(struct sock *sk, struct hci_dev *hdev, void *data, static int set_appearance(struct sock *sk, struct hci_dev *hdev, void *data,
u16 len) u16 len)
{ {
...@@ -3368,7 +3372,8 @@ static int set_appearance(struct sock *sk, struct hci_dev *hdev, void *data, ...@@ -3368,7 +3372,8 @@ static int set_appearance(struct sock *sk, struct hci_dev *hdev, void *data,
hdev->appearance = appearance; hdev->appearance = appearance;
if (hci_dev_test_flag(hdev, HCI_LE_ADV)) if (hci_dev_test_flag(hdev, HCI_LE_ADV))
adv_expire(hdev, MGMT_ADV_FLAG_APPEARANCE); hci_cmd_sync_queue(hdev, appearance_changed_sync, NULL,
NULL);
ext_info_changed(hdev, sk); ext_info_changed(hdev, sk);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment