HackRF-Treasure-Chest/Software/portapack-mayhem/hackrf/firmware/dfu.py

9 lines
231 B
Python
Raw Permalink Normal View History

2022-09-22 18:26:57 +02:00
import os.path
import struct
import sys
with open("_header.bin", "wb") as f:
x = struct.pack('<H', os.path.getsize(sys.argv[1] + '_dfu.bin') // 512 + 1)
y = [0xda, 0xff, x[0], x[1]] + [0xff] * 12
f.write(bytearray(y))