All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: BlueZ Mailing List <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] dd - device descriptor HELP :)
Date: Fri, 11 Feb 2005 21:54:14 +0100	[thread overview]
Message-ID: <1108155254.18099.62.camel@pegasus> (raw)
In-Reply-To: <de33c8be050211121066edf6c1@mail.gmail.com>

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
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

  reply	other threads:[~2005-02-11 20:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-11 15:17 [Bluez-devel] dd - device descriptor HELP :) Flávio
2005-02-11 19:11 ` Marcel Holtmann
2005-02-11 20:10   ` Flávio
2005-02-11 20:54     ` Marcel Holtmann [this message]
2005-02-11 21:58       ` Flávio
2005-02-11 22: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=1108155254.18099.62.camel@pegasus \
    --to=marcel@holtmann.org \
    --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.