[PATCH obexd 1/3] btio: Add BtIOMode enum to be used with BT_IO_OPT_MODE

Subsystems: the rest

STALE5368d

4 messages, 2 authors, 2012-02-02 · open the first message on its own page

[PATCH obexd 1/3] btio: Add BtIOMode enum to be used with BT_IO_OPT_MODE

From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Date: 2012-02-02 21:57:05

From: Luiz Augusto von Dentz <redacted>

---
 btio/btio.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/btio/btio.h b/btio/btio.h
index 126d5d9..429e8c0 100644
--- a/btio/btio.h
+++ b/btio/btio.h
@@ -77,6 +77,14 @@ typedef enum {
 	BT_IO_SEC_HIGH,
 } BtIOSecLevel;
 
+typedef enum {
+	BT_IO_MODE_BASIC = 0,
+	BT_IO_MODE_RETRANS,
+	BT_IO_MODE_FLOWCTL,
+	BT_IO_MODE_ERTM,
+	BT_IO_MODE_STREAMING
+} BtIOMode;
+
 typedef void (*BtIOConfirm)(GIOChannel *io, gpointer user_data);
 
 typedef void (*BtIOConnect)(GIOChannel *io, GError *err, gpointer user_data);
-- 
1.7.7.6

[PATCH obexd 2/3] tools: Fix test-client to use ERTM while on packet mode

From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Date: 2012-02-02 21:57:06

From: Luiz Augusto von Dentz <redacted>

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..a28d43c 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, BT_IO_MODE_ERTM,
+					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, BT_IO_MODE_ERTM,
+					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

[PATCH obexd 3/3] tools: Fix test-server to use ERTM while on packet mode

From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Date: 2012-02-02 21:57:07

From: Luiz Augusto von Dentz <redacted>

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..74d553a 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, BT_IO_MODE_ERTM,
+					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

Re: [PATCH obexd 1/3] btio: Add BtIOMode enum to be used with BT_IO_OPT_MODE

From: Johan Hedberg <hidden>
Date: 2012-02-02 23:58:03

Hi Luiz,

On Thu, Feb 02, 2012, Luiz Augusto von Dentz wrote:
From: Luiz Augusto von Dentz <redacted>

---
 btio/btio.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
All three patches have been applied (with the first one also back ported
to the bluez tree). Thanks.

Johan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help