You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tehmaze c510eb76fa
Merge pull request #36 from tax/master
1 month ago
doc Typo in 1's complement calculation 1 month ago
test Adjust ferboz's tests: style & boundaries 3 years ago
xmodem Merge branch 'master' of 2 years ago
.coveralls.yml Added coveralls token 5 years ago
.drone.yml Configuration for Drone CI 2 years ago
.gitignore Add unit test for retry parameter in send() method 3 years ago
.hgignore updated .hgignore 9 years ago
.travis.yml Squlching apt-get update 3 years ago Included 3 years ago
Makefile wire-in tox to Makefile 'tests' target 4 years ago
README.rst bump for release 0.4.5 2 years ago
requirements-testing.txt Use functional tests (tox + py.test + lrzsz package) 4 years ago
setup.cfg Added terse documentation 9 years ago bump for release 0.4.5 2 years ago
tox.ini Use functional tests (tox + py.test + lrzsz package) 4 years ago


.. image::

.. image::

XMODEM protocol implementation

Documentation available at

Python Package Index (PyPI) page is available at


Create a function to get and put character data (to a serial line for

>>> import serial
>>> from xmodem import XMODEM
>>> ser = serial.Serial('/dev/ttyUSB0', timeout=0) # or whatever port you need
>>> def getc(size, timeout=1):
... return or None
>>> def putc(data, timeout=1):
... return ser.write(data) # note that this ignores the timeout
>>> modem = XMODEM(getc, putc)

Now, to upload a file, use the ``send`` method::

>>> stream = open('/etc/fstab', 'rb')
>>> modem.send(stream)

To download a file, use the ``recv`` method::

>>> stream = open('output', 'wb')
>>> modem.recv(stream)

For more information, take a look at the documentation_.

.. _documentation:


* bugfix: Remove bogus `assert False` code in ``recv()`` that resulted in
`AssertionError` introduced in version 0.4.0 commit-id `9b03fc20`, `PR #29
* bugfix: Large file transfers in ``send()`` were more likely to fail for
small values of ``retry``: This value should be the maximum failures per
block transfer as documented, but was improperly implemented as the number
of failures allowed for the total duration of the transfer, `PR #21
* bugfix: ``send(retry=n)`` and ``recv(retry=n)`` should retry ``n`` times
as documented, was retrying ``n - 1``.

* bugfix: ``putc()`` callback was called in series, 3 times for each part of
xmodem block header, data, and checksum during block transfer. Now all
three data blocks are sent by single ``putc()`` call. This resolves issues
when integrating with microcontrollers or equipment sensitive to timing
issues at stream boundaries, `PR #19

* bugfix: documentation files missing from the release tarball
`Issue #16 <>`_.

* bugfix: re-transmit in ``send()`` on ``NAK`` or timeout, previously
re-transmissions (wrongly) occurred only on garbage bytes.
`PR #12 <>`_.

* enhancement: support for python 3
`PR #8 <>`_.
* bugfix: CRC failures in XMODEM.recv() were not renegotiated correctly
`PR #11 <>`_.