From 2a4001626f9a5f38487bc8b09e5d9bfc57e98295 Mon Sep 17 00:00:00 2001 From: Johan Kanflo Date: Mon, 22 Jun 2020 07:16:50 +0200 Subject: [PATCH] Replaced pycrc with crc16 (#220) --- dpsctl/dpsctl.py | 8 ++++---- requirements.txt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dpsctl/dpsctl.py b/dpsctl/dpsctl.py index 8fa55e35..bede31ae 100755 --- a/dpsctl/dpsctl.py +++ b/dpsctl/dpsctl.py @@ -60,10 +60,10 @@ unpack_cal_report, unpack_query_response, unpack_version_response) try: - from PyCRC.CRCCCITT import CRCCCITT + import crc16 except ImportError: - print("Missing dependency pycrc:") - print(" sudo pip{} install pycrc" + print("Missing dependency crc16:") + print(" sudo pip{} install crc16" .format("3" if sys.version_info.major == 3 else "")) raise SystemExit() try: @@ -616,7 +616,7 @@ def run_upgrade(comms, fw_file_name, args): content = file.read() if codecs.encode(content, 'hex')[6:8] != b'20' and not args.force: fail("The firmware file does not seem valid, use --force to force upgrade") - crc = CRCCCITT().calculate(content) + crc = crc16.crc16xmodem(content) chunk_size = 1024 ret_dict = communicate(comms, create_upgrade_start(chunk_size, crc), args) if ret_dict["status"] == protocol.UPGRADE_CONTINUE: diff --git a/requirements.txt b/requirements.txt index 3250c739..140ee294 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -git+https://github.com/alexbutirskiy/PyCRC +crc16==0.1.1 pyserial==3.4