DbgMuxPeer: calculate and check the FCS of Rx frames
parent
e71875aa12
commit
138af0da7a
8
peer.py
8
peer.py
|
@ -77,6 +77,14 @@ class DbgMuxPeer:
|
|||
c['TxCount'], c['RxCount'], c['FCS'],
|
||||
c['MsgType'], c['MsgData'].hex())
|
||||
|
||||
# Re-calculate and check the FCS
|
||||
fcs = DbgMuxFrame.fcs_func(frame[:-2])
|
||||
if fcs != c['FCS']:
|
||||
log.error('Rx frame (Ns=%03u, Nr=%03u) with bad FCS: '
|
||||
'indicated 0x%04x != calculated 0x%04x',
|
||||
c['TxCount'], c['RxCount'], c['FCS'], fcs)
|
||||
# TODO: NACK this frame?
|
||||
|
||||
# Parse the inner message
|
||||
c['Msg'] = DbgMuxFrame.Msg.parse(c['MsgData'], MsgType=c['MsgType'])
|
||||
|
||||
|
|
Loading…
Reference in New Issue