From 55906721e9652dcdd18635d2bc60f7161a4069d2 Mon Sep 17 00:00:00 2001 From: jkflying Date: Thu, 12 Mar 2015 14:54:18 +0200 Subject: [PATCH] Timeout in getc should be treated as a NAK and cause a resend This change allowed 1k mode to successfully load to a Sierra Wireless SL6087, with mode='xmodem1k' and pad='\xff' --- xmodem/__init__.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/xmodem/__init__.py b/xmodem/__init__.py index 48ee70e..c399fc8 100644 --- a/xmodem/__init__.py +++ b/xmodem/__init__.py @@ -311,8 +311,8 @@ def callback(total_packets, success_count, error_count) if callable(callback): callback(total_packets, success_count, error_count) break - if char == NAK: - self.log.warn('send error: NAK received ' + else: + self.log.warn('send error: non-ACK received ' 'for block %d', sequence) error_count += 1 if callable(callback): @@ -328,12 +328,6 @@ def callback(total_packets, success_count, error_count) # return to loop and resend continue - # protocol error - self.log.error('send error: expected ACK, NAK; got %r, ' - 'aborting.', char) - self.abort(timeout=timeout) - return False - # keep track of sequence sequence = (sequence + 1) % 0x100