* [PATCH obexd 1/3] btio: add L2ERTM type
@ 2012-02-01 1:25 Luiz Augusto von Dentz
2012-02-01 1:25 ` [PATCH obexd 2/3] tools: Make test-client use ERTM Luiz Augusto von Dentz
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2012-02-01 1:25 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
L2ERTM type uses L2CAP socket in SOCK_STREAM instead of SOCK_SEQPACKET
---
btio/btio.c | 17 +++++++++++++++++
btio/btio.h | 1 +
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/btio/btio.c b/btio/btio.c
index 825907d..9781ec4 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -1161,6 +1161,7 @@ static gboolean get_valist(GIOChannel *io, BtIOType type, GError **err,
switch (type) {
case BT_IO_L2RAW:
case BT_IO_L2CAP:
+ case BT_IO_L2ERTM:
return l2cap_get(sock, err, opt1, args);
case BT_IO_RFCOMM:
return rfcomm_get(sock, err, opt1, args);
@@ -1223,6 +1224,7 @@ gboolean bt_io_set(GIOChannel *io, BtIOType type, GError **err,
switch (type) {
case BT_IO_L2RAW:
case BT_IO_L2CAP:
+ case BT_IO_L2ERTM:
return l2cap_set(sock, opts.sec_level, opts.imtu, opts.omtu,
opts.mode, opts.master, opts.flushable,
opts.priority, err);
@@ -1283,6 +1285,20 @@ static GIOChannel *create_io(BtIOType type, gboolean server,
opts->priority, err))
goto failed;
break;
+ case BT_IO_L2ERTM:
+ sock = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_L2CAP);
+ if (sock < 0) {
+ ERROR_FAILED(err, "socket(STREAM, L2CAP)", errno);
+ return NULL;
+ }
+ if (l2cap_bind(sock, &opts->src, server ? opts->psm : 0,
+ opts->cid, err) < 0)
+ goto failed;
+ if (!l2cap_set(sock, opts->sec_level, opts->imtu, opts->omtu,
+ opts->mode, opts->master, opts->flushable,
+ opts->priority, err))
+ goto failed;
+ break;
case BT_IO_RFCOMM:
sock = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
if (sock < 0) {
@@ -1353,6 +1369,7 @@ GIOChannel *bt_io_connect(BtIOType type, BtIOConnect connect,
err = l2cap_connect(sock, &opts.dst, 0, opts.cid);
break;
case BT_IO_L2CAP:
+ case BT_IO_L2ERTM:
err = l2cap_connect(sock, &opts.dst, opts.psm, opts.cid);
break;
case BT_IO_RFCOMM:
diff --git a/btio/btio.h b/btio/btio.h
index 7e3e130..126d5d9 100644
--- a/btio/btio.h
+++ b/btio/btio.h
@@ -40,6 +40,7 @@ GQuark bt_io_error_quark(void);
typedef enum {
BT_IO_L2RAW,
BT_IO_L2CAP,
+ BT_IO_L2ERTM,
BT_IO_RFCOMM,
BT_IO_SCO,
} BtIOType;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH obexd 2/3] tools: Make test-client use ERTM
2012-02-01 1:25 [PATCH obexd 1/3] btio: add L2ERTM type Luiz Augusto von Dentz
@ 2012-02-01 1:25 ` Luiz Augusto von Dentz
2012-02-01 1:25 ` [PATCH obexd 3/3] tools: Make test-server to " Luiz Augusto von Dentz
2012-02-01 2:32 ` [PATCH obexd 1/3] btio: add L2ERTM type Johan Hedberg
2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2012-02-01 1:25 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
If port is bigger than 31 and stream mode is selected then use ERTM
---
tools/test-client.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/test-client.c b/tools/test-client.c
index e27cd3c..8484000 100644
--- a/tools/test-client.c
+++ b/tools/test-client.c
@@ -354,8 +354,8 @@ static GIOChannel *bluetooth_connect(GObexTransportType transport)
if (option_dest == NULL || option_channel < 0)
return NULL;
- if (transport == G_OBEX_TRANSPORT_PACKET || option_channel > 31) {
- type = BT_IO_L2CAP;
+ if (option_channel > 31) {
+ type = option_packet ? BT_IO_L2CAP : BT_IO_L2ERTM;
option = BT_IO_OPT_PSM;
} else {
type = BT_IO_RFCOMM;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH obexd 3/3] tools: Make test-server to use ERTM
2012-02-01 1:25 [PATCH obexd 1/3] btio: add L2ERTM type Luiz Augusto von Dentz
2012-02-01 1:25 ` [PATCH obexd 2/3] tools: Make test-client use ERTM Luiz Augusto von Dentz
@ 2012-02-01 1:25 ` Luiz Augusto von Dentz
2012-02-01 2:32 ` [PATCH obexd 1/3] btio: add L2ERTM type Johan Hedberg
2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2012-02-01 1:25 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
If port is bigger than 31 and stream mode is selected then use ERTM
---
tools/test-server.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/test-server.c b/tools/test-server.c
index 7db153e..07d1328 100644
--- a/tools/test-server.c
+++ b/tools/test-server.c
@@ -324,7 +324,7 @@ static guint bluetooth_listen(void)
}
if (option_packet || option_channel > 31) {
- type = BT_IO_L2CAP;
+ type = option_packet ? BT_IO_L2CAP : BT_IO_L2ERTM;
option = BT_IO_OPT_PSM;
} else {
type = BT_IO_RFCOMM;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH obexd 1/3] btio: add L2ERTM type
2012-02-01 1:25 [PATCH obexd 1/3] btio: add L2ERTM type Luiz Augusto von Dentz
2012-02-01 1:25 ` [PATCH obexd 2/3] tools: Make test-client use ERTM Luiz Augusto von Dentz
2012-02-01 1:25 ` [PATCH obexd 3/3] tools: Make test-server to " Luiz Augusto von Dentz
@ 2012-02-01 2:32 ` Johan Hedberg
2 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2012-02-01 2:32 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hi Luiz,
On Tue, Jan 31, 2012, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> L2ERTM type uses L2CAP socket in SOCK_STREAM instead of SOCK_SEQPACKET
> ---
> btio/btio.c | 17 +++++++++++++++++
> btio/btio.h | 1 +
> 2 files changed, 18 insertions(+), 0 deletions(-)
All three patches have been applied. I also applied the btio patch to
bluez.git.
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-02-01 2:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-01 1:25 [PATCH obexd 1/3] btio: add L2ERTM type Luiz Augusto von Dentz
2012-02-01 1:25 ` [PATCH obexd 2/3] tools: Make test-client use ERTM Luiz Augusto von Dentz
2012-02-01 1:25 ` [PATCH obexd 3/3] tools: Make test-server to " Luiz Augusto von Dentz
2012-02-01 2:32 ` [PATCH obexd 1/3] btio: add L2ERTM type Johan Hedberg
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).