History

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)

Brian Gix committed 5 years ago

Commit 5e233ed1 parent 26ac4c51 file · +19 −14Browse files

Unified · Split

net/bluetooth/mgmt.c+19−14
@@ -3217,33 +3217,32 @@ static int user_passkey_neg_reply(struct sock *sk, struct hci_dev *hdev, · 3216 unmodified lines
3217 HCI_OP_USER_PASSKEY_NEG_REPLY, 0);3217 HCI_OP_USER_PASSKEY_NEG_REPLY, 0);
3218}3218}
3219 3219
3220static void adv_expire(struct hci_dev *hdev, u32 flags)3220static int adv_expire_sync(struct hci_dev *hdev, u32 flags)
3221{3221{
3222 struct adv_info *adv_instance;3222 struct adv_info *adv_instance;
3223 struct hci_request req;
3224 int err;
3225 3223
3226 adv_instance = hci_find_adv_instance(hdev, hdev->cur_adv_instance);3224 adv_instance = hci_find_adv_instance(hdev, hdev->cur_adv_instance);
3227 if (!adv_instance)3225 if (!adv_instance)
3228 return;3226 return 0;
3229 3227
3230 /* stop if current instance doesn't need to be changed */3228 /* stop if current instance doesn't need to be changed */
3231 if (!(adv_instance->flags & flags))3229 if (!(adv_instance->flags & flags))
3232 return;3230 return 0;
3233 3231
3234 cancel_adv_timeout(hdev);3232 cancel_adv_timeout(hdev);
3235 3233
3236 adv_instance = hci_get_next_instance(hdev, adv_instance->instance);3234 adv_instance = hci_get_next_instance(hdev, adv_instance->instance);
3237 if (!adv_instance)3235 if (!adv_instance)
3238 return;3236 return 0;
3239 3237
3240 hci_req_init(&req, hdev);3238 hci_schedule_adv_instance_sync(hdev, adv_instance->instance, true);
3241 err = __hci_req_schedule_adv_instance(&req, adv_instance->instance,
3242 true);
3243 if (err)
3244 return;
3245 3239
3246 hci_req_run(&req, NULL);3240 return 0;
3241}
3242
3243static int name_changed_sync(struct hci_dev *hdev, void *data)
3244{
3245 return adv_expire_sync(hdev, MGMT_ADV_FLAG_LOCAL_NAME);
3247}3246}
3248 3247
3249static void set_name_complete(struct hci_dev *hdev, void *data, int err)3248static 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) · 12 unmodified lines
3262 cp, sizeof(*cp));3261 cp, sizeof(*cp));
3263 3262
3264 if (hci_dev_test_flag(hdev, HCI_LE_ADV))3263 if (hci_dev_test_flag(hdev, HCI_LE_ADV))
3265 adv_expire(hdev, MGMT_ADV_FLAG_LOCAL_NAME);3264 hci_cmd_sync_queue(hdev, name_changed_sync, NULL, NULL);
3266 }3265 }
3267 3266
3268 mgmt_pending_remove(cmd);3267 mgmt_pending_remove(cmd);
@@ -3347,6 +3346,11 @@ failed: · 78 unmodified lines
3347 return err;3346 return err;
3348}3347}
3349 3348
3349static int appearance_changed_sync(struct hci_dev *hdev, void *data)
3350{
3351 return adv_expire_sync(hdev, MGMT_ADV_FLAG_APPEARANCE);
3352}
3353
3350static int set_appearance(struct sock *sk, struct hci_dev *hdev, void *data,3354static int set_appearance(struct sock *sk, struct hci_dev *hdev, void *data,
3351 u16 len)3355 u16 len)
3352{3356{
@@ -3368,7 +3372,8 @@ static int set_appearance(struct sock *sk, struct hci_dev *hdev, void *data, · 15 unmodified lines
3368 hdev->appearance = appearance;3372 hdev->appearance = appearance;
3369 3373
3370 if (hci_dev_test_flag(hdev, HCI_LE_ADV))3374 if (hci_dev_test_flag(hdev, HCI_LE_ADV))
3371 adv_expire(hdev, MGMT_ADV_FLAG_APPEARANCE);3375 hci_cmd_sync_queue(hdev, appearance_changed_sync, NULL,
3376 NULL);
3372 3377
3373 ext_info_changed(hdev, sk);3378 ext_info_changed(hdev, sk);
3374 }3379 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t