From: Steven Singer <steven.singer@csr.com>
To: bluez-devel@lists.sourceforge.net
Subject: Re: [Bluez-devel] Re: hcid patch (remote name and connections)
Date: Tue, 11 Oct 2005 22:14:01 +0100 [thread overview]
Message-ID: <434C2B19.5040909@csr.com> (raw)
In-Reply-To: <e1effdeb0510111307r3bf0822aya57f5003efd8f655@mail.gmail.com>
Claudio Takahasi wrote:
> It's from hcitool code :)
:-)
Still, that's no reason to propagate the error. Fix it and port the fix
back to hcitool (and wherever else it's escaped from).
> I will replace by "7", the maximum number of connections. Is it ok?
It wasn't the value I was concerned about. It was the free-floating 10
in the code twice.
A #define should allay my immediate concerns, however, a better solution
would be to avoid the use of hard-coded constant limits. Is there any way
to retrieve the current number of connections?
Strictly, 7 isn't the maximum number of connections - it's the maximum
number of active slaves a master can have. In theory the number of
simultaneous connections a device can have is limited only by the number
of ACL handles (about 4000). In practice, it's limited by the amount of
memory on the device and the need to service all the connections.
If you have more than one HCI dongle then you can have even more
connections.
In practice, 10 is probably sufficient for today, but by making it a
#define with a self-documenting name, it's easy for someone to change it
in the future.
If the kernel has some limit on the maximum number of connections then
use that (and get it from the kernel or a #include, don't copy the number
into your code).
If you can't get the number of connections from the kernel then that
suggests that there's a kernel API missing.
You may be able to work round the missing API depending on the behaviour
of HCIGETCONNLIST when the array size (N) is too small to hold all the
connections (M).
* If it causes a segmentation fault and terminates your program then
you may be in trouble.
* If it copies the first N connections and returns with conn_num
set to N then test for conn_num being set to N on return and
if it is, double N and try again.
* If it copies the first N connections and returns with conn_num
set to M then make two calls: the first with N = 0 and the second
with N = M.
- Steven
--
This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
next prev parent reply other threads:[~2005-10-11 21:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-11 14:26 [Bluez-devel] hcid patch (remote name and connections) Claudio Takahasi
2005-10-11 14:49 ` [Bluez-devel] " Claudio Takahasi
2005-10-11 19:47 ` Steven Singer
2005-10-11 20:07 ` Claudio Takahasi
2005-10-11 21:14 ` Steven Singer [this message]
2005-10-11 22:37 ` Marcel Holtmann
2005-10-11 18:01 ` [Bluez-devel] " Marcel Holtmann
2005-10-11 19:28 ` Johan Hedberg
2005-10-11 19:45 ` Steven Singer
2005-10-11 19:55 ` Johan Hedberg
2005-10-11 22:48 ` Marcel Holtmann
2005-10-12 19:38 ` Johan Hedberg
2005-10-12 21:14 ` Claudio Takahasi
2005-10-13 9:38 ` 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=434C2B19.5040909@csr.com \
--to=steven.singer@csr.com \
--cc=bluez-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.