erpt: add new IDs/categories

This commit is contained in:
Michael Scire 2024-03-28 03:51:10 -07:00 committed by SciresM
parent 4ff9278d11
commit d2c2a94c5e
2 changed files with 851 additions and 825 deletions

View file

@ -180,6 +180,7 @@
HANDLER(EthernetAdapterOUIInfo, 139 ) \ HANDLER(EthernetAdapterOUIInfo, 139 ) \
HANDLER(NANDTypeInfo, 140 ) \ HANDLER(NANDTypeInfo, 140 ) \
HANDLER(MicroSDTypeInfo, 141 ) \ HANDLER(MicroSDTypeInfo, 141 ) \
HANDLER(TestNx, 1000) \
#define AMS_ERPT_FOREACH_FIELD(HANDLER) \ #define AMS_ERPT_FOREACH_FIELD(HANDLER) \
HANDLER(TestU64, 0, Test, FieldType_NumericU64, FieldFlag_None ) \ HANDLER(TestU64, 0, Test, FieldType_NumericU64, FieldFlag_None ) \
@ -863,4 +864,18 @@
HANDLER(MicroSDType, 678, MicroSDTypeInfo, FieldType_U8Array, FieldFlag_None ) \ HANDLER(MicroSDType, 678, MicroSDTypeInfo, FieldType_U8Array, FieldFlag_None ) \
HANDLER(GameCardLastDeactivateReasonResult, 679, GameCardErrorInfo, FieldType_NumericU32, FieldFlag_None ) \ HANDLER(GameCardLastDeactivateReasonResult, 679, GameCardErrorInfo, FieldType_NumericU32, FieldFlag_None ) \
HANDLER(GameCardLastDeactivateReason, 680, GameCardErrorInfo, FieldType_NumericU8, FieldFlag_None ) \ HANDLER(GameCardLastDeactivateReason, 680, GameCardErrorInfo, FieldType_NumericU8, FieldFlag_None ) \
HANDLER(InvalidErrorCode, 681, ErrorInfo, FieldType_String, FieldFlag_None ) \
HANDLER(TestStringNx, 1000, TestNx, FieldType_String, FieldFlag_None ) \
HANDLER(BoostModeCurrentLimit, 1001, BatteryChargeInfo, FieldType_NumericI32, FieldFlag_None ) \
HANDLER(ChargeConfiguration, 1002, BatteryChargeInfo, FieldType_NumericI32, FieldFlag_None ) \
HANDLER(HizMode, 1003, BatteryChargeInfo, FieldType_Bool, FieldFlag_None ) \
HANDLER(PowerSupplyPath, 1004, BatteryChargeInfo, FieldType_NumericI32, FieldFlag_None ) \
HANDLER(ControllerPowerSupplyAcquired, 1005, BatteryChargeInfo, FieldType_Bool, FieldFlag_None ) \
HANDLER(OtgRequested, 1006, BatteryChargeInfo, FieldType_Bool, FieldFlag_None ) \
HANDLER(AdspExceptionRegisters, 1007, AdspErrorInfo, FieldType_U32Array, FieldFlag_None ) \
HANDLER(AdspExceptionSpsr, 1008, AdspErrorInfo, FieldType_NumericU32, FieldFlag_None ) \
HANDLER(AdspExceptionArmModeRegisters, 1009, AdspErrorInfo, FieldType_U32Array, FieldFlag_None ) \
HANDLER(AdspExceptionStackAddress, 1010, AdspErrorInfo, FieldType_NumericU32, FieldFlag_None ) \
HANDLER(AdspExceptionStackDump, 1011, AdspErrorInfo, FieldType_U32Array, FieldFlag_None ) \
HANDLER(AdspExceptionReason, 1012, AdspErrorInfo, FieldType_NumericU32, FieldFlag_None ) \

View file

@ -238,6 +238,7 @@ CATEGORIES = {
139 : 'EthernetAdapterOUIInfo', 139 : 'EthernetAdapterOUIInfo',
140 : 'NANDTypeInfo', 140 : 'NANDTypeInfo',
141 : 'MicroSDTypeInfo', 141 : 'MicroSDTypeInfo',
1000 : 'TestNx',
} }
FIELD_TYPES = { FIELD_TYPES = {
@ -408,6 +409,14 @@ def find_flags(full, num_fields, magic_idx):
ind = full.index(KNOWN) - magic_idx ind = full.index(KNOWN) - magic_idx
return list(up('<'+'B'*num_fields, full[ind:ind+num_fields])) return list(up('<'+'B'*num_fields, full[ind:ind+num_fields]))
def find_id_array(full, num_fields, magic_idx, table_format):
if table_format == 0:
return list(range(num_fields))
else:
KNOWN = pk('<IIIIII', *range(444, 450))
ind = full.index(KNOWN) - 4 * magic_idx
return list(up('<' + 'I'*num_fields, full[ind:ind+4*num_fields]))
def cat_to_string(c): def cat_to_string(c):
return CATEGORIES[c] if c in CATEGORIES else 'Category_Unknown%d' % c return CATEGORIES[c] if c in CATEGORIES else 'Category_Unknown%d' % c
@ -430,6 +439,8 @@ def main(argc, argv):
cats = find_categories(full, NUM_FIELDS) cats = find_categories(full, NUM_FIELDS)
types = find_types(full, NUM_FIELDS) types = find_types(full, NUM_FIELDS)
flags = find_flags(full, NUM_FIELDS, fields.index('TestStringEncrypt') - 1) flags = find_flags(full, NUM_FIELDS, fields.index('TestStringEncrypt') - 1)
ids = find_id_array(full, NUM_FIELDS, fields.index('TestStringEncrypt'), table_format)
assert ids[:4] == [0, 1, 2, 3]
print 'Identified %d fields.' % NUM_FIELDS print 'Identified %d fields.' % NUM_FIELDS
mf = max(len(s) for s in fields) mf = max(len(s) for s in fields)
mc = max(len(cat_to_string(c)) for c in cats) mc = max(len(cat_to_string(c)) for c in cats)
@ -453,8 +464,8 @@ def main(argc, argv):
out.write('\n') out.write('\n')
out.write('#define AMS_ERPT_FOREACH_FIELD(HANDLER) \\\n') out.write('#define AMS_ERPT_FOREACH_FIELD(HANDLER) \\\n')
for i in xrange(NUM_FIELDS): for i in xrange(NUM_FIELDS):
f, c, t, l = fields[i], cats[i], types[i], flags[i] f, c, t, l, d = fields[i], cats[i], types[i], flags[i], ids[i]
out.write((' HANDLER(%%-%ds %%-4s %%-%ds %%-%ds %%-%ds) \\\n' % (mf+1, mc+1, mt+1, ml)) % (f+',', '%d,'%i, cat_to_string(c)+',', typ_to_string(t)+',', flg_to_string(l))) out.write((' HANDLER(%%-%ds %%-4s %%-%ds %%-%ds %%-%ds) \\\n' % (mf+1, mc+1, mt+1, ml)) % (f+',', '%d,'%d, cat_to_string(c)+',', typ_to_string(t)+',', flg_to_string(l)))
out.write('\n') out.write('\n')
return 0 return 0