-
Notifications
You must be signed in to change notification settings - Fork 1
/
pro93-dump
executable file
·40 lines (37 loc) · 927 Bytes
/
pro93-dump
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
import serial
import time
import sys
import datetime
serial_options = {
'port':'/dev/ttyUSB0',
'baudrate':4800,
'bytesize':8,
'parity':'E',
'stopbits':2,
'timeout':None,
'xonxoff':False,
'rtscts':False,
'dsrdtr':True
}
with serial.Serial(**serial_options) as port:
port.write(b'\xcd')
time.sleep(0.1)
echo = port.read()
if echo != b'\xcd':
print(f"Couldn't read echo of \\xcd; read {echo}")
sys.exit(1)
# Preämble?
print(port.read(50).hex())
# Some stuff?
print(port.read(4).hex())
image = bytearray()
for i in range(633):
message = port.read(32)
image.extend(message)
print(f"read {i} message")
# Dump is done backwards for some reason
image = image[::-1]
dt = datetime.datetime.now().isoformat()
with open(f"pro93-dump-{dt}.bin", "wb+") as f:
f.write(image)