[chirp_devel] [PATCH 2 of 2] ap510: Wait longer for data during download. #2095

Tom Hayward
Thu Dec 18 21:18:57 PST 2014


# HG changeset patch
# User Tom Hayward <tom at tomh.us>
# Date 1418966151 28800
#      Thu Dec 18 21:15:51 2014 -0800
# Node ID c152bca4fd0352de559496a7705186707e0111b8
# Parent  dab6a8e2a7666c3beea65f4831f9c7161c648092
ap510: Wait longer for data during download. #2095

diff -r dab6a8e2a766 -r c152bca4fd03 chirp/ap510.py
--- a/chirp/ap510.py	Thu Dec 18 21:15:49 2014 -0800
+++ b/chirp/ap510.py	Thu Dec 18 21:15:51 2014 -0800
@@ -86,11 +86,17 @@
     status.msg = "Downloading"
     radio.status_fn(status)
     radio.pipe.write("@DISP")
-    buf = radio.pipe.read(1024)
+    buf = ""
 
-    status.cur = 5
-    status.max = 5
-    radio.status_fn(status)
+    for status.cur in xrange(status.cur, status.max):
+        buf += radio.pipe.read(1024)
+        if buf.endswith("\r\n"):
+            status.cur = status.max
+            radio.status_fn(status)
+            break
+        radio.status_fn(status)
+    else:
+        raise errors.RadioError("Incomplete data received.")
 
     print "%04i P<R: %s" % (
         len(buf), util.hexprint(buf).replace("\n", "\n          "))



More information about the chirp_devel mailing list