2005-02-11 15:17:24

by Flávio

[permalink] [raw]
Subject: [Bluez-devel] dd - device descriptor HELP :)

Hi there!
I have two USB dongles connected to my pc. Using both of them in
MASTER mode, when i do one connection to another bluetooth device (i
was testing with a cell phone) for both dongles (hci1 and hci0) the
device descriptor for both connections is the same!!! Shouldn't they
be different?
And, apparently, because of this, when i try to set up the second
connection (connet my hci1 to the cell phone, when the hci0 is
allready conneted), it fails.
function used: dd = hci_open_dev(dev_id);

thanks in advanced!


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel


2005-02-11 22:17:29

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] dd - device descriptor HELP :)

Hi Flavio,

> I know that "work" with the level HCI is more dificult but the
> information that i need is rssi and transmit power level (tpl) :( in a
> connection! In l2cap that information isn=B4t given right?

when you create a L2CAP connection you can retrieve the ACL handle of
the used underlaying link. So where is the problem?

> I need to create a software that creates a connection between my
> computer (hci0) and a mobile phone (that don=B4t have any software mine=
,
> so isn=B4t listenning for connections l2cap) that only accepts
> connections so i think that l2cap isn=B4t a solution! it=B4s necessary
> that in the mobile phone a program waiting for a connection l2cap (on
> the right psm ) right?

What about PSM 1. The SDP is listening on this PSM.

> So i need to work in HCI!
>=20
> For the people like me :) "role" in hci_creat_connection() :
> role=3D1 ->SLAVE
> role=3D0 -> MASTER

Not quite right. It stands for "allow role switch". This is a different
meaning.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-02-11 21:58:27

by Flávio

[permalink] [raw]
Subject: Re: [Bluez-devel] dd - device descriptor HELP :)

Hi Marcel,

I know that "work" with the level HCI is more dificult but the
information that i need is rssi and transmit power level (tpl) :( in a
connection! In l2cap that information isn=B4t given right?

I need to create a software that creates a connection between my
computer (hci0) and a mobile phone (that don=B4t have any software mine,
so isn=B4t listenning for connections l2cap) that only accepts
connections so i think that l2cap isn=B4t a solution! it=B4s necessary
that in the mobile phone a program waiting for a connection l2cap (on
the right psm ) right?

So i need to work in HCI!

For the people like me :) "role" in hci_creat_connection() :
role=3D1 ->SLAVE
role=3D0 -> MASTER
:P


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-02-11 20:54:14

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] dd - device descriptor HELP :)

Hi Flavio,

> Ok, this is the important part of my program:
> i give 2 arguments in the line command (example: program hci0 bdaddr)
> ***********************************************************************=
*********************************
> int ptype =3D HCI_DM1 | HCI_DM3 | HCI_DM5 | HCI_DH1 | HCI_DH3 |
> HCI_DH5; protocol
> uint8_t role=3D 0x01;
>=20
> str2ba(argv[2], &bdaddr);
> dev_id =3D atoi ( argv[1] + 3 ); // hciX (X=3Ddev_id)
> printf("dev_id=3D%i\n",dev_id);
> dd =3D hci_open_dev(dev_id); // device descriptor (dd)
> if (dd < 0) {
> perror("HCI device open failed");
> exit(1);
> }
> printf("dd=3D%i\n",dd);
> if (hci_create_connection(dd, &bdaddr, htobs(ptype),0, role, &handle,
> 25000) < 0)
> perror("");
> ***********************************************************************=
*********************************
>=20
> I have 2 dongles in my computer (hci0 and hci1) when i try to connect
> with the 2 at the "same time" to a third bluetooth test (isn=B4t in my
> computer), give me an error of connection!
> I tryied debugging and think that the problem is because the device
> discriptor that hci_open_device returns is the same even the dev_id is
> diferente!
> In my test the dev_id was 0 and 1, and the function in cause return
> the same device descriptor!
> The device descriptor shouldn=B4t be different(for different dev_id)?

this is fine, because it is a socket descriptor. For the reason you may
look at a Unix handbook.


> Note that when i connect with only one (example hci0), the program
> works well,the problem is when i try the second connection(example
> hci1). Both (hci0 and hci1)is in master mode!
> Why isn=B4t work?

And this means that your third device must create a scatternet (slave in
two different piconets). Check the error codes with hcidump.

