2008-12-11 03:57:58

by Bea Lam

[permalink] [raw]
Subject: Adapter API - Devices property not updated if connection initiated by remote device

When using the org.bluez.Adapter interface, if I initiate a connection to a
remote device, then the adapter's Devices property is updated to include the
remote device, as expected. However, if the remote device initiates the
connection to my device instead, it isn't added to the Devices list. This
would appear to be a bug.

This can be problematic if I am trying to identify whether any remote devices
are currently connected to the local adapter; it is not possible to identify
the connected devices if they have initiated the connection.

It would be much appreciated if someone could look into this. Perhaps the
adapter->devices list could be updated when adapter_add_active_conn() is
called, but I'm not sure if this is correct.


2008-12-13 01:02:46

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: Adapter API - Devices property not updated if connection initiated by remote device

Hi

On Fri, Dec 12, 2008 at 10:28 AM, Johan Hedberg <[email protected]> wrote:
> There definitely needs to be a way to know that a remote device has
> connected to us even if it is not paired. I think we should just
> populate the Devices list in this case and then remove the device from
> it once it disconnects (if it didn't pair before that) and also send all
> appropriate signals while doing this. For knowing if the device is
> paired or not we already have the separate Paired property.

We could create the device object, but we should be careful to not
start a service discovery and end up with this device on the storage.
Note that this can be a security problem, since normally connections
should at least trigger authorization which requires the object
anyway, so someone is not really asking to the agent to authorize a
incoming connection.


--
Luiz Augusto von Dentz
Engenheiro de Computa??o

2008-12-12 13:28:50

by Johan Hedberg

[permalink] [raw]
Subject: Re: Adapter API - Devices property not updated if connection initiated by remote device

Hi,

On Fri, Dec 12, 2008, Marcel Holtmann wrote:
> I think we do create a temporary device structure for incoming
> connections in all cases since that is needed for pairing. However we
> might not add this to the Devices list.
>
> Johan, any comments here. Should we just send out signals? I think the
> current reason for not doing so is that in most cases this is during a
> pairing event and we do wanna wait until it succeeds. However I don't
> see the big harm in adding it to the list.

There definitely needs to be a way to know that a remote device has
connected to us even if it is not paired. I think we should just
populate the Devices list in this case and then remove the device from
it once it disconnects (if it didn't pair before that) and also send all
appropriate signals while doing this. For knowing if the device is
paired or not we already have the separate Paired property.

Johna

2008-12-12 10:58:47

by Marcel Holtmann

[permalink] [raw]
Subject: Re: Adapter API - Devices property not updated if connection initiated by remote device

Hi Bea,

can you please stop top-posting. Like every other open source mailing
list we are using bottom-posting and you are just destroying the flow of
the replies with top-posting. And KMail is perfectly capable of doing
so ;)

> Yes, FindDevice() is useful when I need to check whether a particular device
> is connected at the moment. But what if I don't know the address of the
> connecting device? That is, should BlueZ also be able to tell me when some
> random, unknown device connects to me?

I think we do create a temporary device structure for incoming
connections in all cases since that is needed for pairing. However we
might not add this to the Devices list.

Johan, any comments here. Should we just send out signals? I think the
current reason for not doing so is that in most cases this is during a
pairing event and we do wanna wait until it succeeds. However I don't
see the big harm in adding it to the list.

Regards

Marcel



2008-12-12 04:52:37

by Bea Lam

[permalink] [raw]
Subject: Re: Adapter API - Devices property not updated if connection initiated by remote device

Hi Marcel,

Yes, FindDevice() is useful when I need to check whether a particular device
is connected at the moment. But what if I don't know the address of the
connecting device? That is, should BlueZ also be able to tell me when some
random, unknown device connects to me?

thanks

Bea


On Friday 12 December 2008 11:43:17 am Marcel Holtmann wrote:
> Hi Bea,
>
> > When using the org.bluez.Adapter interface, if I initiate a connection to
> > a remote device, then the adapter's Devices property is updated to
> > include the remote device, as expected. However, if the remote device
> > initiates the connection to my device instead, it isn't added to the
> > Devices list. This would appear to be a bug.
> >
> > This can be problematic if I am trying to identify whether any remote
> > devices are currently connected to the local adapter; it is not possible
> > to identify the connected devices if they have initiated the connection.
> >
> > It would be much appreciated if someone could look into this. Perhaps the
> > adapter->devices list could be updated when adapter_add_active_conn() is
> > called, but I'm not sure if this is correct.
>
> I know that Johan fixed a bug where FindDevice would not give any result
> for temporary devices. So you can use FindDevice to get the device
> object. Adding it to the device list? I am not sure about that.
>
> Regards
>
> Marcel

2008-12-12 01:43:17

by Marcel Holtmann

[permalink] [raw]
Subject: Re: Adapter API - Devices property not updated if connection initiated by remote device

Hi Bea,

> When using the org.bluez.Adapter interface, if I initiate a connection to a
> remote device, then the adapter's Devices property is updated to include the
> remote device, as expected. However, if the remote device initiates the
> connection to my device instead, it isn't added to the Devices list. This
> would appear to be a bug.
>
> This can be problematic if I am trying to identify whether any remote devices
> are currently connected to the local adapter; it is not possible to identify
> the connected devices if they have initiated the connection.
>
> It would be much appreciated if someone could look into this. Perhaps the
> adapter->devices list could be updated when adapter_add_active_conn() is
> called, but I'm not sure if this is correct.

I know that Johan fixed a bug where FindDevice would not give any result
for temporary devices. So you can use FindDevice to get the device
object. Adding it to the device list? I am not sure about that.

Regards

Marcel