* [PATCH] Bluetooth: Fix location of TX power field in LE advertising data
@ 2015-04-03 20:23 Marcel Holtmann
2015-04-03 20:56 ` Arman Uguray
2015-04-04 5:52 ` Johan Hedberg
0 siblings, 2 replies; 3+ messages in thread
From: Marcel Holtmann @ 2015-04-03 20:23 UTC (permalink / raw)
To: linux-bluetooth
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 <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 20a7765680df..845dfcc43a20 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Bluetooth: Fix location of TX power field in LE advertising data
2015-04-03 20:23 [PATCH] Bluetooth: Fix location of TX power field in LE advertising data Marcel Holtmann
@ 2015-04-03 20:56 ` Arman Uguray
2015-04-04 5:52 ` Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Arman Uguray @ 2015-04-03 20:56 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: BlueZ development, Johan Hedberg
Hi Marcel,
> On Fri, Apr 3, 2015 at 1:23 PM, Marcel Holtmann <marcel@holtmann.org> wrote:
> 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 <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 20a7765680df..845dfcc43a20 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] Bluetooth: Fix location of TX power field in LE advertising data
2015-04-03 20:23 [PATCH] Bluetooth: Fix location of TX power field in LE advertising data Marcel Holtmann
2015-04-03 20:56 ` Arman Uguray
@ 2015-04-04 5:52 ` Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2015-04-04 5:52 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
Hi Marcel,
On Fri, Apr 03, 2015, Marcel Holtmann wrote:
> 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 <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-04-04 5:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-03 20:23 [PATCH] Bluetooth: Fix location of TX power field in LE advertising data Marcel Holtmann
2015-04-03 20:56 ` Arman Uguray
2015-04-04 5:52 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox