diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2013-12-03 14:46:23 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2013-12-03 14:54:28 +0100 |
commit | 8705ddc81b001d7f79ed94e9aa34b792cfdd4481 (patch) | |
tree | b420400648571333bd5fe3af46aa3aa93cbfe5ac /decoders/uart | |
parent | 169f42726fcd44ca9a98c914b835ae6ff31295c3 (diff) | |
download | libsigrokdecode-8705ddc81b001d7f79ed94e9aa34b792cfdd4481.tar.gz libsigrokdecode-8705ddc81b001d7f79ed94e9aa34b792cfdd4481.zip |
uart: Display non-ASCII characters properly.
We use the [XX] notation for non-printable characters, which is what
various other logic analyzer software packages do too, e.g. the
CWAV USBee Suite.
This fixes bug #201.
Diffstat (limited to 'decoders/uart')
-rw-r--r-- | decoders/uart/pd.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/decoders/uart/pd.py b/decoders/uart/pd.py index f010480..d71fc23 100644 --- a/decoders/uart/pd.py +++ b/decoders/uart/pd.py @@ -222,7 +222,8 @@ class Decoder(srd.Decoder): b, f = self.databyte[rxtx], self.options['format'] if f == 'ascii': - self.putx(rxtx, [rxtx, [chr(b)]]) + c = chr(b) if chr(b).isprintable() else '[%02X]' % b + self.putx(rxtx, [rxtx, [c]]) elif f == 'dec': self.putx(rxtx, [rxtx, [str(b)]]) elif f == 'hex': |