Skip to content
Snippets Groups Projects
Commit 3c46b65d authored by Bruce Flynn's avatar Bruce Flynn
Browse files

fix issue with prune_packet script

parent ff8631d1
No related branches found
No related tags found
No related merge requests found
...@@ -211,6 +211,7 @@ class PacketStream(object): ...@@ -211,6 +211,7 @@ class PacketStream(object):
if len(self._seek_cache): if len(self._seek_cache):
return self._seek_cache.popleft() return self._seek_cache.popleft()
try: try:
# namedtuple('Tracker', ['h1', 'h2', 'size', 'offset', 'data'])
h1, h2, data_size, offset, data = self._stream.next() h1, h2, data_size, offset, data = self._stream.next()
except PacketTooShort as err: except PacketTooShort as err:
if self._fail_on_tooshort: if self._fail_on_tooshort:
......
...@@ -14,25 +14,19 @@ parser.add_argument('outfile') ...@@ -14,25 +14,19 @@ parser.add_argument('outfile')
args = parser.parse_args() args = parser.parse_args()
def pack_hdr_bytes(hdr):
return c.string_at(c.byref(hdr), c.sizeof(hdr))
with open(args.outfile, 'wb') as fptr: with open(args.outfile, 'wb') as fptr:
idx = 0 idx = 0
for pkt in stream.PacketStream(open(args.pdsfile)): for pkt in stream.jpss_packet_stream(open(args.pdsfile)):
h1 = pkt.primary_header h1 = pkt.primary_header
h2 = pkt.secondary_header h2 = pkt.secondary_header
if h2: if h2:
h1.data_length_minus1 = c.sizeof(h2) - 1 h1.data_length_minus1 = c.sizeof(h2)
fptr.write(h1) fptr.write(h1)
if pkt.stamp:
h2.packet_count = 0
fptr.write(h2) fptr.write(h2)
fptr.write('\xff')
else: else:
h1.data_length_minus1 = 0 h1.data_length_minus1 = 0
fptr.write(h1) fptr.write(h1)
fptr.write('x') fptr.write('\xff')
idx += 1 idx += 1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment