X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=decoders%2Fatsha204a%2Fpd.py;h=9f66c85c382dab58af72751c35c44e0ea6a3b716;hp=d149c497a42195b9ee94f6f94f186dda7f0fa715;hb=HEAD;hpb=9e23c0982cd1a902f0ec1d6fe64a5cb4ca4e981b;ds=sidebyside diff --git a/decoders/atsha204a/pd.py b/decoders/atsha204a/pd.py index d149c49..9f66c85 100644 --- a/decoders/atsha204a/pd.py +++ b/decoders/atsha204a/pd.py @@ -97,7 +97,7 @@ class Decoder(srd.Decoder): id = 'atsha204a' name = 'ATSHA204A' longname = 'Microchip ATSHA204A' - desc = 'Microchip ATSHA204A crypto authentication protocol.' + desc = 'Microchip ATSHA204A family crypto authentication protocol.' license = 'gplv2+' inputs = ['i2c'] outputs = [] @@ -114,8 +114,8 @@ class Decoder(srd.Decoder): ('warning', 'Warning'), ) annotation_rows = ( - ('frame', 'Frame', (0, 1, 2, 3, 4, 5, 6)), - ('status', 'Status', (7,)), + ('frame', 'Frames', (0, 1, 2, 3, 4, 5, 6)), + ('status-vals', 'Status', (7,)), ('warnings', 'Warnings', (8,)), ) @@ -246,8 +246,8 @@ class Decoder(srd.Decoder): elif op == OPCODE_DERIVE_KEY: self.putz(s[0][0], s[31][1], [5, ['MAC: %s' % ' '.join(format(i[2], '02x') for i in s)]]) elif op == OPCODE_ECDH: - self.putz(s[0][0], s[31][1], [5, ['Pub X: %s' % ' '.join(format(i[2], '02x') for i in s[0:32])]]) - self.putz(s[32][0], s[63][1], [5, ['Pub Y: %s' % ' '.join(format(i[2], '02x') for i in s[32:64])]]) + self.putz(s[0][0], s[31][1], [5, ['Pub X: %s' % ' '.join(format(i[2], '02x') for i in s[0:32])]]) + self.putz(s[32][0], s[63][1], [5, ['Pub Y: %s' % ' '.join(format(i[2], '02x') for i in s[32:64])]]) elif op in (OPCODE_GEN_DIG, OPCODE_GEN_KEY): self.putz(s[0][0], s[3][1], [5, ['OtherData: %s' % ' '.join(format(i[2], '02x') for i in s)]]) elif op == OPCODE_MAC: @@ -287,7 +287,6 @@ class Decoder(srd.Decoder): def decode(self, ss, es, data): cmd, databyte = data - # State machine. if self.state == 'IDLE': # Wait for an I²C START condition. @@ -309,7 +308,8 @@ class Decoder(srd.Decoder): # Reset the opcode before received data, as this causes # responses to be displayed incorrectly. self.opcode = -1 - self.output_rx_bytes() + if len(self.bytes) > 0: + self.output_rx_bytes() self.waddr = -1 self.bytes = [] self.state = 'IDLE' @@ -321,4 +321,3 @@ class Decoder(srd.Decoder): self.output_tx_bytes() self.bytes = [] self.state = 'IDLE' -