linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Problems with bt_io_listen
@ 2010-03-25 14:45 José Antonio Santos Cadenas
  2010-03-25 15:22 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 3+ messages in thread
From: José Antonio Santos Cadenas @ 2010-03-25 14:45 UTC (permalink / raw)
  To: linux-bluetooth

Hi all,

We are developing an implementation of HDP and MCAP for bluez. We are triying 
to perform many connections between two devices but when we make the second 
connection it is not created correctly.

We are using a defer connection (we passed a confirm callback to the 
bt_io_listen function) and we think that we are missing something but  we 
can't find what. If we used the connection callback (not defer) all the 
connections are done successfully.

We are listening with the following code:

static void confirm_cb(GIOChannel *chan, gpointer user_data)
{
	...
	node->chan = g_io_channel_ref(chan);
	...
	/* All is ok */
	return;
drop:
	/* Connection refused */
	g_io_channel_shutdown(chan, TRUE, NULL);
}

....
chan = bt_io_listen(BT_IO_L2CAP, NULL, confirm_cb, NULL,
				NULL, &gerr,
				BT_IO_OPT_SOURCE_BDADDR, &src,
				BT_IO_OPT_PSM, 0x1001,
				BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
				BT_IO_OPT_INVALID);
...

Any ideas?

Regards and thank.

Jose.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problems with bt_io_listen
  2010-03-25 14:45 Problems with bt_io_listen José Antonio Santos Cadenas
@ 2010-03-25 15:22 ` Luiz Augusto von Dentz
  2010-03-25 16:13   ` sancane
  0 siblings, 1 reply; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2010-03-25 15:22 UTC (permalink / raw)
  To: jcaden; +Cc: linux-bluetooth

Hi,

On Thu, Mar 25, 2010 at 4:45 PM, José Antonio Santos Cadenas
<jcaden@libresoft.es> wrote:
> Hi all,
>
> We are developing an implementation of HDP and MCAP for bluez. We are triying
> to perform many connections between two devices but when we make the second
> connection it is not created correctly.
>
> We are using a defer connection (we passed a confirm callback to the
> bt_io_listen function) and we think that we are missing something but  we
> can't find what. If we used the connection callback (not defer) all the
> connections are done successfully.
>
> We are listening with the following code:
>
> static void confirm_cb(GIOChannel *chan, gpointer user_data)
> {
>        ...
>        node->chan = g_io_channel_ref(chan);
>        ...
>        /* All is ok */
>        return;
> drop:
>        /* Connection refused */
>        g_io_channel_shutdown(chan, TRUE, NULL);
> }

Im not really sure what is the problem but maybe it is the missing
bt_io_accept, but of course it can be that you just hide it in those
...

> ....
> chan = bt_io_listen(BT_IO_L2CAP, NULL, confirm_cb, NULL,
>                                NULL, &gerr,
>                                BT_IO_OPT_SOURCE_BDADDR, &src,
>                                BT_IO_OPT_PSM, 0x1001,
>                                BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
>                                BT_IO_OPT_INVALID);
> ...

The listen part at least seems ok.


-- 
Luiz Augusto von Dentz
Computer Engineer

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problems with bt_io_listen
  2010-03-25 15:22 ` Luiz Augusto von Dentz
@ 2010-03-25 16:13   ` sancane
  0 siblings, 0 replies; 3+ messages in thread
From: sancane @ 2010-03-25 16:13 UTC (permalink / raw)
  Cc: linux-bluetooth

Hello,

> Hi,
> 
> On Thu, Mar 25, 2010 at 4:45 PM, José Antonio Santos Cadenas
> <jcaden@libresoft.es> wrote:
>> Hi all,
>>
>> We are developing an implementation of HDP and MCAP for bluez. We are triying
>> to perform many connections between two devices but when we make the second
>> connection it is not created correctly.
>>
>> We are using a defer connection (we passed a confirm callback to the
>> bt_io_listen function) and we think that we are missing something but  we
>> can't find what. If we used the connection callback (not defer) all the
>> connections are done successfully.
>>
>> We are listening with the following code:
>>
>> static void confirm_cb(GIOChannel *chan, gpointer user_data)
>> {
>>        ...
>>        node->chan = g_io_channel_ref(chan);
>>        ...
>>        /* All is ok */
>>        return;
>> drop:
>>        /* Connection refused */
>>        g_io_channel_shutdown(chan, TRUE, NULL);
>> }
> 
> Im not really sure what is the problem but maybe it is the missing
> bt_io_accept, but of course it can be that you just hide it in those
> ...

You're rigth, we forgot the bt_io_accept call.

> 
>> ....
>> chan = bt_io_listen(BT_IO_L2CAP, NULL, confirm_cb, NULL,
>>                                NULL, &gerr,
>>                                BT_IO_OPT_SOURCE_BDADDR, &src,
>>                                BT_IO_OPT_PSM, 0x1001,
>>                                BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
>>                                BT_IO_OPT_INVALID);
>> ...
> 
> The listen part at least seems ok.
> 
> 
Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-25 16:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-25 14:45 Problems with bt_io_listen José Antonio Santos Cadenas
2010-03-25 15:22 ` Luiz Augusto von Dentz
2010-03-25 16:13   ` sancane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).