Bluetooth: Fix location of TX power field in LE advertising data
Subsystems (2)
Marcel Holtmann
maintainerPATCH 1/1 Bluetooth: Fix location of TX power field in LE advertising data
The TX power field in the LE advertising data should be placed last since it needs to be possible to enable kernel controlled TX power, but still allow for userspace provided flags field.
--- net/bluetooth/mgmt.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
net/bluetooth/mgmt.c +8 -6
@@ -1043,6 +1043,14 @@ static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) } } +if (instance) { +memcpy (ptr, hdev->adv_instance.adv_data, + hdev->adv_instance.adv_data_len); + + ad_len += hdev->adv_instance.adv_data_len; + ptr += hdev->adv_instance.adv_data_len; + } +/* Provide Tx Power only if we can provide a valid value for it */ if (hdev->adv_tx_power !=HCI_TX_POWER_INVALID && (instance_flags &MGMT_ADV_FLAG_TX_POWER )) {
@@ -1054,12 +1062,6 @@ static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) ptr +=3 ; } -if (instance) { -memcpy (ptr, hdev->adv_instance.adv_data, - hdev->adv_instance.adv_data_len); - ad_len += hdev->adv_instance.adv_data_len; - } -return ad_len; }
Signature · 1 line
2.1.0
Hi Marcel,
Quoted 45 lines · Marcel Holtmann
The TX power field in the LE advertising data should be placed last since it needs to be possible to enable kernel controlled TX power, but still allow for userspace provided flags field.
Signed-off-by Marcel Holtmann <[email protected]>--- net/bluetooth/mgmt.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)net/bluetooth/mgmt.c +8
-7@@ -1043,6 +1043,14 @@ static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) } } +if (instance) { +memcpy (ptr, hdev->adv_instance.adv_data, + hdev->adv_instance.adv_data_len); + + ad_len += hdev->adv_instance.adv_data_len; + ptr += hdev->adv_instance.adv_data_len; + } +/* Provide Tx Power only if we can provide a valid value for it */ if (hdev->adv_tx_power !=HCI_TX_POWER_INVALID && (instance_flags &MGMT_ADV_FLAG_TX_POWER )) {@@ -1054,12 +1062,6 @@ static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) ptr +=3 ; } -if (instance) { -memcpy (ptr, hdev->adv_instance.adv_data, - hdev->adv_instance.adv_data_len); - ad_len += hdev->adv_instance.adv_data_len; - } -return ad_len; } --2.1.0
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
This looks good. Johan, I reviewed this patch and it should be good to go. Please apply when you get a chance.
Thanks,
Arman
Johan Hedberg
AppliedHi Marcel,
Quoted 8 lines · Marcel Holtmann
The TX power field in the LE advertising data should be placed last since it needs to be possible to enable kernel controlled TX power, but still allow for userspace provided flags field.
Signed-off-by Marcel Holtmann <[email protected]>--- net/bluetooth/mgmt.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
Applied to bluetooth-next. Thanks.
Johan