mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-08-10 15:40:03 -04:00
USB: move firmware for usb-to-serial MCU (CH552)
Change links to the new ch552_fw directory.
This commit is contained in:
parent
c271b48a53
commit
354aecbed6
17 changed files with 3 additions and 3 deletions
28
hw/usb_interface/ch552_fw/inject_serial_number.py
Executable file
28
hw/usb_interface/ch552_fw/inject_serial_number.py
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env python3
|
||||
import uuid
|
||||
import argparse
|
||||
import encode_usb_strings
|
||||
|
||||
|
||||
magic = encode_usb_strings.string_to_descriptor("68de5d27-e223-4874-bc76-a54d6e84068f")
|
||||
replacement = encode_usb_strings.string_to_descriptor(str(uuid.uuid4()))
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(description='CH552 USB serial number injector. Replaces the default UUID with a randomly generated UUID4')
|
||||
parser.add_argument('-i', required=True, help='input file')
|
||||
parser.add_argument('-o', required=True, help='output file')
|
||||
args = parser.parse_args()
|
||||
|
||||
f = bytearray(open(args.i, 'rb').read())
|
||||
|
||||
pos = f.find(magic)
|
||||
|
||||
if pos < 0:
|
||||
print('failed to find magic string')
|
||||
exit(1)
|
||||
|
||||
f[pos:(pos+len(magic))] = replacement
|
||||
|
||||
with open(args.o, 'wb') as of:
|
||||
of.write(f)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue