Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH obexd 1/2] tools: Fix test-client to use ERTM while on packet mode
@ 2012-02-02 19:07 Luiz Augusto von Dentz
  2012-02-02 19:07 ` [PATCH obexd 2/2] tools: Fix test-server " Luiz Augusto von Dentz
  2012-02-02 20:05 ` [PATCH obexd 1/2] tools: Fix test-client " Johan Hedberg
  0 siblings, 2 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2012-02-02 19:07 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

OBEX should only be used with ERTM over L2CAP and set MTU properly
---
 tools/test-client.c |   60 ++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 45 insertions(+), 15 deletions(-)

diff --git a/tools/test-client.c b/tools/test-client.c
index 8484000..83c0035 100644
--- a/tools/test-client.c
+++ b/tools/test-client.c
@@ -362,21 +362,51 @@ static GIOChannel *bluetooth_connect(GObexTransportType transport)
 		option = BT_IO_OPT_CHANNEL;
 	}
 
-	if (option_source)
-		io = bt_io_connect(type, conn_callback, GUINT_TO_POINTER(transport),
-				NULL, &err,
-				BT_IO_OPT_SOURCE, option_source,
-				BT_IO_OPT_DEST, option_dest,
-				option, option_channel,
-				BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
-				BT_IO_OPT_INVALID);
-	else
-		io = bt_io_connect(type, conn_callback, GUINT_TO_POINTER(transport),
-				NULL, &err,
-				BT_IO_OPT_DEST, option_dest,
-				option, option_channel,
-				BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
-				BT_IO_OPT_INVALID);
+	if (option_source) {
+		if (type == BT_IO_L2CAP) {
+			io = bt_io_connect(type, conn_callback,
+					GUINT_TO_POINTER(transport),
+					NULL, &err,
+					BT_IO_OPT_SOURCE, option_source,
+					BT_IO_OPT_DEST, option_dest,
+					option, option_channel,
+					BT_IO_OPT_MODE, 0x03,
+					BT_IO_OPT_OMTU, option_omtu,
+					BT_IO_OPT_IMTU, option_imtu,
+					BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
+					BT_IO_OPT_INVALID);
+		} else {
+			io = bt_io_connect(type, conn_callback,
+					GUINT_TO_POINTER(transport),
+					NULL, &err,
+					BT_IO_OPT_SOURCE, option_source,
+					BT_IO_OPT_DEST, option_dest,
+					option, option_channel,
+					BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
+					BT_IO_OPT_INVALID);
+		}
+	} else {
+		if (type == BT_IO_L2CAP) {
+			io = bt_io_connect(type, conn_callback,
+					GUINT_TO_POINTER(transport),
+					NULL, &err,
+					BT_IO_OPT_DEST, option_dest,
+					option, option_channel,
+					BT_IO_OPT_MODE, 0x03,
+					BT_IO_OPT_OMTU, option_omtu,
+					BT_IO_OPT_IMTU, option_imtu,
+					BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
+					BT_IO_OPT_INVALID);
+		} else {
+			io = bt_io_connect(type, conn_callback,
+					GUINT_TO_POINTER(transport),
+					NULL, &err,
+					BT_IO_OPT_DEST, option_dest,
+					option, option_channel,
+					BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
+					BT_IO_OPT_INVALID);
+		}
+	}
 
 	if (io != NULL)
 		return io;
-- 
1.7.7.6


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

* [PATCH obexd 2/2] tools: Fix test-server to use ERTM while on packet mode
  2012-02-02 19:07 [PATCH obexd 1/2] tools: Fix test-client to use ERTM while on packet mode Luiz Augusto von Dentz
@ 2012-02-02 19:07 ` Luiz Augusto von Dentz
  2012-02-02 20:05 ` [PATCH obexd 1/2] tools: Fix test-client " Johan Hedberg
  1 sibling, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2012-02-02 19:07 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

OBEX should only be used with ERTM over L2CAP and set MTU properly
---
 tools/test-server.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/tools/test-server.c b/tools/test-server.c
index 07d1328..d62a04a 100644
--- a/tools/test-server.c
+++ b/tools/test-server.c
@@ -331,9 +331,20 @@ static guint bluetooth_listen(void)
 		option = BT_IO_OPT_CHANNEL;
 	}
 
-	io = bt_io_listen(type, bluetooth_accept, NULL, NULL, NULL, &err,
-				option, option_channel,
-				BT_IO_OPT_INVALID);
+	if (type == BT_IO_L2CAP)
+		io = bt_io_listen(type, bluetooth_accept, NULL, NULL,
+					NULL, &err,
+					option, option_channel,
+					BT_IO_OPT_MODE, 0x03,
+					BT_IO_OPT_OMTU, option_omtu,
+					BT_IO_OPT_IMTU, option_imtu,
+					BT_IO_OPT_INVALID);
+	else
+		io = bt_io_listen(type, bluetooth_accept, NULL, NULL,
+					NULL, &err,
+					option, option_channel,
+					BT_IO_OPT_INVALID);
+
 	if (io == NULL) {
 		g_printerr("%s\n", err->message);
 		g_error_free(err);
-- 
1.7.7.6


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

* Re: [PATCH obexd 1/2] tools: Fix test-client to use ERTM while on packet mode
  2012-02-02 19:07 [PATCH obexd 1/2] tools: Fix test-client to use ERTM while on packet mode Luiz Augusto von Dentz
  2012-02-02 19:07 ` [PATCH obexd 2/2] tools: Fix test-server " Luiz Augusto von Dentz
@ 2012-02-02 20:05 ` Johan Hedberg
  2012-02-02 20:09   ` Luiz Augusto von Dentz
  1 sibling, 1 reply; 4+ messages in thread
From: Johan Hedberg @ 2012-02-02 20:05 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

On Thu, Feb 02, 2012, Luiz Augusto von Dentz wrote:
> +					BT_IO_OPT_MODE, 0x03,

I think it'd be better to add proper defines for these magic values
first.

Johan

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

* Re: [PATCH obexd 1/2] tools: Fix test-client to use ERTM while on packet mode
  2012-02-02 20:05 ` [PATCH obexd 1/2] tools: Fix test-client " Johan Hedberg
@ 2012-02-02 20:09   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2012-02-02 20:09 UTC (permalink / raw)
  To: Luiz Augusto von Dentz, linux-bluetooth

Hi Johan

On Thu, Feb 2, 2012 at 12:05 PM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> Hi Luiz,
>
> On Thu, Feb 02, 2012, Luiz Augusto von Dentz wrote:
>> +                                     BT_IO_OPT_MODE, 0x03,
>
> I think it'd be better to add proper defines for these magic values
> first.

Sure, gonna do that and send another series.

-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2012-02-02 20:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-02 19:07 [PATCH obexd 1/2] tools: Fix test-client to use ERTM while on packet mode Luiz Augusto von Dentz
2012-02-02 19:07 ` [PATCH obexd 2/2] tools: Fix test-server " Luiz Augusto von Dentz
2012-02-02 20:05 ` [PATCH obexd 1/2] tools: Fix test-client " Johan Hedberg
2012-02-02 20:09   ` Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox