aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-12-03 17:47:36 -0700
committerSelene ToyKeeper2023-12-03 17:47:36 -0700
commit8e86d66238572c1d97cd54a592da0573a51892a1 (patch)
tree51d92217b27b10399d78f890465067c6637686a7 /bin
parentfw3x: document how it ships with the wrong fuse values, and how to fix it (diff)
downloadanduril-8e86d66238572c1d97cd54a592da0573a51892a1.tar.gz
anduril-8e86d66238572c1d97cd54a592da0573a51892a1.tar.bz2
anduril-8e86d66238572c1d97cd54a592da0573a51892a1.zip
updated MODELS, bin/models.py, and hw/BRANDS...
- changed column order to (model, mcu, name) - changed column sizes (auto-sized w/ 2 spaces between columns) - made it handle hex digits in model numbers - reserved 1900 to 2199 for years only, not model numbers - noted gChart and thefreeman sharing a brand ID
Diffstat (limited to 'bin')
-rwxr-xr-xbin/models.py33
1 files changed, 29 insertions, 4 deletions
diff --git a/bin/models.py b/bin/models.py
index 8e54d1c..1a1152e 100755
--- a/bin/models.py
+++ b/bin/models.py
@@ -24,12 +24,18 @@ def main(args):
foo.sort()
models = [x[-1] for x in foo]
+ colsizes = [
+ max(len(m.model) for m in models),
+ max(len(m.mcu) for m in models),
+ max(len(m.name) for m in models),
+ ]
+
print('Models: %i\n' % len(models))
- fmt = '%s\t%-30s\t%s'
- print(fmt % ('Model', 'Name', 'MCU'))
- print(fmt % ('-----', '----', '---'))
+ fmt = '%%-%is %%-%is %%s' % (colsizes[0], colsizes[1])
+ print(fmt % ('Model', 'MCU', 'Name'))
+ print(fmt % ('-----', '---', '----'))
for m in models:
- print(fmt % (m.model, m.name, m.mcu))
+ print(fmt % (m.model, m.mcu, m.name))
print('\nDuplicates:')
for i, m in enumerate(models):
@@ -56,6 +62,7 @@ def load_model(path):
m.name = path.replace('hw/','').replace('/', '-')
m.mcu = inherit(path, 'arch')
m.model = inherit(path, 'model')
+ if m.model: m.model = model_translate(m.model)
return m
@@ -73,6 +80,24 @@ def inherit(path, field):
return None
+def model_translate(m):
+ """Convert raw ordinal hex codes into human-friendly a-f digits.
+ """
+ m = str(m)
+ replace = {
+ chr(ord('0') + 10): 'a',
+ chr(ord('0') + 11): 'b',
+ chr(ord('0') + 12): 'c',
+ chr(ord('0') + 13): 'd',
+ chr(ord('0') + 14): 'e',
+ chr(ord('0') + 15): 'f',
+ }
+ for s, r in replace.items():
+ m = m.replace(s, r)
+
+ return m
+
+
if __name__ == "__main__":
import sys
main(sys.argv[1:])
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.