X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fhdcp%2Fpd.py;h=157b23a3dba44d9a52d3befd75639f2b9ab2a37e;hb=9ade72a24f1a2c682377649ff7fb8c65393b805b;hp=38ea99a4f8aac1c935963a299391850ec89dc54a;hpb=4abd552b354cedc416c19722c7264292f29a9ca9;p=libsigrokdecode.git diff --git a/decoders/hdcp/pd.py b/decoders/hdcp/pd.py index 38ea99a..157b23a 100644 --- a/decoders/hdcp/pd.py +++ b/decoders/hdcp/pd.py @@ -1,7 +1,7 @@ ## ## This file is part of the libsigrokdecode project. ## -## Copyright (C) 2018 Dave Craig +## Copyright (C) 2018 Dave Craig ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -73,11 +73,11 @@ class Decoder(srd.Decoder): annotations = \ tuple(('message-0x%02X' % i, 'Message 0x%02X' % i) for i in range(18)) + ( ('summary', 'Summary'), - ('warnings', 'Warnings'), + ('warning', 'Warning'), ) annotation_rows = ( ('messages', 'Messages', tuple(range(18))), - ('summary', 'Summary', (18,)), + ('summaries', 'Summaries', (18,)), ('warnings', 'Warnings', (19,)), ) @@ -144,40 +144,45 @@ class Decoder(srd.Decoder): if cmd in ('STOP', 'NACK'): self.es_block = es self.state = 'IDLE' - if self.type != '': - if self.stack: - if self.type == 'RxStatus': - rxstatus = (self.stack.pop() << 8) | self.stack.pop() - reauth_req = (rxstatus & 0x800) != 0 - ready = (rxstatus & 0x400) != 0 - length = rxstatus & 0x3ff - text = '%s, reauth %s, ready %s, length %s' % (self.type, reauth_req, ready, length) - self.putb([18, [text]]) - elif self.type == '1.4 Bstatus': - bstatus = (self.stack.pop() << 8) | self.stack.pop() - device_count = bstatus & 0x7f - max_devs_exceeded = (bstatus & 0x80) != 0 - depth = ((bstatus & 0x700) >> 8) - max_cascase_exceeded = bstatus & 0x800 - hdmi_mode = (bstatus & 0x1000) != 0 - text = '%s, %s devices, depth %s, hdmi mode %s' % (self.type, device_count, depth, hdmi_mode) - self.putb([18, [text]]) - elif self.type == 'Read_Message': - msg = self.stack.pop(0) - self.putb([msg, ['%s, %s' % (self.type, msg_ids.get(msg, 'Invalid'))]]) - elif self.type == 'Write_Message': - msg = self.stack.pop(0) - self.putb([msg, ['%s, %s' % (self.type, msg_ids.get(msg, 'Invalid'))]]) - elif self.type == 'HDCP2Version': - version = self.stack.pop(0) - if (version & 0x4): - self.putb([18, ['HDCP2']]) - else: - self.putb([18, ['NOT HDCP2']]) - else: - self.putb([18, ['%s' % (self.type)]]) + if self.type == '': + return + if not self.stack: + self.putb([18, ['%s' % (self.type)]]) + return + if self.type == 'RxStatus': + rxstatus = (self.stack.pop() << 8) | self.stack.pop() + reauth_req = (rxstatus & 0x800) != 0 + ready = (rxstatus & 0x400) != 0 + length = rxstatus & 0x3ff + text = '%s, reauth %s, ready %s, length %s' % \ + (self.type, reauth_req, ready, length) + self.putb([18, [text]]) + elif self.type == '1.4 Bstatus': + bstatus = (self.stack.pop() << 8) | self.stack.pop() + device_count = bstatus & 0x7f + max_devs_exceeded = (bstatus & 0x80) != 0 + depth = ((bstatus & 0x700) >> 8) + max_cascase_exceeded = bstatus & 0x800 + hdmi_mode = (bstatus & 0x1000) != 0 + text = '%s, %s devices, depth %s, hdmi mode %s' % \ + (self.type, device_count, depth, hdmi_mode) + self.putb([18, [text]]) + elif self.type == 'Read_Message': + msg = self.stack.pop(0) + self.putb([msg, ['%s, %s' % (self.type, + msg_ids.get(msg, 'Invalid'))]]) + elif self.type == 'Write_Message': + msg = self.stack.pop(0) + self.putb([msg, ['%s, %s' % (self.type, + msg_ids.get(msg, 'Invalid'))]]) + elif self.type == 'HDCP2Version': + version = self.stack.pop(0) + if (version & 0x4): + self.putb([18, ['HDCP2']]) else: - self.putb([18, ['%s' % (self.type)]]) + self.putb([18, ['NOT HDCP2']]) + else: + self.putb([18, ['%s' % (self.type)]]) elif cmd == 'DATA READ': # Stack up our data bytes. self.stack.append(databyte)