mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-23 19:38:05 +11:00
Fix broken uploadb.py
putc didn't work well with any byte value on most terminal configuration. It was a bad idea...
This commit is contained in:
parent
270ad926c9
commit
30a0f69101
@ -47,14 +47,26 @@ def main():
|
||||
|
||||
for i, c in enumerate(fcontents):
|
||||
c = bytes([c])
|
||||
print('.', end='', flush=True)
|
||||
for _ in range(5): # try 5 times
|
||||
sendcmd(fd, 'getc')
|
||||
os.write(fd, c)
|
||||
os.read(fd, 2) # read prompt
|
||||
sendcmd(fd, 'putc a')
|
||||
sendcmd(fd, 'print a')
|
||||
s = b''
|
||||
while True:
|
||||
r = os.read(fd, 1) # putc result
|
||||
os.read(fd, 2) # read prompt
|
||||
if r != c:
|
||||
print(f"Mismatch at byte {i}! {c} != {r}")
|
||||
if not r.isdigit():
|
||||
break
|
||||
s += r
|
||||
os.read(fd, 3) # read prompt
|
||||
if int(s) == c[0]:
|
||||
break
|
||||
else:
|
||||
print(f"Mismatch at byte {i}! {c} != {r}. Retrying")
|
||||
else:
|
||||
print("Maximum retries reached, abort")
|
||||
return 1
|
||||
sendcmd(fd, 'poke m a')
|
||||
os.read(fd, 2) # read prompt
|
||||
sendcmd(fd, 'm=m+1')
|
||||
|
Loading…
Reference in New Issue
Block a user