* [PATCH] Bluetooth: Fix flags of mgmt_device_found event
@ 2012-06-01 19:05 Jefferson Delfes
2012-06-01 23:13 ` Gustavo Padovan
2012-06-11 13:18 ` Jefferson Delfes
0 siblings, 2 replies; 7+ messages in thread
From: Jefferson Delfes @ 2012-06-01 19:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jefferson Delfes
Change flags field to matches userspace structure.
This field needs to be converted to little endian before forward it.
Signed-off-by: Jefferson Delfes <jefferson.delfes@openbossa.org>
---
include/net/bluetooth/mgmt.h | 2 +-
net/bluetooth/mgmt.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index ebfd91f..3a8a714 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -435,7 +435,7 @@ struct mgmt_ev_auth_failed {
struct mgmt_ev_device_found {
struct mgmt_addr_info addr;
__s8 rssi;
- __u8 flags[4];
+ __le32 flags;
__le16 eir_len;
__u8 eir[0];
} __packed;
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 4bb03b1..3c90a23 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3458,9 +3458,9 @@ int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
ev->addr.type = link_to_mgmt(link_type, addr_type);
ev->rssi = rssi;
if (cfm_name)
- ev->flags[0] |= MGMT_DEV_FOUND_CONFIRM_NAME;
+ ev->flags |= MGMT_DEV_FOUND_CONFIRM_NAME;
if (!ssp)
- ev->flags[0] |= MGMT_DEV_FOUND_LEGACY_PAIRING;
+ ev->flags |= MGMT_DEV_FOUND_LEGACY_PAIRING;
if (eir_len > 0)
memcpy(ev->eir, eir, eir_len);
@@ -3469,6 +3469,7 @@ int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
eir_len = eir_append_data(ev->eir, eir_len, EIR_CLASS_OF_DEV,
dev_class, 3);
+ ev->flags = cpu_to_le32(ev->flags);
put_unaligned_le16(eir_len, &ev->eir_len);
ev_size = sizeof(*ev) + eir_len;
--
1.7.10.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] Bluetooth: Fix flags of mgmt_device_found event
2012-06-01 19:05 [PATCH] Bluetooth: Fix flags of mgmt_device_found event Jefferson Delfes
@ 2012-06-01 23:13 ` Gustavo Padovan
2012-06-02 1:15 ` Johan Hedberg
2012-06-04 13:31 ` Jefferson Delfes
2012-06-11 13:18 ` Jefferson Delfes
1 sibling, 2 replies; 7+ messages in thread
From: Gustavo Padovan @ 2012-06-01 23:13 UTC (permalink / raw)
To: Jefferson Delfes; +Cc: linux-bluetooth, marcel, johan.hedberg
Jefferson,
* Jefferson Delfes <jefferson.delfes@openbossa.org> [2012-06-01 15:05:25 -0400]:
> Change flags field to matches userspace structure.
> This field needs to be converted to little endian before forward it.
>
> Signed-off-by: Jefferson Delfes <jefferson.delfes@openbossa.org>
> ---
> include/net/bluetooth/mgmt.h | 2 +-
> net/bluetooth/mgmt.c | 5 +++--
> 2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
> index ebfd91f..3a8a714 100644
> --- a/include/net/bluetooth/mgmt.h
> +++ b/include/net/bluetooth/mgmt.h
> @@ -435,7 +435,7 @@ struct mgmt_ev_auth_failed {
> struct mgmt_ev_device_found {
> struct mgmt_addr_info addr;
> __s8 rssi;
> - __u8 flags[4];
> + __le32 flags;
Seems we are breaking API here, MGMT API is stable now and should have such
kind of change. However I wanna see what Marcel and Johan has to say about
this.
Gustavo
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] Bluetooth: Fix flags of mgmt_device_found event
2012-06-01 23:13 ` Gustavo Padovan
@ 2012-06-02 1:15 ` Johan Hedberg
2012-06-04 13:31 ` Jefferson Delfes
1 sibling, 0 replies; 7+ messages in thread
From: Johan Hedberg @ 2012-06-02 1:15 UTC (permalink / raw)
To: Gustavo Padovan, Jefferson Delfes, linux-bluetooth, marcel
Hi Gustavo,
On Fri, Jun 01, 2012, Gustavo Padovan wrote:
> * Jefferson Delfes <jefferson.delfes@openbossa.org> [2012-06-01 15:05:25 -0400]:
>
> > Change flags field to matches userspace structure.
> > This field needs to be converted to little endian before forward it.
> >
> > Signed-off-by: Jefferson Delfes <jefferson.delfes@openbossa.org>
> > ---
> > include/net/bluetooth/mgmt.h | 2 +-
> > net/bluetooth/mgmt.c | 5 +++--
> > 2 files changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
> > index ebfd91f..3a8a714 100644
> > --- a/include/net/bluetooth/mgmt.h
> > +++ b/include/net/bluetooth/mgmt.h
> > @@ -435,7 +435,7 @@ struct mgmt_ev_auth_failed {
> > struct mgmt_ev_device_found {
> > struct mgmt_addr_info addr;
> > __s8 rssi;
> > - __u8 flags[4];
> > + __le32 flags;
>
> Seems we are breaking API here, MGMT API is stable now and should have such
> kind of change. However I wanna see what Marcel and Johan has to say about
> this.
I don't see how this is breaking anything. The exact same bytes in the
same order would be transmitted through the mgmt socket. Or am I missing
something?
Johan
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] Bluetooth: Fix flags of mgmt_device_found event
2012-06-01 23:13 ` Gustavo Padovan
2012-06-02 1:15 ` Johan Hedberg
@ 2012-06-04 13:31 ` Jefferson Delfes
2012-06-08 4:22 ` Gustavo Padovan
1 sibling, 1 reply; 7+ messages in thread
From: Jefferson Delfes @ 2012-06-04 13:31 UTC (permalink / raw)
To: Gustavo Padovan, Jefferson Delfes, linux-bluetooth, marcel,
johan.hedberg
Hi Gustavo,
On Fri, Jun 1, 2012 at 7:13 PM, Gustavo Padovan <gustavo@padovan.org> wrote=
:
> Jefferson,
>
> * Jefferson Delfes <jefferson.delfes@openbossa.org> [2012-06-01 15:05:25 =
-0400]:
>
>> Change flags field to matches userspace structure.
>> This field needs to be converted to little endian before forward it.
>>
>> Signed-off-by: Jefferson Delfes <jefferson.delfes@openbossa.org>
>> ---
>> =A0include/net/bluetooth/mgmt.h | =A0 =A02 +-
>> =A0net/bluetooth/mgmt.c =A0 =A0 =A0 =A0 | =A0 =A05 +++--
>> =A02 files changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
>> index ebfd91f..3a8a714 100644
>> --- a/include/net/bluetooth/mgmt.h
>> +++ b/include/net/bluetooth/mgmt.h
>> @@ -435,7 +435,7 @@ struct mgmt_ev_auth_failed {
>> =A0struct mgmt_ev_device_found {
>> =A0 =A0 =A0 struct mgmt_addr_info addr;
>> =A0 =A0 =A0 __s8 =A0 =A0rssi;
>> - =A0 =A0 __u8 =A0 =A0flags[4];
>> + =A0 =A0 __le32 =A0flags;
>
> Seems we are breaking API here, MGMT API is stable now and should have su=
ch
> kind of change. However I wanna see what Marcel and Johan has to say abou=
t
> this.
>
> =A0 =A0 =A0 =A0Gustavo
As Johan pointed, we send the same bytes in same order. This patch
just copy userspace changes in mgmt_ev_device_found structure. There
was a possible bug on big endian in userspace, but it was fixed in
previous patch.
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] Bluetooth: Fix flags of mgmt_device_found event
2012-06-04 13:31 ` Jefferson Delfes
@ 2012-06-08 4:22 ` Gustavo Padovan
0 siblings, 0 replies; 7+ messages in thread
From: Gustavo Padovan @ 2012-06-08 4:22 UTC (permalink / raw)
To: Jefferson Delfes; +Cc: linux-bluetooth, marcel, johan.hedberg
Hi Jefferson,
* Jefferson Delfes <jefferson.delfes@openbossa.org> [2012-06-04 09:31:13 -0=
400]:
> Hi Gustavo,
>=20
> On Fri, Jun 1, 2012 at 7:13 PM, Gustavo Padovan <gustavo@padovan.org> wro=
te:
> > Jefferson,
> >
> > * Jefferson Delfes <jefferson.delfes@openbossa.org> [2012-06-01 15:05:2=
5 -0400]:
> >
> >> Change flags field to matches userspace structure.
> >> This field needs to be converted to little endian before forward it.
> >>
> >> Signed-off-by: Jefferson Delfes <jefferson.delfes@openbossa.org>
> >> ---
> >> =A0include/net/bluetooth/mgmt.h | =A0 =A02 +-
> >> =A0net/bluetooth/mgmt.c =A0 =A0 =A0 =A0 | =A0 =A05 +++--
> >> =A02 files changed, 4 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt=
=2Eh
> >> index ebfd91f..3a8a714 100644
> >> --- a/include/net/bluetooth/mgmt.h
> >> +++ b/include/net/bluetooth/mgmt.h
> >> @@ -435,7 +435,7 @@ struct mgmt_ev_auth_failed {
> >> =A0struct mgmt_ev_device_found {
> >> =A0 =A0 =A0 struct mgmt_addr_info addr;
> >> =A0 =A0 =A0 __s8 =A0 =A0rssi;
> >> - =A0 =A0 __u8 =A0 =A0flags[4];
> >> + =A0 =A0 __le32 =A0flags;
> >
> > Seems we are breaking API here, MGMT API is stable now and should have =
such
> > kind of change. However I wanna see what Marcel and Johan has to say ab=
out
> > this.
> >
> > =A0 =A0 =A0 =A0Gustavo
>=20
> As Johan pointed, we send the same bytes in same order. This patch
> just copy userspace changes in mgmt_ev_device_found structure. There
> was a possible bug on big endian in userspace, but it was fixed in
> previous patch.
Yes, this patch don't change the order of bytes, I tried to apply it but it
failed. Please rebase on bluetooth-next and resend it.
Gustavo
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] Bluetooth: Fix flags of mgmt_device_found event
2012-06-01 19:05 [PATCH] Bluetooth: Fix flags of mgmt_device_found event Jefferson Delfes
2012-06-01 23:13 ` Gustavo Padovan
@ 2012-06-11 13:18 ` Jefferson Delfes
2012-06-13 2:24 ` Gustavo Padovan
1 sibling, 1 reply; 7+ messages in thread
From: Jefferson Delfes @ 2012-06-11 13:18 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jefferson Delfes
Change flags field to matches userspace structure.
This field needs to be converted to little endian before forward it.
Signed-off-by: Jefferson Delfes <jefferson.delfes@openbossa.org>
---
include/net/bluetooth/mgmt.h | 2 +-
net/bluetooth/mgmt.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 23fd054..4348ee8 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -444,7 +444,7 @@ struct mgmt_ev_auth_failed {
struct mgmt_ev_device_found {
struct mgmt_addr_info addr;
__s8 rssi;
- __u8 flags[4];
+ __le32 flags;
__le16 eir_len;
__u8 eir[0];
} __packed;
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 958f764..34cf841 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3528,9 +3528,9 @@ int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
ev->addr.type = link_to_bdaddr(link_type, addr_type);
ev->rssi = rssi;
if (cfm_name)
- ev->flags[0] |= MGMT_DEV_FOUND_CONFIRM_NAME;
+ ev->flags |= MGMT_DEV_FOUND_CONFIRM_NAME;
if (!ssp)
- ev->flags[0] |= MGMT_DEV_FOUND_LEGACY_PAIRING;
+ ev->flags |= MGMT_DEV_FOUND_LEGACY_PAIRING;
if (eir_len > 0)
memcpy(ev->eir, eir, eir_len);
@@ -3540,6 +3540,7 @@ int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
dev_class, 3);
ev->eir_len = cpu_to_le16(eir_len);
+ ev->flags = cpu_to_le32(ev->flags);
ev_size = sizeof(*ev) + eir_len;
--
1.7.10.3
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] Bluetooth: Fix flags of mgmt_device_found event
2012-06-11 13:18 ` Jefferson Delfes
@ 2012-06-13 2:24 ` Gustavo Padovan
0 siblings, 0 replies; 7+ messages in thread
From: Gustavo Padovan @ 2012-06-13 2:24 UTC (permalink / raw)
To: Jefferson Delfes; +Cc: linux-bluetooth
Hi Jefferson,
* Jefferson Delfes <jefferson.delfes@openbossa.org> [2012-06-11 09:18:51 -0400]:
> Change flags field to matches userspace structure.
> This field needs to be converted to little endian before forward it.
>
> Signed-off-by: Jefferson Delfes <jefferson.delfes@openbossa.org>
> ---
> include/net/bluetooth/mgmt.h | 2 +-
> net/bluetooth/mgmt.c | 5 +++--
> 2 files changed, 4 insertions(+), 3 deletions(-)
Patch has been applied to bluetooth-next.git. Thanks
Gustavo
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-06-13 2:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-01 19:05 [PATCH] Bluetooth: Fix flags of mgmt_device_found event Jefferson Delfes
2012-06-01 23:13 ` Gustavo Padovan
2012-06-02 1:15 ` Johan Hedberg
2012-06-04 13:31 ` Jefferson Delfes
2012-06-08 4:22 ` Gustavo Padovan
2012-06-11 13:18 ` Jefferson Delfes
2012-06-13 2:24 ` Gustavo Padovan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).