2007-04-30 06:34:58

by Benjamin Fong

[permalink] [raw]
Subject: [Bluez-devel] finding the least busy hci device

Hi,

I'm trying to write an OBEX application which will be deployed in an
environment with multiple attached Bluetooth USB dongles. Since each
bluetooth dongle can support only 7 ACL active connection simultaneously,
can anyone please suggest a method to efficiently perform load balancing on
all the available bluetooth dongles? Is there a function which I can use to
seek out the least busy/connected hci device? Thanks

Regards,
Ben


Attachments:
(No filename) (436.00 B)
(No filename) (519.00 B)
(No filename) (286.00 B)
(No filename) (164.00 B)
Download all attachments

2007-05-04 04:58:33

by Benjamin Fong

[permalink] [raw]
Subject: Re: [Bluez-devel] finding the least busy hci device

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 <[email protected]> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>


Attachments:
(No filename) (2.29 kB)
(No filename) (3.23 kB)
(No filename) (286.00 B)
(No filename) (164.00 B)
Download all attachments

2007-05-03 12:30:26

by Manuel Naranjo

[permalink] [raw]
Subject: Re: [Bluez-devel] finding the least busy hci device

Williams, Richard escribi=F3:
> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2007-05-03 12:27:33

by Williams, Richard

[permalink] [raw]
Subject: Re: [Bluez-devel] finding the least busy hci device

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()".


Rich



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Manuel
Naranjo
Sent: Thursday, May 03, 2007 8:19 AM
To: BlueZ development
Subject: Re: [Bluez-devel] finding the least busy hci device

Hi Benjamin,
Please let me know how you solved this, I had patched obexftp in order
to use more than one bluetooth dongle at the same time, but didn't do
the load balance stuff, if you can get this done, please give me some
code snippets and I send the ObexFTP crew another patch with this stuff.
Thanks,
Manuel
> Hi Vikas,
>
> I think your solution is far more elegant than mine. I'd tried to
> obtain the amount of connected device to the dongle via cl->conn_num,

> and try to gauge from there if the dongle is busy. Thanks mate
>
> Regards,
> Ben
>
>
>
> I was trying it few months ago. What I was doing was not very much
> effective but workable.
> There is status for every connection ... "ci->state". If its state
> is BT_CONNECTED means its connected and u can't connect it with
> other once. With these state u can have a watch on dongles and if
> any Dongle get free u can use it.
>
> u can find these function under hci.c and hci_lib.h. use them ...
> if get soem better way then please let me know..
>
> Hi,
>
> I'm trying to write an OBEX application which will be deployed
> in an environment with multiple attached Bluetooth USB
> dongles. Since each bluetooth dongle can support only 7 ACL
> active connection simultaneously, can anyone please suggest a
> method to efficiently perform load balancing on all the
> available bluetooth dongles? Is there a function which I can
> use to seek out the least busy/connected hci device? Thanks
>
> Regards,
> Ben
>
>
>
>
> --
> Impossible
> itself contain
> I M Possible
>
> Hi Ben,


------------------------------------------------------------------------
-
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2007-05-03 12:19:28

by Manuel Naranjo

[permalink] [raw]
Subject: Re: [Bluez-devel] finding the least busy hci device

