Skip to content

Fix error when downloading large file#3

Open
yonran wants to merge 1 commit into
srwalter:masterfrom
yonran:patch-1
Open

Fix error when downloading large file#3
yonran wants to merge 1 commit into
srwalter:masterfrom
yonran:patch-1

Conversation

@yonran

@yonran yonran commented Oct 11, 2013

Copy link
Copy Markdown

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.

Example of getting error when the pen has a lot of data (in my case, PaperReplay is 1GB):

>>> import pysmartpen
>>> s = pysmartpen.Smartpen()
>>> s.connect(vendor=0x1cfb, product=0x1010)
>>> s.get_paperreplay('paperreplay')
oah fail -1
oah fail -1
FAIL 53 3
python: smartpen.c:83: obex_event: Assertion `0' failed.
Aborted (core dumped)

@yonran

yonran commented Oct 11, 2013

Copy link
Copy Markdown
Author

btw the maintainers of the LibreScribe smartpen.c fork seem to have already come across this solution

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.
@yonran

yonran commented Oct 26, 2013

Copy link
Copy Markdown
Author

Sorry, I didn't fix the right file. I have modified the commit to also fix smartpen.c (not just obex.c).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant