提交 7b683b74 编写于 作者: F Florian Grandel 提交者: Marcel Holtmann

Bluetooth: mgmt: multi adv for enable_advertising()

Previously enable_advertising() would rely on
get_adv_instance_scan_rsp_len() which checked for a hard coded instance
identifier. This is being changed to check for the current advertising
instance's scan response length instead. The function is renamed
accordingly.
Signed-off-by: NFlorian Grandel <fgrandel@gmail.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
上级 bea28e65
...@@ -986,16 +986,23 @@ static u32 get_adv_instance_flags(struct hci_dev *hdev, u8 instance) ...@@ -986,16 +986,23 @@ static u32 get_adv_instance_flags(struct hci_dev *hdev, u8 instance)
return adv_instance->flags; return adv_instance->flags;
} }
static u8 get_adv_instance_scan_rsp_len(struct hci_dev *hdev, u8 instance) static u8 get_cur_adv_instance_scan_rsp_len(struct hci_dev *hdev)
{ {
/* Ignore instance 0 and other unsupported instances */ u8 instance = get_current_adv_instance(hdev);
if (instance != 0x01) struct adv_info *adv_instance;
/* Ignore instance 0 */
if (instance == 0x00)
return 0;
adv_instance = hci_find_adv_instance(hdev, instance);
if (!adv_instance)
return 0; return 0;
/* TODO: Take into account the "appearance" and "local-name" flags here. /* TODO: Take into account the "appearance" and "local-name" flags here.
* These are currently being ignored as they are not supported. * These are currently being ignored as they are not supported.
*/ */
return hdev->adv_instance.scan_rsp_len; return adv_instance->scan_rsp_len;
} }
static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr)
...@@ -1266,7 +1273,7 @@ static void enable_advertising(struct hci_request *req) ...@@ -1266,7 +1273,7 @@ static void enable_advertising(struct hci_request *req)
if (connectable) if (connectable)
cp.type = LE_ADV_IND; cp.type = LE_ADV_IND;
else if (get_adv_instance_scan_rsp_len(hdev, instance)) else if (get_cur_adv_instance_scan_rsp_len(hdev))
cp.type = LE_ADV_SCAN_IND; cp.type = LE_ADV_SCAN_IND;
else else
cp.type = LE_ADV_NONCONN_IND; cp.type = LE_ADV_NONCONN_IND;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册