Underscores in number literals are a recent Python feature which only
was introduced in version 3.6. The sigrok project claims compatibility
with previous Python versions, but the signature decoder fails to load
with this error:
$ pulseview
srd: SyntaxError: Failed to load decoder signature: import by name failed: invalid syntax (pd.py, line 138)
srd: Traceback (most recent call last):
File "/home/user/share/libsigrokdecode/decoders/signature/__init__.py", line 25, in <module>
from .pd import Decoder
File "/home/user/share/libsigrokdecode/decoders/signature/pd.py", line 138
incoming = (bin(shiftreg & 0b0000_0010_1001_0001).count('1') + data) & 1
^
SyntaxError: invalid syntax
Use the more compact hex presentation for a magic binary pattern. This
obsoletes the necessity to separate groups of bits for readability.
started = False
else:
self.putb(last_samplenum, [data, [str(data)]])
- incoming = (bin(shiftreg & 0b0000_0010_1001_0001).count('1') + data) & 1
+ incoming = (bin(shiftreg & 0x0291).count('1') + data) & 1
shiftreg = (incoming << 15) | (shiftreg >> 1)
prev_start = start
prev_stop = stop