linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Ting Chou <Ting.Chou@iaSolution.net>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: [BLE] org.bluez.Device1.Connect() returns org.bluez.Error.NotAvailable
Date: Wed, 12 Dec 2012 09:52:01 +0200	[thread overview]
Message-ID: <20121212075201.GA14256@x220> (raw)
In-Reply-To: <ADCBF04BB97EBF4AAE65663F8478B61CA99E65AB92@Luna.iaSolution.net>

Hi Ting,

On Wed, Dec 12, 2012, Ting Chou wrote:
> I Found
> -------
> 
> - I checked /var/log/syslog and src/device.c, and found connect_profiles() is
>   called twice at the first time calling org.bluez.Device.Connect():
> 
>   - 1st time
>     dev->svc_resolved==FALSE, device_resolve_svc() is invoked.
> 
>   - 2nd time
>     dev->svc_resolved==TRUE
>     In the for loop of iterating device profiles, there're two profiles:
> 
>       a) p->auto_connect==FALSE, p->name==deviceinfo, p->local_uuid==NULL
>       b) p->auto_connect==FALSE, p->name==Health Thermometer GATT driver, p->local_uuid==NULL
> 
>     Since none of them have auto_connect TRUE, dev->pending==NULL, and
>     btd_error_not_available() is called.
> 
> - I tried org.bluez.Device1.ConnectProfile() as well, but since all the profiles
>   have local_uuid NULL, find_connectable_profile() return NULL and
>   btd_error_invalid_args() is called.

It's not actually local_uuid that is so important but that p->connect is
set. Also, it'd make much more sense to pass the remote UUID to
ConnectProfile than the local one and we'll still do this change before
releasing 5.0. The main thing that needs to be done before that is to
convert profile->remote_uuids list to a single profile->remote_uuid
which is a bit of work since some profiles still declare multiple UUIDs.

So far no LE profile is hooked up to Device.Connect and I'm not sure
exactly how that should be done since LE device are connected through
the general connection establishment procedure which requires scanning
first. Since we already have Device.Pair doing the same as
CreatePairedDevice in BlueZ 4 (and this should work btw, did you try
it?) maybe Device.Connect should be roughly the same for LE devices as
Adapter.CreateDevice is in BlueZ 4? For BR/EDR devices it already serves
this purpose. The main question is what should be done if Device.Connect
is called subsequent times as bluetoothd should anyway already be doing
passive scanning and trying to connect to devices that have supported
profiles.

Johan

  reply	other threads:[~2012-12-12  7:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-12  3:57 [BLE] org.bluez.Device1.Connect() returns org.bluez.Error.NotAvailable Ting Chou
2012-12-12  7:52 ` Johan Hedberg [this message]
2012-12-12  9:10   ` Ting Chou
2012-12-12  9:25     ` Johan Hedberg
2012-12-12  9:47       ` Ting Chou
2012-12-12 10:07         ` Johan Hedberg
2012-12-12 10:21           ` Ting Chou
2012-12-12 10:36             ` Johan Hedberg
2012-12-12 10:58               ` Anderson Lizardo
2012-12-12 10:53             ` Anderson Lizardo
2012-12-12 11:30               ` Ting Chou
2012-12-12 12:20                 ` Anderson Lizardo
2012-12-13  2:33                   ` Ting Chou
2012-12-13  7:48                     ` Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121212075201.GA14256@x220 \
    --to=johan.hedberg@gmail.com \
    --cc=Ting.Chou@iaSolution.net \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).