Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error when downloading large file #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yonran
Copy link

@yonran yonran commented Oct 11, 2013

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
Copy link
Author

yonran commented Oct 11, 2013

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
Copy link
Author

yonran commented Oct 26, 2013

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