summaryrefslogtreecommitdiff
path: root/dimms/gen_spd_bin.py
blob: a7d154f8d6c171cab70c8c4d7edc426d22ef6c41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/python

import sys
import re

f = None
for line in sys.stdin:
    line = line.strip()
    if line.startswith('00:'):
        if f is not None:
            f.close()
        f = open(prev_line, "wb")
    if re.match(r'[0-9a-f]0: ', line):
        f.write(''.join([chr(int(el, 16)) for el in line[4:].split()]))
    prev_line = line

if f is not None:
    f.close()