X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=tools%2Ftinyos%2Fmisc%2Ftos-nwprog;h=4d0ef1df8cb6f82ac9a37938529cfdf347a39d2c;hb=a1d4debb263f8112b008420fea2261c16fb6fd85;hp=d8c78a3fe28333c70808ee7e5ba756dafb82ab8f;hpb=96a0ff3c723efba275d33cd2d6e459a83b0a647c;p=tinyos-2.x.git diff --git a/tools/tinyos/misc/tos-nwprog b/tools/tinyos/misc/tos-nwprog index d8c78a3f..4d0ef1df 100755 --- a/tools/tinyos/misc/tos-nwprog +++ b/tools/tinyos/misc/tos-nwprog @@ -51,8 +51,8 @@ DELUGE_IDENT_SIZE = 128 NWPROG_PORT = 5213 NWPROG_PKT_SIZE = 64 -NWPROG_REQ_FMT = "!BBH" -NWPROG_REPLY_FMT = "!BBBBH" +NWPROG_REQ_FMT = "!BBL" +NWPROG_REPLY_FMT = "!BBBBL" ERROR_SUCCESS = 0 nRetries = 3 @@ -63,7 +63,7 @@ class CommandFailedException: def send_command(cmd_str, retries): s.sendto(cmd_str, (remote, NWPROG_PORT)) s.settimeout(3) - (real_cmd, real_imgno, real_offset) = struct.unpack(NWPROG_REQ_FMT, cmd_str[0:4]) + (real_cmd, real_imgno, real_offset) = struct.unpack(NWPROG_REQ_FMT, cmd_str[0:6]) try: data, addr = s.recvfrom(1024) # make sure this is the guy we're programming @@ -95,7 +95,7 @@ def read(imgNum, unused=None): data = send_command(sreqpkt, 5) if data != False: - (error, pack, cmd, imgno, offset) = struct.unpack(NWPROG_REPLY_FMT, data[0:6]) + (error, pack, cmd, imgno, offset) = struct.unpack(NWPROG_REPLY_FMT, data[0:8]) if offset == pkt_offset: for c in data[6:]: print >>sys.stderr, ord(c)