summaryrefslogtreecommitdiff
path: root/decoders/can/pd.py
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2018-04-12 09:02:38 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2018-04-12 13:06:19 +0200
commitcffb6592f4cff804745b8456e2c9f8abc6571603 (patch)
tree516cd9d39d7db5d5cfa10a5e0e2f43a141280985 /decoders/can/pd.py
parentaf0ca734f558aa04c55b15e119a451c85863888a (diff)
downloadlibsigrokdecode-cffb6592f4cff804745b8456e2c9f8abc6571603.tar.gz
libsigrokdecode-cffb6592f4cff804745b8456e2c9f8abc6571603.zip
can: Fix incorrect stuff bit handling.
The decoder assumed a CRC cannot end with a stuffed bit but it actually can, and the CRC delimiter then comes after the stuffed bit. Patch by IRC/github user celeron55, wide testing by PeterMortensen, thanks!
Diffstat (limited to 'decoders/can/pd.py')
-rw-r--r--decoders/can/pd.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/decoders/can/pd.py b/decoders/can/pd.py
index 056736b..d76d649 100644
--- a/decoders/can/pd.py
+++ b/decoders/can/pd.py
@@ -132,7 +132,7 @@ class Decoder(srd.Decoder):
# CAN uses NRZ encoding and bit stuffing.
# After 5 identical bits, a stuff bit of opposite value is added.
# But not in the CRC delimiter, ACK, and end of frame fields.
- if len(self.bits) > self.last_databit + 16:
+ if len(self.bits) > self.last_databit + 17:
return False
last_6_bits = self.rawbits[-6:]
if last_6_bits not in ([0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 0]):