From: "Benjamin Fong" <benjamin.backup@gmail.com>
To: "BlueZ development" <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] finding the least busy hci device
Date: Fri, 4 May 2007 12:58:33 +0800 [thread overview]
Message-ID: <22b6c3510705032158m535caf05n7da9af356700bd7a@mail.gmail.com> (raw)
In-Reply-To: <4639D5E2.3090703@gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 2421 bytes --]
I'm afraid the logic we'd both employed is pretty identical. Instead of
using bash script, I've a method within my obex application which will
iteratively examine each hci device and return the first hci device which
has less than X amount of connected device to it.
static int is_dev_available(int dev_id)
{
struct hci_conn_list_req *cl;
struct hci_conn_info *ci;
if (!(cl = malloc(10 * sizeof(*ci) + sizeof(*cl)))) {
printf("Can't allocate memory");
exit(1);
}
cl->dev_id = dev_id;
cl->conn_num = 10;
ci = cl->conn_info;
if (ioctl(-1, HCIGETCONNLIST, (void *) cl)) {
printf("Can't get connection list");
exit(1);
}
if ( cl->conn_num <= 5 )
{
return 1;
}
return 0;
}
I've set the maximum allowed connection per dongle to 5 because of hardware
limitation, is there any other way which I can inquire the maximum allowed
connection per hci device via codes instead of using a magic number? Thanks
Regards,
Ben
On 5/3/07, Manuel Naranjo <naranjo.manuel@gmail.com> wrote:
>
> Williams, Richard escribió:
> > I think the solution is pretty simple, and is done entirely at the
> > application level. I wrote an app that uses multiple dongles, for HCI
> > commands, SDP and OBEX. I have an array of hci control objects that I
> > "alloc" and "free" just as you would any other shared resource.
> >
> > Whenever I need to do a BT operation, the app goes to the pool of HCI
> > devices and requests one with "hci_alloc()". If one is free, that "hciX"
> > is returned. If none is free, then NULL is returned. When the app is
> > done with the operation, I do an "hci_free()".
> >
> That's what I'm doing so far, I'm doing it all from a bash script, I
> keep the count of hci dongles I have and then open one connection one
> per hci. And I count how many hci connections each hci has.
> But that's not the best for sure.
> Thanks,
> Manuel
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Bluez-devel mailing list
> Bluez-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>
[-- Attachment #1.2: Type: text/html, Size: 3328 bytes --]
[-- Attachment #2: Type: text/plain, Size: 286 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
prev parent reply other threads:[~2007-05-04 4:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-30 6:34 [Bluez-devel] finding the least busy hci device Benjamin Fong
2007-05-02 5:38 ` Vikas Sinha
2007-05-03 6:05 ` Benjamin Fong
2007-05-03 12:19 ` Manuel Naranjo
2007-05-03 12:27 ` Williams, Richard
2007-05-03 12:30 ` Manuel Naranjo
2007-05-04 4:58 ` Benjamin Fong [this message]
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=22b6c3510705032158m535caf05n7da9af356700bd7a@mail.gmail.com \
--to=benjamin.backup@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox