diff --git a/grmn/gcd.py b/grmn/gcd.py index af02492..555fbd1 100644 --- a/grmn/gcd.py +++ b/grmn/gcd.py @@ -196,15 +196,18 @@ class Gcd: filename = rcp[s]["from_file"] file_type_id = tlv7.binary_type_id + running_count = 0 with open(filename, "rb") as bf: while True: read_bytes = bf.read(0xff00) btlv = TLVbinary(file_type_id, len(read_bytes)) btlv.value = read_bytes gcd.struct.append(btlv) + running_count += len(read_bytes) if len(read_bytes) < 0xff00: break bf.close() + tlv7.set_binary_length(running_count) else: tlv = TLV.create_from_dump(params) gcd.struct.append(tlv) diff --git a/grmn/tlv.py b/grmn/tlv.py index ad01b0a..ef6f88f 100644 --- a/grmn/tlv.py +++ b/grmn/tlv.py @@ -200,6 +200,9 @@ class TLV6(TLV): if len(self.value) % 2 != 0: raise Exception("Invalid TLV6 payload length!") + self.fids = [] + self.format = "" + self.fields = [] for i in range(0, len(self.value), 2): fid = unpack("