* [PATCH BlueZ 1/3] gobex: Add proper message to transfer errors
@ 2013-08-08 13:49 Luiz Augusto von Dentz
2013-08-08 13:49 ` [PATCH BlueZ 2/3] gobex: Make PUT request with just filler byte to set the final bit Luiz Augusto von Dentz
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2013-08-08 13:49 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This improve the error message when a transfer fails by using
g_obex_strerror to decode the response code to a human readable string.
---
gobex/gobex-transfer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gobex/gobex-transfer.c b/gobex/gobex-transfer.c
index ac8836c..4203fec 100644
--- a/gobex/gobex-transfer.c
+++ b/gobex/gobex-transfer.c
@@ -207,8 +207,8 @@ static void transfer_response(GObex *obex, GError *err, GObexPacket *rsp,
rspcode = g_obex_packet_get_operation(rsp, &final);
if (rspcode != G_OBEX_RSP_SUCCESS && rspcode != G_OBEX_RSP_CONTINUE) {
- err = g_error_new(G_OBEX_ERROR, rspcode,
- "Transfer failed (0x%02x)", rspcode);
+ err = g_error_new(G_OBEX_ERROR, rspcode, "%s",
+ g_obex_strerror(rspcode));
goto failed;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH BlueZ 2/3] gobex: Make PUT request with just filler byte to set the final bit
2013-08-08 13:49 [PATCH BlueZ 1/3] gobex: Add proper message to transfer errors Luiz Augusto von Dentz
@ 2013-08-08 13:49 ` Luiz Augusto von Dentz
2013-08-08 13:49 ` [PATCH BlueZ 3/3] client/transfer: Add proper message to errors Luiz Augusto von Dentz
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2013-08-08 13:49 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This make PUT request with just filler byte 0x30 to be treated as there
is no data and thus avoid an extra packet to be sent.
Some profiles such as MAP use this to workaround PUT being interpreted as
a delete request:
"5.7.5 Body/EndOfBody
To avoid PUT with empty Body leading to a 'delete' of the related
message these headers shall contain a filler byte. The value of this
byte shall be set to 0x30 (="0")."
Future PIM related specs in development also seems to be following the
use of filler byte.
---
gobex/gobex-packet.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/gobex/gobex-packet.c b/gobex/gobex-packet.c
index 4c14cf7..96f8c76 100644
--- a/gobex/gobex-packet.c
+++ b/gobex/gobex-packet.c
@@ -387,9 +387,15 @@ static gssize get_body(GObexPacket *pkt, guint8 *buf, gsize len)
if (ret < 0)
return ret;
- if (ret > 0)
- buf[0] = G_OBEX_HDR_BODY;
- else
+ if (ret > 0) {
+ /* To avoid PUT with empty Body leading to a 'delete' some
+ * transfer may use a filler byte of 0x30 (="0").
+ */
+ if (ret == 2 && strcmp((char *) buf + 3, "0") == 0)
+ buf[0] = G_OBEX_HDR_BODY_END;
+ else
+ buf[0] = G_OBEX_HDR_BODY;
+ } else
buf[0] = G_OBEX_HDR_BODY_END;
u16 = g_htons(ret + 3);
@@ -440,7 +446,7 @@ gssize g_obex_packet_encode(GObexPacket *pkt, guint8 *buf, gsize len)
ret = get_body(pkt, buf + count, len - count);
if (ret < 0)
return ret;
- if (ret == 0) {
+ if (ret == 0 || buf[count] == G_OBEX_HDR_BODY_END) {
if (pkt->opcode == G_OBEX_RSP_CONTINUE)
buf[0] = G_OBEX_RSP_SUCCESS;
buf[0] |= FINAL_BIT;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH BlueZ 3/3] client/transfer: Add proper message to errors
2013-08-08 13:49 [PATCH BlueZ 1/3] gobex: Add proper message to transfer errors Luiz Augusto von Dentz
2013-08-08 13:49 ` [PATCH BlueZ 2/3] gobex: Make PUT request with just filler byte to set the final bit Luiz Augusto von Dentz
@ 2013-08-08 13:49 ` Luiz Augusto von Dentz
2013-08-12 10:53 ` [PATCH BlueZ 1/3] gobex: Add proper message to transfer errors Luiz Augusto von Dentz
2013-08-17 8:35 ` Rfcomm connection error while connecting from android app Tama
3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2013-08-08 13:49 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This improve the error message when a transfer fails by using
g_obex_strerror to decode the response code to a human readable string.
---
obexd/client/transfer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/obexd/client/transfer.c b/obexd/client/transfer.c
index 4b1def3..2e8f7c7 100644
--- a/obexd/client/transfer.c
+++ b/obexd/client/transfer.c
@@ -596,8 +596,8 @@ static void get_xfer_progress_first(GObex *obex, GError *err, GObexPacket *rsp,
rspcode = g_obex_packet_get_operation(rsp, &final);
if (rspcode != G_OBEX_RSP_SUCCESS && rspcode != G_OBEX_RSP_CONTINUE) {
- err = g_error_new(OBC_TRANSFER_ERROR, rspcode,
- "Transfer failed (0x%02x)", rspcode);
+ err = g_error_new(OBC_TRANSFER_ERROR, rspcode, "%s",
+ g_obex_strerror(rspcode));
xfer_complete(obex, err, transfer);
g_error_free(err);
return;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH BlueZ 1/3] gobex: Add proper message to transfer errors
2013-08-08 13:49 [PATCH BlueZ 1/3] gobex: Add proper message to transfer errors Luiz Augusto von Dentz
2013-08-08 13:49 ` [PATCH BlueZ 2/3] gobex: Make PUT request with just filler byte to set the final bit Luiz Augusto von Dentz
2013-08-08 13:49 ` [PATCH BlueZ 3/3] client/transfer: Add proper message to errors Luiz Augusto von Dentz
@ 2013-08-12 10:53 ` Luiz Augusto von Dentz
2013-08-17 8:35 ` Rfcomm connection error while connecting from android app Tama
3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2013-08-12 10:53 UTC (permalink / raw)
To: linux-bluetooth@vger.kernel.org
Hi,
On Thu, Aug 8, 2013 at 4:49 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> This improve the error message when a transfer fails by using
> g_obex_strerror to decode the response code to a human readable string.
> ---
> gobex/gobex-transfer.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gobex/gobex-transfer.c b/gobex/gobex-transfer.c
> index ac8836c..4203fec 100644
> --- a/gobex/gobex-transfer.c
> +++ b/gobex/gobex-transfer.c
> @@ -207,8 +207,8 @@ static void transfer_response(GObex *obex, GError *err, GObexPacket *rsp,
>
> rspcode = g_obex_packet_get_operation(rsp, &final);
> if (rspcode != G_OBEX_RSP_SUCCESS && rspcode != G_OBEX_RSP_CONTINUE) {
> - err = g_error_new(G_OBEX_ERROR, rspcode,
> - "Transfer failed (0x%02x)", rspcode);
> + err = g_error_new(G_OBEX_ERROR, rspcode, "%s",
> + g_obex_strerror(rspcode));
> goto failed;
> }
>
> --
> 1.8.3.1
I went ahead and applied patches 1 and 3, for patch 2 I will wait for
feedback as the filler byte is something Bluetooth specific it can be
controversial.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 5+ messages in thread
* Rfcomm connection error while connecting from android app
2013-08-08 13:49 [PATCH BlueZ 1/3] gobex: Add proper message to transfer errors Luiz Augusto von Dentz
` (2 preceding siblings ...)
2013-08-12 10:53 ` [PATCH BlueZ 1/3] gobex: Add proper message to transfer errors Luiz Augusto von Dentz
@ 2013-08-17 8:35 ` Tama
3 siblings, 0 replies; 5+ messages in thread
From: Tama @ 2013-08-17 8:35 UTC (permalink / raw)
To: linux-bluetooth@vger.kernel.org
Hello all,
This is my first post to this mailing list. I am new to Bluetooth, I am trying to develop an embedded application with bluetooth using bluez 4.96 stack which would be controled by an adroid application.
My embedded platfrom is IMX28 running linux with Bluex4.96. On this platfrom I have a BCM2070 bluetooth usb dongle. I am running a simple rfcomm server example from this link "http://people.csail.mit.edu/albert/bluez-intro/x502.html". I ran a rfcomm client on ubuntu pc with BCM2070 bluetooth usb dongle and I could talk between the server and client.
Now I am developing an app on android but i am unable to connect to rfcomm server. I even tried running the rfcomm server on ubuntu machine but same result. I have attached the log of hcidump.
> HCI Event: Connect Request (0x04) plen 10
bdaddr D0:E7:82:4A:26:BA class 0x5a011c type ACL
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7
bdaddr D0:E7:82:4A:26:BA role 0x00
Role: Master
> HCI Event: Command Status (0x0f) plen 4
Accept Connection Request (0x01|0x0009) status 0x00 ncmd 1
> HCI Event: Role Change (0x12) plen 8
status 0x00 bdaddr D0:E7:82:4A:26:BA role 0x00
Role: Master
> HCI Event: Connect Complete (0x03) plen 11
status 0x00 handle 12 bdaddr D0:E7:82:4A:26:BA type ACL encrypt 0x00
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
handle 12
> HCI Event: Command Status (0x0f) plen 4
Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1
> HCI Event: Read Remote Supported Features (0x0b) plen 11
status 0x00 handle 12
Features: 0xbf 0x3e 0x8d 0xfe 0xdb 0xff 0x5b 0x87
< HCI Command: Read Remote Extended Features (0x01|0x001c) plen 3
handle 12 page 1
> HCI Event: Command Status (0x0f) plen 4
Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1
> ACL data: handle 12 flags 0x02 dlen 12
L2CAP(s): Connect req: psm 1 scid 0x0040
< ACL data: handle 12 flags 0x00 dlen 16
L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 1 status 0
Connection pending - No futher information available
< ACL data: handle 12 flags 0x00 dlen 10
L2CAP(s): Info req: type 2
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 2
> ACL data: handle 12 flags 0x02 dlen 16
L2CAP(s): Info rsp: type 2 result 0
Extended feature mask 0x02fb
Flow control mode
Retransmission mode
Enhanced Retransmission mode
Streaming mode
FCS Option
Extended Flow Specification
Fixed Channels
Unicast Connectless Data Reception
< ACL data: handle 12 flags 0x00 dlen 10
L2CAP(s): Info req: type 3
> HCI Event: Max Slots Change (0x1b) plen 3
handle 12 slots 5
> ACL data: handle 12 flags 0x02 dlen 20
L2CAP(s): Info rsp: type 3 result 0
Fixed channel list 0x00000006
L2CAP Signalling Channel
L2CAP Connless
< ACL data: handle 12 flags 0x00 dlen 16
L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 0 status 0
Connection successful
< ACL data: handle 12 flags 0x00 dlen 23
L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 11
RFC 0x00 (Basic)
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 2
> ACL data: handle 12 flags 0x02 dlen 16
L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 4
MTU 1691
< ACL data: handle 12 flags 0x00 dlen 18
L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 4
MTU 1691
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 2
> ACL data: handle 12 flags 0x02 dlen 14
L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 0
Success
> ACL data: handle 12 flags 0x02 dlen 31
L2CAP(d): cid 0x0040 len 27 [psm 1]
SDP SS Req: tid 0x26 len 0x16
pat uuid-128 00001101-0000-1000-8000-00805f9b34fb
max 16
cont 00
< ACL data: handle 12 flags 0x00 dlen 14
L2CAP(d): cid 0x0040 len 10 [psm 1]
SDP SS Rsp: tid 0x26 len 0x5
count 0
cont 00
> HCI Event: Read Remote Extended Features (0x23) plen 13
status 0x00 handle 12 page 1 max 2
Features: 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00
< HCI Command: Remote Name Request (0x01|0x0019) plen 10
bdaddr D0:E7:82:4A:26:BA mode 2 clkoffset 0x0000
> ACL data: handle 12 flags 0x02 dlen 12
L2CAP(s): Disconn req: dcid 0x0040 scid 0x0040
< ACL data: handle 12 flags 0x00 dlen 12
L2CAP(s): Disconn rsp: dcid 0x0040 scid 0x0040
> HCI Event: Command Status (0x0f) plen 4
Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 2
> HCI Event: Remote Name Req Complete (0x07) plen 255
status 0x00 bdaddr D0:E7:82:4A:26:BA name 'A1-810'
> HCI Event: Disconn Complete (0x05) plen 4
status 0x00 handle 12 reason 0x13
Reason: Remote User Terminated Connection
What could be the reason for termination of a connection. On my host machine i just have rfcomm server running nothing else. Does my rfcomm server needs to have anything else in it.
Can some one please help me to understand what could be causing this issue.
Thanks
Tama
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-08-17 8:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-08 13:49 [PATCH BlueZ 1/3] gobex: Add proper message to transfer errors Luiz Augusto von Dentz
2013-08-08 13:49 ` [PATCH BlueZ 2/3] gobex: Make PUT request with just filler byte to set the final bit Luiz Augusto von Dentz
2013-08-08 13:49 ` [PATCH BlueZ 3/3] client/transfer: Add proper message to errors Luiz Augusto von Dentz
2013-08-12 10:53 ` [PATCH BlueZ 1/3] gobex: Add proper message to transfer errors Luiz Augusto von Dentz
2013-08-17 8:35 ` Rfcomm connection error while connecting from android app Tama
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).