Bluetooth: Impmlement extended adv enable
This patch basically replaces legacy adv with extended adv based on the controller support. Currently there is no design change. ie only one adv set will be enabled at a time. This also adds tx_power in instance and store whatever returns from Set_ext_parameter, use the same in adv data as well. For instance 0 tx_power is stored in hdev only. < HCI Command: LE Set Extended Advertising Parameters (0x08|0x0036) plen 25 Handle: 0x00 Properties: 0x0010 Use legacy advertising PDUs: ADV_NONCONN_IND Min advertising interval: 1280.000 msec (0x0800) Max advertising interval: 1280.000 msec (0x0800) Channel map: 37, 38, 39 (0x07) Own address type: Random (0x01) Peer address type: Public (0x00) Peer address: 00:00:00:00:00:00 (OUI 00-00-00) Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00) TX power: 127 dbm (0x7f) Primary PHY: LE 1M (0x01) Secondary max skip: 0x00 Secondary PHY: LE 1M (0x01) SID: 0x00 Scan request notifications: Disabled (0x00) > HCI Event: Command Complete (0x0e) plen 5 LE Set Extended Advertising Parameters (0x08|0x0036) ncmd 1 Status: Success (0x00) TX power (selected): 7 dbm (0x07) < HCI Command: LE Set Extended Advertising Enable (0x08|0x0039) plen 6 Extended advertising: Enabled (0x01) Number of sets: 1 (0x01) Entry 0 Handle: 0x00 Duration: 0 ms (0x00) Max ext adv events: 0 > HCI Event: Command Complete (0x0e) plen 4 LE Set Extended Advertising Enable (0x08|0x0039) ncmd 2 Status: Success (0x00) Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:

committed by
Marcel Holtmann

parent
6b49bcb4bc
commit
de181e887a
@@ -940,7 +940,10 @@ static void rpa_expired(struct work_struct *work)
|
||||
* function.
|
||||
*/
|
||||
hci_req_init(&req, hdev);
|
||||
__hci_req_enable_advertising(&req);
|
||||
if (ext_adv_capable(hdev))
|
||||
__hci_req_start_ext_adv(&req, hdev->cur_adv_instance);
|
||||
else
|
||||
__hci_req_enable_advertising(&req);
|
||||
hci_req_run(&req, NULL);
|
||||
}
|
||||
|
||||
@@ -4382,9 +4385,14 @@ static int set_advertising(struct sock *sk, struct hci_dev *hdev, void *data,
|
||||
* HCI_ADVERTISING flag is not yet set.
|
||||
*/
|
||||
hdev->cur_adv_instance = 0x00;
|
||||
__hci_req_update_adv_data(&req, 0x00);
|
||||
__hci_req_update_scan_rsp_data(&req, 0x00);
|
||||
__hci_req_enable_advertising(&req);
|
||||
|
||||
if (ext_adv_capable(hdev)) {
|
||||
__hci_req_start_ext_adv(&req, 0x00);
|
||||
} else {
|
||||
__hci_req_update_adv_data(&req, 0x00);
|
||||
__hci_req_update_scan_rsp_data(&req, 0x00);
|
||||
__hci_req_enable_advertising(&req);
|
||||
}
|
||||
} else {
|
||||
__hci_req_disable_advertising(&req);
|
||||
}
|
||||
@@ -6312,7 +6320,11 @@ static u32 get_supported_adv_flags(struct hci_dev *hdev)
|
||||
flags |= MGMT_ADV_FLAG_APPEARANCE;
|
||||
flags |= MGMT_ADV_FLAG_LOCAL_NAME;
|
||||
|
||||
if (hdev->adv_tx_power != HCI_TX_POWER_INVALID)
|
||||
/* In extended adv TX_POWER returned from Set Adv Param
|
||||
* will be always valid.
|
||||
*/
|
||||
if ((hdev->adv_tx_power != HCI_TX_POWER_INVALID) ||
|
||||
ext_adv_capable(hdev))
|
||||
flags |= MGMT_ADV_FLAG_TX_POWER;
|
||||
|
||||
return flags;
|
||||
|
Reference in New Issue
Block a user