Added analysis of component firmwares (SKU, version).
This commit is contained in:
parent
4988fc7b63
commit
0eb98341e6
18
grmn/tlv.py
18
grmn/tlv.py
@ -44,7 +44,10 @@ class TLV:
|
|||||||
new_tlv = TLV6(type_id, length)
|
new_tlv = TLV6(type_id, length)
|
||||||
elif type_id == 0x0007:
|
elif type_id == 0x0007:
|
||||||
new_tlv = TLV7(type_id, length)
|
new_tlv = TLV7(type_id, length)
|
||||||
elif type_id in [0x0008, 0x0401, 0x0505, 0x0555, 0x0557, 0x02bd]:
|
elif type_id == 0x0401:
|
||||||
|
new_tlv = TLVbinary0401(type_id, length)
|
||||||
|
new_tlv.is_binary = True
|
||||||
|
elif type_id in [0x0008, 0x0505, 0x0555, 0x0557, 0x02bd]:
|
||||||
new_tlv = TLVbinary(type_id, length)
|
new_tlv = TLVbinary(type_id, length)
|
||||||
new_tlv.is_binary = True
|
new_tlv.is_binary = True
|
||||||
else:
|
else:
|
||||||
@ -332,3 +335,16 @@ class TLVbinary(TLV):
|
|||||||
valstr = "0x{:08x}".format(v)
|
valstr = "0x{:08x}".format(v)
|
||||||
data.append(("0x{:04x}".format(fid), valstr, fdesc))
|
data.append(("0x{:04x}".format(fid), valstr, fdesc))
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
class TLVbinary0401(TLVbinary):
|
||||||
|
def __str__(self):
|
||||||
|
txt = super().__str__()
|
||||||
|
hdr = unpack("<H", self.value[0:2])[0]
|
||||||
|
if hdr == 0xffff:
|
||||||
|
version = unpack("<H", self.value[4:6])[0]
|
||||||
|
sku = self.value[10:20].decode("utf-8")
|
||||||
|
txt += "\n - SKU: {}-{}-{}".format(sku[0:3], sku[3:8], sku[8:10])
|
||||||
|
txt += "\n - Version: {}".format(version)
|
||||||
|
#if not self.is_parsed:
|
||||||
|
# self.parse()
|
||||||
|
return txt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user