public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Cris <ml133@netpole.com.br>
To: bluez-users@lists.sourceforge.net
Subject: Re: [Bluez-users] problem in making multiple connections using single bluetooth adapter using bluez
Date: Tue, 2 Jan 2007 09:44:14 -0200	[thread overview]
Message-ID: <20070102094414.f7b9cef1.ml133@netpole.com.br> (raw)
In-Reply-To: <57c68ddc0701020229w6ddfaab3yf989a8e3999cbd1@mail.gmail.com>

On Tue, 2 Jan 2007 15:59:19 +0530
"siddhant tewari" <siddhant.tewari@gmail.com> wrote:

> hi cris,
>            I tried similar thing using OBEX push client and the thing that
> happened is exactly what u apprehended ...
>     ->  One thread waited for the other to get completed .... sad blues
> behavior.....this is exactly what is creating trouble in my application ...

Obviously, BlueZ didn't learn to deal with more than one connection at
the same time yet. They are still thinking that everybody has a
desktop computer with KDE (or Windows, as dbus being a derivate from
gtk, is specially designed to be platform independent) and just a
single cellphone or PDA at home. Of course, large companies like Nokia
are not really affected by these problems, as a cellphone is so small
that it can't deal with much more than one thing at the same time
anyway. But this may change in some future.

So your only choice is to not use libbluetooth. Marcel is right when
he says that this implies a lot of work, as you will have to implement
each protocol layer yourself. But as these are quite badly designed in
BlueZ, there is really no fix for it. If the BlueZ developers had a
different way of dealing with users (just look at their answers) the
many thousands of hours of work we are doing each one on his own could
go into this project. So, we are alone here. Your choices like mine or
anybody else's who is trying to serious work with bluetooth, is either
to give up or to do the work.

But be aware, that re-writing the protocol stack may not be
enough. I've done so and am having bad troubles because BlueZ
developers think that an exclusive usage over a socket can be
implemented by the concept of a raw socket. This is not true. Even
using raw sockets the kernel will interfere in your programming,
meaning that it is quite possible that we will have to replace also
the kernel modules, which would make 100% of BlueZ code unusable. Not
regulating mutually interfering accesses to one and the same ressource
is pure Windows philosophy, where each program, starting with
kernel.dll thinks it owns the complete device. Raw sockets allow to do
low leve things, but they don't guarantee that someone else wont undo
what ever my program has done a second earlier. Even if this someone
else is the kernel herself.

I've suggested the use of an exclusive flag with the HCI sockets, when
Marcel answered, that the kernel does NOT interfere when I open that
socket in raw. This is just not true. Marcel (who should know as he
wrote this monster) asked what exactly happens. Here it is:

If your program is already active and you plug in an USB bluetooth
dongle, the kernel issues several informational queries to the
device. It needs to do so, as a raw socket doesn't imply that there
couldn't be more than one processes accessing the same device (there
is no exclusivity), while a second process might want to use a cooked
socket. In my case, I know that there will be no other process,
specially not hcid or dbus, but the kernel doesn't, and still issues
these commands. Thus, I need to expect anything to happen, just for
the USB dongle having been plugged in. This raises the level of
complexity of my program by a power of magnitud. Also, Marcel himself
said, that whenever a major version number is increased, we can not
trust that the behaviour wont change incompatibly with the previous
version (besides the use of dbus and apparently the inability to
multitask). Did anybody see any reasoning why dbus is defended so
stiff neckedly? Or why nobody cares to work on a design which actually
matches what bluetooth specifications persue?

Much worse is what happens if you create a connection. Until you get
the connection complete event, everything is fine. But then, the
kernel will issue several commands, ignoring any commands of yours
until it's done. Among those is HCI_Write_Link_Policy_Settings. At
this point it seems to be impossible to achieve for instance a role
switch. Also, the kernel has no way to know what my program is trying
to do, and thus can not know which is the link policy I need.

You see, everybody doing things like you and me (and I've seen more
than just a few more out there) is just out of luck. The best would be
somebody starting to fork the full development of Bluetooth support in
Linux, but this time with a well thought design based on a thorough
understanding of bluetooth and it's protocols.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

  reply	other threads:[~2007-01-02 11:44 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-02  7:54 [Bluez-users] problem in making multiple connections using single bluetooth adapter using bluez siddhant tewari
2007-01-02  8:09 ` Marcel Holtmann
2007-01-02  8:16   ` siddhant tewari
2007-01-02  8:28     ` Marcel Holtmann
2007-01-02  9:12       ` siddhant tewari
2007-01-02 10:18     ` Cris
2007-01-02 10:29       ` siddhant tewari
2007-01-02 11:44         ` Cris [this message]
2007-01-02 12:46           ` siddhant tewari
2007-01-02 13:04             ` Marcel Holtmann
2007-01-02 13:39               ` Paul Gardiner
2007-01-02 13:50                 ` Marcel Holtmann
2007-01-02 21:03                   ` Paul Gardiner
2007-01-02 21:18                     ` Marcel Holtmann
2007-01-02 23:39                       ` Paul Gardiner
2007-01-03  4:00                         ` Tianlei Zhao
2007-01-03  7:18                           ` Marcel Holtmann
2007-01-03 11:33                       ` [Bluez-users] Problems fooling my S100 into using Bluez as a modem Paul Gardiner
2007-01-03 11:37                         ` Paul Gardiner
2007-01-03 11:39                         ` Paul Gardiner
2007-01-03 11:42                         ` Paul Gardiner
2007-01-10 18:24                         ` Paul Gardiner
2007-01-02 13:20             ` [Bluez-users] problem in making multiple connections using single bluetooth adapter using bluez Cris
2007-01-02 13:17           ` Marcel Holtmann

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=20070102094414.f7b9cef1.ml133@netpole.com.br \
    --to=ml133@netpole.com.br \
    --cc=bluez-users@lists.sourceforge.net \
    /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