summaryrefslogtreecommitdiff
path: root/dimms/gen_spd_bin.py
diff options
context:
space:
mode:
authorGuillaume Knispel <gknispel@proformatique.com>2012-03-29 16:50:28 +0200
committerGuillaume Knispel <gknispel@proformatique.com>2012-03-29 16:50:28 +0200
commitb6fab912b3c98d4cb9d381fde656c7aad0e45b24 (patch)
tree2fd1f623c068d4dba4ca5eaddda9796d260547ab /dimms/gen_spd_bin.py
parent988a70325443162da997608a0764b3b978b825fe (diff)
parse datasheet and dimms
Diffstat (limited to 'dimms/gen_spd_bin.py')
-rwxr-xr-xdimms/gen_spd_bin.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/dimms/gen_spd_bin.py b/dimms/gen_spd_bin.py
new file mode 100755
index 0000000..a7d154f
--- /dev/null
+++ b/dimms/gen_spd_bin.py
@@ -0,0 +1,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()