srwalter/libsmartpen — pull request #3 by yonran (2013-10-11 23:02:37+00:00)
Title: 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.

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)