Skip to content

Commit 5239552

Browse files
author
w
committed
unhowitzer: ExpectManifest and sunxi-fel
1 parent 4b00c19 commit 5239552

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

print-chp.py

+6
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,9 @@ def format_snippet(snippet):
3535
print('ExpectWrite (0x%8X) >> %s' % (l2, format_snippet(snippet)))
3636
elif command == 4:
3737
print('Usleep %d' % l1)
38+
elif command == 5:
39+
manifest = chp[pos:pos+l2]
40+
pos += l2
41+
print('ExpectManifest %r' % manifest.decode('ascii'))
42+
else:
43+
raise ValueError

unhowitzer.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def discard(i):
3434
HeaderExpectRead = collections.namedtuple('HeaderExpectRead', ['start', 'end'])
3535
HeaderExpectWrite = collections.namedtuple('HeaderExpectWrite', ['start', 'end'])
3636
HeaderUsleep = collections.namedtuple('HeaderUsleep', ['duration'])
37+
HeaderExpectManifest = collections.namedtuple('HeaderExpectManifest', ['start', 'end'])
3738

3839
def parse_headers(source):
3940
pos = 0
@@ -55,6 +56,9 @@ def parse_headers(source):
5556
pos += l2
5657
elif command == 4:
5758
yield HeaderUsleep(l1)
59+
elif command == 5:
60+
yield HeaderExpectManifest(pos, pos + l2)
61+
pos += l2
5862
else:
5963
raise ValueError('unsupported command %d' % command)
6064

@@ -229,7 +233,7 @@ def handle(source, magic, comment, io_headers):
229233
comment_bytes = source[comment.start:comment.end]
230234
# print(comment_bytes.decode('ascii')) # %%%
231235
words = comment_bytes.split(b', ')
232-
if words[0] == b'fel':
236+
if words[0] == b'fel' or words[0] == b'sunxi-fel':
233237
return handle_fel(source, words, io_headers)
234238
elif words[0] == b'fastboot' or words[0] == b'/usr/local/bin/fastboot':
235239
return handle_fastboot(source, words, io_headers)

0 commit comments

Comments
 (0)