import sys, libusb1, ctypes, struct BLOCK_SIZE = 512 CHUNK_SIZE = 0xfffe00 MAX_PAYLOAD_SIZE = (BLOCK_SIZE - 10) # 512, - 10 for ready (4), size (4), footer (2) DL_BUFFER_START = 0x02021800 DL_BUFFER_SIZE = 0x4E800 #max allowed/usable size within the buffer, with end at 0x02070000 BOOTROM_START = 0x0 BOOTROM_SIZE = 0x20000 #128Kb TARGET_OFFSETS = { # XFER_BUFFER, RA_PTR, XFER_END_SIZE "8890": (0x02021800, 0x02020F08, 0x02070000), #0x206ffff on exynos 8890 "8895": (0x02021800, 0x02020F18, 0x02070000) } ENDPOINT_BULK_IN = 0x81 ENDPOINT_BULK_OUT = 0x2 def p32(x): return struct.pack("