* [PATCH BlueZ] adapter: Fix length calculation of filter UUIDs on big endian
@ 2019-03-06 12:52 Luiz Augusto von Dentz
2019-03-07 8:24 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2019-03-06 12:52 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
The management interface expect all values to be in little endian
thus the length of uuids needs to be converted on big endian.
---
src/adapter.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index b8a6bb6e2..160a6ca52 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1602,10 +1602,12 @@ static gboolean start_discovery_timeout(gpointer user_data)
sd_cp = adapter->current_discovery_filter;
DBG("sending MGMT_OP_START_SERVICE_DISCOVERY %d, %d, %d",
- sd_cp->rssi, sd_cp->type, sd_cp->uuid_count);
+ sd_cp->rssi, sd_cp->type,
+ btohs(sd_cp->uuid_count));
mgmt_send(adapter->mgmt, MGMT_OP_START_SERVICE_DISCOVERY,
- adapter->dev_id, sizeof(*sd_cp) + sd_cp->uuid_count * 16,
+ adapter->dev_id, sizeof(*sd_cp) +
+ btohs(sd_cp->uuid_count) * 16,
sd_cp, start_discovery_complete, adapter, NULL);
return FALSE;
@@ -2076,7 +2078,7 @@ static int discovery_filter_to_mgmt_cp(struct btd_adapter *adapter,
cp->type = discovery_type;
cp->rssi = rssi;
- cp->uuid_count = uuid_count;
+ cp->uuid_count = htobs(uuid_count);
populate_mgmt_filter_uuids(cp->uuids, uuids);
g_slist_free(uuids);
--
2.17.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH BlueZ] adapter: Fix length calculation of filter UUIDs on big endian
2019-03-06 12:52 [PATCH BlueZ] adapter: Fix length calculation of filter UUIDs on big endian Luiz Augusto von Dentz
@ 2019-03-07 8:24 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2019-03-07 8:24 UTC (permalink / raw)
To: linux-bluetooth
Hi,
On Wed, Mar 6, 2019 at 2:52 PM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> The management interface expect all values to be in little endian
> thus the length of uuids needs to be converted on big endian.
> ---
> src/adapter.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/adapter.c b/src/adapter.c
> index b8a6bb6e2..160a6ca52 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -1602,10 +1602,12 @@ static gboolean start_discovery_timeout(gpointer user_data)
> sd_cp = adapter->current_discovery_filter;
>
> DBG("sending MGMT_OP_START_SERVICE_DISCOVERY %d, %d, %d",
> - sd_cp->rssi, sd_cp->type, sd_cp->uuid_count);
> + sd_cp->rssi, sd_cp->type,
> + btohs(sd_cp->uuid_count));
>
> mgmt_send(adapter->mgmt, MGMT_OP_START_SERVICE_DISCOVERY,
> - adapter->dev_id, sizeof(*sd_cp) + sd_cp->uuid_count * 16,
> + adapter->dev_id, sizeof(*sd_cp) +
> + btohs(sd_cp->uuid_count) * 16,
> sd_cp, start_discovery_complete, adapter, NULL);
>
> return FALSE;
> @@ -2076,7 +2078,7 @@ static int discovery_filter_to_mgmt_cp(struct btd_adapter *adapter,
>
> cp->type = discovery_type;
> cp->rssi = rssi;
> - cp->uuid_count = uuid_count;
> + cp->uuid_count = htobs(uuid_count);
> populate_mgmt_filter_uuids(cp->uuids, uuids);
>
> g_slist_free(uuids);
> --
> 2.17.2
>
Applied.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-07 8:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-06 12:52 [PATCH BlueZ] adapter: Fix length calculation of filter UUIDs on big endian Luiz Augusto von Dentz
2019-03-07 8:24 ` Luiz Augusto von Dentz
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).