Hi Benjamin,
Please let me know how you solved this, I had patched obexftp in order
to use more than one bluetooth dongle at the same time, but didn't do
the load balance stuff, if you can get this done, please give me some
code snippets and I send the ObexFTP crew another patch with this stuff.
Thanks,
Manuel
> Hi Vikas,
>
> I think your solution is far more elegant than mine. I'd tried to
> obtain the amount of connected device to the dongle via cl->conn_num,
> and try to gauge from there if the dongle is busy. Thanks mate
>
> Regards,
> Ben
>
>
>
> I was trying it few months ago. What I was doing was not very much
> effective but workable.
> There is status for every connection ... "ci->state". If its state
> is BT_CONNECTED means its connected and u can't connect it with
> other once. With these state u can have a watch on dongles and if
> any Dongle get free u can use it.
>
> u can find these function under hci.c and hci_lib.h. use them ...
> if get soem better way then please let me know..
>
> Hi,
>
> I'm trying to write an OBEX application which will be deployed
> in an environment with multiple attached Bluetooth USB
> dongles. Since each bluetooth dongle can support only 7 ACL
> active connection simultaneously, can anyone please suggest a
> method to efficiently perform load balancing on all the
> available bluetooth dongles? Is there a function which I can
> use to seek out the least busy/connected hci device? Thanks
>
> Regards,
> Ben
>
>
>
>
> --
> Impossible
> itself contain
> I M Possible
>
> Hi Ben,


-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2007-05-03 06:05:42

by Benjamin Fong

[permalink] [raw]
Subject: Re: [Bluez-devel] finding the least busy hci device

Hi Vikas,

I think your solution is far more elegant than mine. I'd tried to obtain the
amount of connected device to the dongle via cl->conn_num, and try to gauge
from there if the dongle is busy. Thanks mate

Regards,
Ben


On 5/2/07, Vikas Sinha <[email protected]> wrote:
>
> Hi Ben,
> I was trying it few months ago. What I was doing was not very much
> effective but workable.
> There is status for every connection ... "ci->state". If its state is
> BT_CONNECTED means its connected and u can't connect it with other once.
> With these state u can have a watch on dongles and if any Dongle get free u
> can use it.
>
> u can find these function under hci.c and hci_lib.h. use them ... if get
> soem better way then please let me know..
>
> On 4/30/07, Benjamin Fong < [email protected]> wrote:
>
> > Hi,
> >
> > I'm trying to write an OBEX application which will be deployed in an
> > environment with multiple attached Bluetooth USB dongles. Since each
> > bluetooth dongle can support only 7 ACL active connection simultaneously,
> > can anyone please suggest a method to efficiently perform load balancing on
> > all the available bluetooth dongles? Is there a function which I can use to
> > seek out the least busy/connected hci device? Thanks
> >
> > Regards,
> > Ben
> >
> >
> > -------------------------------------------------------------------------
> > 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
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/bluez-devel
> >
> >
>
>
> --
> Impossible
> itself contain
> I M Possible
>
> Vikas
> -------------------------------------------------------------------------
> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>
>


Attachments:
(No filename) (2.28 kB)
(No filename) (3.94 kB)
(No filename) (286.00 B)
(No filename) (164.00 B)
Download all attachments

2007-05-02 05:38:29

by Vikas Sinha

[permalink] [raw]
Subject: Re: [Bluez-devel] finding the least busy hci device

Hi Ben,
I was trying it few months ago. What I was doing was not very much effective
but workable.
There is status for every connection ... "ci->state". If its state is
BT_CONNECTED means its connected and u can't connect it with other once.
With these state u can have a watch on dongles and if any Dongle get free u
can use it.

u can find these function under hci.c and hci_lib.h. use them ... if get
soem better way then please let me know..

On 4/30/07, Benjamin Fong <[email protected]> wrote:
>
> Hi,
>
> I'm trying to write an OBEX application which will be deployed in an
> environment with multiple attached Bluetooth USB dongles. Since each
> bluetooth dongle can support only 7 ACL active connection simultaneously,
> can anyone please suggest a method to efficiently perform load balancing on
> all the available bluetooth dongles? Is there a function which I can use to
> seek out the least busy/connected hci device? Thanks
>
> Regards,
> Ben
>
> -------------------------------------------------------------------------
> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>
>


--
Impossible
itself contain
I M Possible

Vikas


Attachments:
(No filename) (1.46 kB)
(No filename) (2.24 kB)
(No filename) (286.00 B)
(No filename) (164.00 B)
Download all attachments