File: dfu.py

package info (click to toggle)
hackrf 2026.01.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 38,216 kB
  • sloc: ansic: 60,696; python: 6,072; xml: 3,424; perl: 2,730; makefile: 601; asm: 514; vhdl: 319; sh: 179; awk: 20
file content (8 lines) | stat: -rw-r--r-- 231 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
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))