Skip to main content

XMODEM protocol implementation.

Project description

https://travis-ci.org/tehmaze/xmodem.png?branch=master https://coveralls.io/repos/tehmaze/xmodem/badge.png

XMODEM protocol implementation

Documentation available at http://packages.python.org/xmodem/

Python Package Index (PyPI) page is available at https://pypi-hypernode.com/pypi/xmodem

Usage

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

>>> import serial
>>> from xmodem import XMODEM
>>> ser = serial.Serial('/dev/ttyUSB0', timeout=0) # or whatever port you need
>>> def getc(size, timeout=1):
...     return ser.read(size) 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.

Changes

0.4.6:
  • bugfix: Abort send on EOT in startup-sequence Issue #34.

  • enhancement: Include LICENSE file in the source distribution.

0.4.5:
  • bugfix: Remove bogus assert False code in recv() that resulted in AssertionError introduced in version 0.4.0 commit-id 9b03fc20, PR #29.

0.4.4:
  • 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.

0.4.3:
  • 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.

0.4.2:
  • bugfix: documentation files missing from the release tarball Issue #16.

0.4.1
  • bugfix: re-transmit in send() on NAK or timeout, previously re-transmissions (wrongly) occurred only on garbage bytes. PR #12.

0.4.0
  • enhancement: support for python 3 PR #8.

  • bugfix: CRC failures in XMODEM.recv() were not renegotiated correctly PR #11.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xmodem-0.4.6.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

xmodem-0.4.6-py2-none-any.whl (36.6 kB view details)

Uploaded Python 2

File details

Details for the file xmodem-0.4.6.tar.gz.

File metadata

  • Download URL: xmodem-0.4.6.tar.gz
  • Upload date:
  • Size: 32.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for xmodem-0.4.6.tar.gz
Algorithm Hash digest
SHA256 089737298f5738eabc43f2519efdc80b402693768f16383f7013b9e6f8f279d7
MD5 f876cb35caf276b61990377710a3b4c4
BLAKE2b-256 295da20d7957f207fc4c4c143881ca7b9617ab7700c153012372ef0a934c7710

See more details on using hashes here.

Provenance

File details

Details for the file xmodem-0.4.6-py2-none-any.whl.

File metadata

  • Download URL: xmodem-0.4.6-py2-none-any.whl
  • Upload date:
  • Size: 36.6 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for xmodem-0.4.6-py2-none-any.whl
Algorithm Hash digest
SHA256 48ba47b68f86419399b8ddf9cdcf7ce27e594a881c287ad5c24ec71c11a79791
MD5 d30a594df6a0bd1d56da184894405813
BLAKE2b-256 645d9ed983ed3d533b79cb81f1749b59bb2981c2f557f040b5319f188fb90cdf

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page