fgsect/scat

sdm: Magic header check fails

handymenny opened this issue · 5 comments

Some scat users have pointed out to me that the magic header check often fails:

print('Skipping packet as magic does not match')

Gathering some info, this table came up:

Model Modem ICD Log Type Magic header check Magic2 header
A30 A307F S327 5.32 usb dm KO 0x0172
A40 A405F S327 5.32 usb dm KO 0x0173
S6 G925F S333 4.91 usb dm KO 0x0172
S9 G960F S360 5.33 usb dm KO 0x0175
S9 G965F S360 5.33 cplog KO 0x0000
Note 9 N960B S360 5.33 usb dm OK 0x0174
Note 10 N976B S5100 6.10 usb dm KO 0x0172
S20 G981B S5123 6.07 usb dm KO 0x0172
S21 G998B S5123A 6.15 silent log KO 0x0177
S21 G996B S5123A 6.22 silent log KO 0x0183
S22 S908B S5133 7.00 silent log KO 0x0184
Pixel 7a S5300 7.01 vendor log KO 0x0188
Pixel 7 S5300 7.01 vendor log OK 0x0186
Pixel 6a S5123 // vendor log KO //
Pixel 6a S5123 6.22 vendor log OK 0x0186
Pixel 6 S5123 6.22 triggered manually from adb KO 0x017c

Note that only one sample has been tested for each row and it looks like different logs of the same (or similar) device may get different results.

What do you think about turning that skip into a warning?
In all these cases disabling that check made the parser do its job (except some issues with timestamps similar to #73)

Thanks for the extensive research. I also found that even on the same device the second "magic" check changes on the same device with baseband/system firmware update. As I was not sure on how to deal with it, I think I can change the check to just debug information instead of adding all possible values..

I have updated the table adding the magic2 header.
Looks like some kind of versioning? Older logs have lower values

Then it will be better to skip the check, as this value is not used in parsing anyway.

Disabled check through 034248c.

I did further research, that magic is a timestamp 🙃

length: ac 01
magic: 39 7f
timestamp1: b3 80 8a 85 72 01 = 1591378346163 = Friday 5 June 2020 17:32:26.163
seqnr: 05 29
direction: a0
group: 22
command: 52 
timestamp2: 3c a6 fa 1d = 502965820 = 503s (since modem boot? since log start?)
payload: ...