From c584d69200587c0bde02de9dd3540a4138cfe35c Mon Sep 17 00:00:00 2001 From: Yonathan Randolph Date: Fri, 11 Oct 2013 16:00:10 -0700 Subject: [PATCH] Fix error when downloading large file The Livescribe SmartPen firmware (at least v1.5) requires a Connection header after every Continue response (which contradicts the Obex spec). We convince openobex to send the header by calling OBEX_ObjectAddHeader in the event callback. The problem is that openobex keeps counting request bytes, and when you set OBEX_FL_FIT_ONE_PACKET it will return error once all your Connection headers reach the 1kB MTU. The solution is to turn off that flag. --- obex.c | 2 +- smartpen.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/obex.c b/obex.c index 58a21b2..09bc6b0 100644 --- a/obex.c +++ b/obex.c @@ -88,7 +88,7 @@ static void obex_event (obex_t *hdl, obex_object_t *obj, int mode, if (event == OBEX_EV_PROGRESS) { hd.bq4 = 0; size = 4; - rc = OBEX_ObjectAddHeader(hdl, obj, OBEX_HDR_CONNECTION, hd, size, OBEX_FL_FIT_ONE_PACKET); + rc = OBEX_ObjectAddHeader(hdl, obj, OBEX_HDR_CONNECTION, hd, size, 0); if (rc < 0) { printf("oah fail %d\n", rc); } diff --git a/smartpen.c b/smartpen.c index bc394d5..1427e19 100644 --- a/smartpen.c +++ b/smartpen.c @@ -71,7 +71,7 @@ static void obex_event (obex_t *hdl, obex_object_t *obj, int mode, hd.bq4 = state->connid; size = 4; rc = OBEX_ObjectAddHeader(hdl, obj, OBEX_HDR_CONNECTION, - hd, size, OBEX_FL_FIT_ONE_PACKET); + hd, size, 0); if (rc < 0) { printf("oah fail %d\n", rc); }