> One more thing, in the hci_create_connection the "role" argument is
> oX01, what is purpuse and the values that sould have?

Come on. Look it up in the Bluetooth specification.

> The last argument of hci_create_connection is diferent depending of
> the situations how can i know the values that sould be used, what is
> purpuse?

Do you mean the timeout parameter? It is what it says.

> I hope that this time i was more specific!=20

And here is my advice. Don't create HCI connections by yourself. It is
possible to do it, but for what do you wanna use them? The kernel L2CAP
and RFCOMM socket create all underlaying links and you don't have to
worry about things like clock offsets and connection handles.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-02-11 20:10:15

by Flávio

[permalink] [raw]
Subject: Re: [Bluez-devel] dd - device descriptor HELP :)

Hi Marcel, sorry if i wasn=B4t specific!
Ok, this is the important part of my program:
i give 2 arguments in the line command (example: program hci0 bdaddr)
***************************************************************************=
*****************************
int ptype =3D HCI_DM1 | HCI_DM3 | HCI_DM5 | HCI_DH1 | HCI_DH3 |
HCI_DH5; protocol
uint8_t role=3D 0x01;

=09str2ba(argv[2], &bdaddr);
=09dev_id =3D atoi ( argv[1] + 3 ); // hciX (X=3Ddev_id)
=09printf("dev_id=3D%i\n",dev_id);
=09dd =3D hci_open_dev(dev_id); // device descriptor (dd)
=09if (dd < 0) {
=09=09perror("HCI device open failed");
=09=09exit(1);
=09}
=09printf("dd=3D%i\n",dd);
=09if (hci_create_connection(dd, &bdaddr, htobs(ptype),0, role, &handle,
25000) < 0)
=09=09perror("");
***************************************************************************=
*****************************

I have 2 dongles in my computer (hci0 and hci1) when i try to connect
with the 2 at the "same time" to a third bluetooth test (isn=B4t in my
computer), give me an error of connection!
I tryied debugging and think that the problem is because the device
discriptor that hci_open_device returns is the same even the dev_id is
diferente!
In my test the dev_id was 0 and 1, and the function in cause return
the same device descriptor!
The device descriptor shouldn=B4t be different(for different dev_id)?
Note that when i connect with only one (example hci0), the program
works well,the problem is when i try the second connection(example
hci1). Both (hci0 and hci1)is in master mode!
Why isn=B4t work?

One more thing, in the hci_create_connection the "role" argument is
oX01, what is purpuse and the values that sould have?

The last argument of hci_create_connection is diferent depending of
the situations how can i know the values that sould be used, what is
purpuse?

I hope that this time i was more specific!=20
Thanks for the time!
Regards Fl=E1vio



On Fri, 11 Feb 2005 20:11:13 +0100, Marcel Holtmann <[email protected]> w=
rote:
> Hi Flavio,
>=20
> > I have two USB dongles connected to my pc. Using both of them in
> > MASTER mode, when i do one connection to another bluetooth device (i
> > was testing with a cell phone) for both dongles (hci1 and hci0) the
> > device descriptor for both connections is the same!!! Shouldn't they
> > be different?
> > And, apparently, because of this, when i try to set up the second
> > connection (connet my hci1 to the cell phone, when the hci0 is
> > allready conneted), it fails.
> > function used: dd =3D hci_open_dev(dev_id);
>=20
> what are you doing? I don't understand what's your problem. Be more
> specific. Show more code or commands.
>=20
> Regards
>=20
> Marcel
>=20
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=3D6595&alloc_id=3D14396&op=3Dclick
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>=20


--=20
Cumprimentos de Fl=E1vio!


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-02-11 19:11:13

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] dd - device descriptor HELP :)

Hi Flavio,

> I have two USB dongles connected to my pc. Using both of them in
> MASTER mode, when i do one connection to another bluetooth device (i
> was testing with a cell phone) for both dongles (hci1 and hci0) the
> device descriptor for both connections is the same!!! Shouldn't they
> be different?
> And, apparently, because of this, when i try to set up the second
> connection (connet my hci1 to the cell phone, when the hci0 is
> allready conneted), it fails.
> function used: dd = hci_open_dev(dev_id);

what are you doing? I don't understand what's your problem. Be more
specific. Show more code or commands.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel