2012-02-03 23:06:45

by Vinicius Costa Gomes

[permalink] [raw]
Subject: [PATCH BlueZ] device: Fix doing sdp discovery for LE devices

If ReverseServiceDiscovery is enabled and we are connected to a LE
device, we should do a Primary Service Discovery, not a SDP discovery
(which doesn't even make sense).
---

This patch assumes that it makes sense to reuse the ReverseServiceDiscovery
functionality for LE devices.


src/device.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/device.c b/src/device.c
index 46f26d1..c7c741c 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1933,7 +1933,9 @@ int device_browse_primary(struct btd_device *device, DBusConnection *conn,
return -EIO;
}

- req->conn = dbus_connection_ref(conn);
+ if (conn)
+ req->conn = dbus_connection_ref(conn);
+
device->browse = req;

if (msg) {
@@ -2118,7 +2120,10 @@ static gboolean start_discovery(gpointer user_data)
{
struct btd_device *device = user_data;

- device_browse_sdp(device, NULL, NULL, NULL, TRUE);
+ if (device_is_bredr(device))
+ device_browse_sdp(device, NULL, NULL, NULL, FALSE);
+ else
+ device_browse_primary(device, NULL, NULL, FALSE);

device->discov_timer = 0;

--
1.7.8.1



2012-02-04 12:14:05

by Anderson Lizardo

[permalink] [raw]
Subject: Re: [PATCH BlueZ] device: Fix doing sdp discovery for LE devices

Hi Johan/Vinicius,

On Fri, Feb 3, 2012 at 7:17 PM, Johan Hedberg <[email protected]> wrote:
> Hi Vinicius,
>
> On Fri, Feb 03, 2012, Vinicius Costa Gomes wrote:
>> If ReverseServiceDiscovery is enabled and we are connected to a LE
>> device, we should do a Primary Service Discovery, not a SDP discovery
>> (which doesn't even make sense).
>> ---
>>
>> This patch assumes that it makes sense to reuse the ReverseServiceDiscovery
>> functionality for LE devices.
>>
>>
>> ?src/device.c | ? ?9 +++++++--
>> ?1 files changed, 7 insertions(+), 2 deletions(-)
>
> Applied. Thanks. (and yes, I do think it should be fine to "reverse
> discover" LE services).

I'm fine as well, but due to the current Core spec restrictions, It is
unlikely BlueZ will act as slave/acceptor to this to be triggered on
valid scenarios. Unless we add support for single mode LE adapters, or
by "infringing" current Core spec's restriction and allow LE
connection between dual mode devices for testing purposes.

Best Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

2012-02-03 23:17:12

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH BlueZ] device: Fix doing sdp discovery for LE devices

Hi Vinicius,

On Fri, Feb 03, 2012, Vinicius Costa Gomes wrote:
> If ReverseServiceDiscovery is enabled and we are connected to a LE
> device, we should do a Primary Service Discovery, not a SDP discovery
> (which doesn't even make sense).
> ---
>
> This patch assumes that it makes sense to reuse the ReverseServiceDiscovery
> functionality for LE devices.
>
>
> src/device.c | 9 +++++++--
> 1 files changed, 7 insertions(+), 2 deletions(-)

Applied. Thanks. (and yes, I do think it should be fine to "reverse
discover" LE services).

Johan