summaryrefslogtreecommitdiff
path: root/downloader/downloader.py
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2013-07-07 02:46:24 +0000
committerChristian Pointner <equinox@spreadspace.org>2013-07-07 02:46:24 +0000
commit82c90d70279c9522520f864daa72156fdacf38b1 (patch)
treeb245570d048459da45e0f3bab27188f33104d9d7 /downloader/downloader.py
parentadded length field for messages (diff)
bootloader now checks csum
git-svn-id: https://svn.spreadspace.org/pic/trunk@47 a09c6847-51d9-44de-8ef2-e725cf50f3c7
Diffstat (limited to 'downloader/downloader.py')
-rwxr-xr-xdownloader/downloader.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/downloader/downloader.py b/downloader/downloader.py
index f90eced..b85326f 100755
--- a/downloader/downloader.py
+++ b/downloader/downloader.py
@@ -108,9 +108,11 @@ def exec_command(dev, cmd, param, answer):
5: "address invalid", 6: "address prohibited",
7: "value out of bounds" }
- cstr = bytearray(struct.pack('<BB', cmd, 0) + param)
+ dev.flushInput()
+ dev.flushOutput()
+
+ cstr = bytearray(struct.pack('<BB', cmd, len(param)+3) + param)
cstr.extend(struct.pack("<B", calc_csum(cstr)))
- cstr[1] = len(cstr)
dev.write(cstr)
astr = bytearray()