From 8705ddc81b001d7f79ed94e9aa34b792cfdd4481 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Tue, 3 Dec 2013 14:46:23 +0100 Subject: 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. --- decoders/uart/pd.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'decoders/uart') 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': -- cgit v1.2.3-70-g09d2