X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=decoders%2Fedid%2Fedid.py;h=6d53bf1a609baac4d2d4b894d1e0ce99019bc37b;hp=b3ca128f5bcbbd2be20bb88655b3de31f68221e5;hb=2a706c20b73ea466a16c7f5ae6a8b0d44e470053;hpb=91b2e171b0e84764f078414cd9445a0133bd653f diff --git a/decoders/edid/edid.py b/decoders/edid/edid.py index b3ca128..6d53bf1 100644 --- a/decoders/edid/edid.py +++ b/decoders/edid/edid.py @@ -17,15 +17,9 @@ ## along with this program; if not, see . ## -''' -EDID 1.3 structure decoder. - -Details: -https://en.wikipedia.org/wiki/Extended_display_identification_data -''' - # TODO: # - EDID < 1.3 +# - add short annotations # - Signal level standard field in basic display parameters block # - Additional color point descriptors # - Additional standard timing descriptors @@ -34,6 +28,7 @@ https://en.wikipedia.org/wiki/Extended_display_identification_data import sigrokdecode as srd import os + EDID_HEADER = [0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00] OFF_VENDOR = 8 OFF_VERSION = 18 @@ -45,7 +40,6 @@ OFF_DET_TIMING = 54 OFF_NUM_EXT = 126 OFF_CHECKSUM = 127 - # Pre-EDID established timing modes est_modes = [ "720x400@70Hz", @@ -79,6 +73,7 @@ xy_ratio = [ ANN_FIELDS = 0 ANN_SECTIONS = 1 + class Decoder(srd.Decoder): api_version = 1 id = 'edid' @@ -112,6 +107,8 @@ class Decoder(srd.Decoder): self.cnt += 1 self.sn.append( [ss, es] ) self.cache.append(data) + # debug +# self.put(ss, es, self.out_ann, [0, ["%d: [%.2x]" % (self.cnt, data)]]) if self.state is None: # Wait for the EDID header @@ -120,6 +117,7 @@ class Decoder(srd.Decoder): # Throw away any garbage before the header self.sn = self.sn[-8:] self.cache = self.cache[-8:] + self.cnt = 8 self.state = 'edid' self.put(ss, es, self.out_ann, [0, ["EDID header"]]) elif self.state == 'edid': @@ -161,7 +159,7 @@ class Decoder(srd.Decoder): self.put(self.sn[start][0], self.sn[end][1], self.out_ann, [ANN_FIELDS, [annotation]]) def lookup_pnpid(self, pnpid): - pnpid_file = os.path.dirname(__file__) + '/pnpids.txt' + pnpid_file = os.path.join(os.path.dirname(__file__), 'pnpids.txt') if os.path.exists(pnpid_file): for line in open(pnpid_file).readlines(): if line.find(pnpid + ';') == 0: @@ -406,7 +404,7 @@ class Decoder(srd.Decoder): + (posneg[sync2 & 0x01]) + ')' elif sync == 0x03: features += 'digital separate (' - features += 'Vsync polarity ' + (posneg[sync2 >> 1]) + features += 'Vsync polarity ' + (posneg[(sync2 & 0x02) >> 1]) features += ', Hsync polarity ' + (posneg[sync2 & 0x01]) features += ')' features += ', ' @@ -461,7 +459,7 @@ class Decoder(srd.Decoder): if self.cache[i] != 0 and self.cache[i+1] != 0: self.decode_detailed_timing(i) else: - if self.cache[i+2] == 0 or self.cache[i+4] == 0 or True: + if self.cache[i+2] == 0 or self.cache[i+4] == 0: self.decode_descriptor(i)