2 ## This file is part of the libsigrokdecode project.
4 ## Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
6 ## This program is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation; either version 3 of the License, or
9 ## (at your option) any later version.
11 ## This program is distributed in the hope that it will be useful,
12 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ## GNU General Public License for more details.
16 ## You should have received a copy of the GNU General Public License
17 ## along with this program; if not, see <http://www.gnu.org/licenses/>.
22 # - add short annotations
23 # - Signal level standard field in basic display parameters block
24 # - Additional color point descriptors
25 # - Additional standard timing descriptors
28 import sigrokdecode as srd
31 EDID_HEADER = [0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00]
42 # Pre-EDID established timing modes
63 # X:Y display aspect ratios, as used in standard timing modes
75 class Decoder(srd.Decoder):
79 longname = 'Extended Display Identification Data'
80 desc = 'Data structure describing display device capabilities.'
84 tags = ['Display', 'Memory', 'PC']
86 ('fields', 'EDID structure fields'),
87 ('sections', 'EDID structure sections'),
90 ('sections', 'Sections', (1,)),
91 ('fields', 'Fields', (0,)),
99 # Received data items, used as an index into samplenum/data
101 # Start/end sample numbers per data item
110 self.ext_cache = [[]]
113 self.out_ann = self.register(srd.OUTPUT_ANN)
115 def decode(self, ss, es, data):
118 if cmd == 'ADDRESS WRITE' and data == 0x50:
119 self.state = 'offset'
123 if cmd == 'ADDRESS READ' and data == 0x50:
124 if self.extension > 0:
125 self.state = 'extensions'
126 s = str(self.extension)
127 t = ["Extension: " + s, "X: " + s, s]
129 self.state = 'header'
131 self.put(ss, es, self.out_ann, [ANN_SECTIONS, t])
134 if cmd == 'DATA WRITE' and self.state == 'offset':
136 self.extension = self.offset // 128
137 self.cnt = self.offset % 128
138 if self.extension > 0:
139 ext = self.extension - 1
140 l = len(self.ext_sn[ext])
141 # Truncate or extend to self.cnt.
142 self.sn = self.ext_sn[ext][0:self.cnt] + [0] * max(0, self.cnt - l)
143 self.cache = self.ext_cache[ext][0:self.cnt] + [0] * max(0, self.cnt - l)
146 self.sn = self.sn[0:self.cnt] + [0] * max(0, self.cnt - l)
147 self.cache = self.cache[0:self.cnt] + [0] * max(0, self.cnt - l)
148 ss = self.ss if self.ss else ss
150 t = ["Offset: " + s, "O: " + s, s]
151 self.put(ss, es, self.out_ann, [ANN_SECTIONS, t])
154 # We only care about actual data bytes that are read (for now).
155 if cmd != 'DATA READ':
159 if self.extension > 0:
160 self.ext_sn[self.extension - 1].append([ss, es])
161 self.ext_cache[self.extension - 1].append(data)
163 self.sn.append([ss, es])
164 self.cache.append(data)
166 if self.state is None or self.state == 'header':
167 # Wait for the EDID header
168 if self.cnt >= OFF_VENDOR:
169 if self.cache[-8:] == EDID_HEADER:
170 # Throw away any garbage before the header
171 self.sn = self.sn[-8:]
172 self.cache = self.cache[-8:]
175 self.put(self.sn[0][0], es, self.out_ann,
176 [ANN_SECTIONS, ['Header']])
177 self.put(self.sn[0][0], es, self.out_ann,
178 [ANN_FIELDS, ['Header pattern']])
179 elif self.state == 'edid':
180 if self.cnt == OFF_VERSION:
183 self.decode_serial(-6)
184 self.decode_mfrdate(-2)
185 self.put(self.sn[OFF_VENDOR][0], es, self.out_ann,
186 [ANN_SECTIONS, ['Vendor/product']])
187 elif self.cnt == OFF_BASIC:
188 self.put(self.sn[OFF_VERSION][0], es, self.out_ann,
189 [ANN_SECTIONS, ['EDID Version']])
190 self.put(self.sn[OFF_VERSION][0], self.sn[OFF_VERSION][1],
191 self.out_ann, [ANN_FIELDS,
192 ['Version %d' % self.cache[-2]]])
193 self.put(self.sn[OFF_VERSION+1][0], self.sn[OFF_VERSION+1][1],
194 self.out_ann, [ANN_FIELDS,
195 ['Revision %d' % self.cache[-1]]])
196 elif self.cnt == OFF_CHROM:
197 self.put(self.sn[OFF_BASIC][0], es, self.out_ann,
198 [ANN_SECTIONS, ['Basic display']])
199 self.decode_basicdisplay(-5)
200 elif self.cnt == OFF_EST_TIMING:
201 self.put(self.sn[OFF_CHROM][0], es, self.out_ann,
202 [ANN_SECTIONS, ['Color characteristics']])
203 self.decode_chromaticity(-10)
204 elif self.cnt == OFF_STD_TIMING:
205 self.put(self.sn[OFF_EST_TIMING][0], es, self.out_ann,
206 [ANN_SECTIONS, ['Established timings']])
207 self.decode_est_timing(-3)
208 elif self.cnt == OFF_DET_TIMING:
209 self.put(self.sn[OFF_STD_TIMING][0], es, self.out_ann,
210 [ANN_SECTIONS, ['Standard timings']])
211 self.decode_std_timing(self.cnt - 16)
212 elif self.cnt == OFF_NUM_EXT:
213 self.decode_descriptors(-72)
214 elif self.cnt == OFF_CHECKSUM:
215 self.put(ss, es, self.out_ann,
216 [0, ['Extensions present: %d' % self.cache[self.cnt-1]]])
217 elif self.cnt == OFF_CHECKSUM+1:
220 checksum += self.cache[i]
221 if checksum % 256 == 0:
225 self.put(ss, es, self.out_ann, [0, ['Checksum: %d (%s)' % (
226 self.cache[self.cnt-1], csstr)]])
227 self.state = 'extensions'
229 elif self.state == 'extensions':
230 cache = self.ext_cache[self.extension - 1]
231 sn = self.ext_sn[self.extension - 1]
232 v = cache[self.cnt - 1]
235 self.put(ss, es, self.out_ann, [1, ['Extensions Tag', 'Tag']])
237 self.put(ss, es, self.out_ann, [1, ['Bad Tag']])
239 self.put(ss, es, self.out_ann, [1, ['Version']])
240 self.put(ss, es, self.out_ann, [0, [str(v)]])
242 self.put(ss, es, self.out_ann, [1, ['DTD offset']])
243 self.put(ss, es, self.out_ann, [0, [str(v)]])
245 self.put(ss, es, self.out_ann, [1, ['Format support | DTD count']])
246 support = "Underscan: {0}, {1} Audio, YCbCr: {2}".format(
247 "yes" if v & 0x80 else "no",
248 "Basic" if v & 0x40 else "No",
249 ["None", "422", "444", "422+444"][(v & 0x30) >> 4])
250 self.put(ss, es, self.out_ann, [0, ['{0}, DTDs: {1}'.format(support, v & 0xf)]])
251 elif self.cnt <= cache[2]:
252 if self.cnt == cache[2]:
253 self.put(sn[4][0], es, self.out_ann, [1, ['Data block collection']])
254 self.decode_data_block_collection(cache[4:], sn[4:])
255 elif (self.cnt - cache[2]) % 18 == 0:
256 n = (self.cnt - cache[2]) / 18
257 if n <= cache[3] & 0xf:
258 self.put(sn[self.cnt - 18][0], es, self.out_ann, [1, ['DTD']])
259 self.decode_descriptors(-18)
261 elif self.cnt == 127:
262 dtd_last = cache[2] + (cache[3] & 0xf) * 18
263 self.put(sn[dtd_last][0], es, self.out_ann, [1, ['Padding']])
264 elif self.cnt == 128:
265 checksum = sum(cache) % 256
266 self.put(ss, es, self.out_ann, [0, ['Checksum: %d (%s)' % (
267 cache[self.cnt-1], 'Wrong' if checksum else 'OK')]])
269 def ann_field(self, start, end, annotation):
270 annotation = annotation if isinstance(annotation, list) else [annotation]
271 sn = self.ext_sn[self.extension - 1] if self.extension else self.sn
272 self.put(sn[start][0], sn[end][1],
273 self.out_ann, [ANN_FIELDS, annotation])
275 def lookup_pnpid(self, pnpid):
276 pnpid_file = os.path.join(os.path.dirname(__file__), 'pnpids.txt')
277 if os.path.exists(pnpid_file):
278 for line in open(pnpid_file).readlines():
279 if line.find(pnpid + ';') == 0:
280 return line[4:].strip()
283 def decode_vid(self, offset):
284 pnpid = chr(64 + ((self.cache[offset] & 0x7c) >> 2))
285 pnpid += chr(64 + (((self.cache[offset] & 0x03) << 3)
286 | ((self.cache[offset+1] & 0xe0) >> 5)))
287 pnpid += chr(64 + (self.cache[offset+1] & 0x1f))
288 vendor = self.lookup_pnpid(pnpid)
290 pnpid += ' (%s)' % vendor
291 self.ann_field(offset, offset+1, pnpid)
293 def decode_pid(self, offset):
294 pidstr = 'Product 0x%.2x%.2x' % (self.cache[offset+1], self.cache[offset])
295 self.ann_field(offset, offset+1, pidstr)
297 def decode_serial(self, offset):
298 serialnum = (self.cache[offset+3] << 24) \
299 + (self.cache[offset+2] << 16) \
300 + (self.cache[offset+1] << 8) \
305 if not chr(self.cache[offset+3-i]).isalnum():
308 serialstr += chr(self.cache[offset+3-i])
309 serial = serialstr if is_alnum else str(serialnum)
310 self.ann_field(offset, offset+3, 'Serial ' + serial)
312 def decode_mfrdate(self, offset):
314 if self.cache[offset]:
315 datestr += 'week %d, ' % self.cache[offset]
316 datestr += str(1990 + self.cache[offset+1])
318 self.ann_field(offset, offset+1, ['Manufactured ' + datestr, datestr])
320 def decode_basicdisplay(self, offset):
321 # Video input definition
322 vid = self.cache[offset]
325 self.ann_field(offset, offset, 'Video input: VESA DFP 1.')
328 sls = (vid & 60) >> 5
329 self.ann_field(offset, offset, 'Signal level standard: %.2x' % sls)
331 self.ann_field(offset, offset, 'Blank-to-black setup expected')
334 syncs += 'separate syncs, '
336 syncs += 'composite syncs, '
338 syncs += 'sync on green, '
340 syncs += 'Vsync serration required, '
342 self.ann_field(offset, offset, 'Supported syncs: %s' % syncs[:-2])
343 # Max horizontal/vertical image size
344 if self.cache[offset+1] != 0 and self.cache[offset+2] != 0:
345 # Projectors have this set to 0
346 sizestr = '%dx%dcm' % (self.cache[offset+1], self.cache[offset+2])
347 self.ann_field(offset+1, offset+2, 'Physical size: ' + sizestr)
348 # Display transfer characteristic (gamma)
349 if self.cache[offset+3] != 0xff:
350 gamma = (self.cache[offset+3] + 100) / 100
351 self.ann_field(offset+3, offset+3, 'Gamma: %1.2f' % gamma)
353 fs = self.cache[offset+4]
360 dpms += 'active off, '
362 self.ann_field(offset+4, offset+4, 'DPMS support: %s' % dpms[:-2])
363 dt = (fs & 0x18) >> 3
370 dtstr = 'non-RGB multicolor'
372 self.ann_field(offset+4, offset+4, 'Display type: %s' % dtstr)
374 self.ann_field(offset+4, offset+4, 'Color space: standard sRGB')
375 # Save this for when we decode the first detailed timing descriptor
376 self.have_preferred_timing = (fs & 0x02) == 0x02
381 self.ann_field(offset+4, offset+4,
382 'Generalized timing formula: %ssupported' % gft)
384 def convert_color(self, value):
385 # Convert from 10-bit packet format to float
389 outval += 2 ** -(10-i)
393 def decode_chromaticity(self, offset):
394 redx = (self.cache[offset+2] << 2) + ((self.cache[offset] & 0xc0) >> 6)
395 redy = (self.cache[offset+3] << 2) + ((self.cache[offset] & 0x30) >> 4)
396 self.ann_field(offset, offset+9, 'Chromacity red: X %1.3f, Y %1.3f' % (
397 self.convert_color(redx), self.convert_color(redy)))
399 greenx = (self.cache[offset+4] << 2) + ((self.cache[offset] & 0x0c) >> 6)
400 greeny = (self.cache[offset+5] << 2) + ((self.cache[offset] & 0x03) >> 4)
401 self.ann_field(offset, offset+9, 'Chromacity green: X %1.3f, Y %1.3f' % (
402 self.convert_color(greenx), self.convert_color(greeny)))
404 bluex = (self.cache[offset+6] << 2) + ((self.cache[offset+1] & 0xc0) >> 6)
405 bluey = (self.cache[offset+7] << 2) + ((self.cache[offset+1] & 0x30) >> 4)
406 self.ann_field(offset, offset+9, 'Chromacity blue: X %1.3f, Y %1.3f' % (
407 self.convert_color(bluex), self.convert_color(bluey)))
409 whitex = (self.cache[offset+8] << 2) + ((self.cache[offset+1] & 0x0c) >> 6)
410 whitey = (self.cache[offset+9] << 2) + ((self.cache[offset+1] & 0x03) >> 4)
411 self.ann_field(offset, offset+9, 'Chromacity white: X %1.3f, Y %1.3f' % (
412 self.convert_color(whitex), self.convert_color(whitey)))
414 def decode_est_timing(self, offset):
416 bitmap = (self.cache[offset] << 9) \
417 + (self.cache[offset+1] << 1) \
418 + ((self.cache[offset+2] & 0x80) >> 7)
421 if bitmap & (1 << (16-i)):
422 modestr += est_modes[i] + ', '
424 self.ann_field(offset, offset+2,
425 'Supported established modes: %s' % modestr[:-2])
427 def decode_std_timing(self, offset):
429 for i in range(0, 16, 2):
430 if self.cache[offset+i] == 0x01 and self.cache[offset+i+1] == 0x01:
433 x = (self.cache[offset+i] + 31) * 8
434 ratio = (self.cache[offset+i+1] & 0xc0) >> 6
435 ratio_x, ratio_y = xy_ratio[ratio]
436 y = x / ratio_x * ratio_y
437 refresh = (self.cache[offset+i+1] & 0x3f) + 60
438 modestr += '%dx%d@%dHz, ' % (x, y, refresh)
440 self.ann_field(offset, offset + 15,
441 'Supported standard modes: %s' % modestr[:-2])
443 def decode_detailed_timing(self, cache, sn, offset, is_first):
444 if is_first and self.have_preferred_timing:
445 # Only on first detailed timing descriptor
446 section = 'Preferred'
449 section += ' timing descriptor'
451 self.put(sn[0][0], sn[17][1],
452 self.out_ann, [ANN_SECTIONS, [section]])
454 pixclock = float((cache[1] << 8) + cache[0]) / 100
455 self.ann_field(offset, offset+1, 'Pixel clock: %.2f MHz' % pixclock)
457 horiz_active = ((cache[4] & 0xf0) << 4) + cache[2]
458 horiz_blank = ((cache[4] & 0x0f) << 8) + cache[3]
459 self.ann_field(offset+2, offset+4, 'Horizontal active: %d, blanking: %d' % (horiz_active, horiz_blank))
461 vert_active = ((cache[7] & 0xf0) << 4) + cache[5]
462 vert_blank = ((cache[7] & 0x0f) << 8) + cache[6]
463 self.ann_field(offset+5, offset+7, 'Vertical active: %d, blanking: %d' % (vert_active, vert_blank))
465 horiz_sync_off = ((cache[11] & 0xc0) << 2) + cache[8]
466 horiz_sync_pw = ((cache[11] & 0x30) << 4) + cache[9]
467 vert_sync_off = ((cache[11] & 0x0c) << 2) + ((cache[10] & 0xf0) >> 4)
468 vert_sync_pw = ((cache[11] & 0x03) << 4) + (cache[10] & 0x0f)
470 syncs = (horiz_sync_off, horiz_sync_pw, vert_sync_off, vert_sync_pw)
471 self.ann_field(offset+8, offset+11, [
472 'Horizontal sync offset: %d, pulse width: %d, Vertical sync offset: %d, pulse width: %d' % syncs,
473 'HSync off: %d, pw: %d, VSync off: %d, pw: %d' % syncs])
475 horiz_size = ((cache[14] & 0xf0) << 4) + cache[12]
476 vert_size = ((cache[14] & 0x0f) << 8) + cache[13]
477 self.ann_field(offset+12, offset+14, 'Physical size: %dx%dmm' % (horiz_size, vert_size))
479 horiz_border = cache[15]
480 self.ann_field(offset+15, offset+15, 'Horizontal border: %d pixels' % horiz_border)
481 vert_border = cache[16]
482 self.ann_field(offset+16, offset+16, 'Vertical border: %d lines' % vert_border)
486 features += 'interlaced, '
487 stereo = (cache[17] & 0x60) >> 5
490 features += '2-way interleaved stereo ('
491 features += ['right image on even lines',
492 'left image on even lines',
493 'side-by-side'][stereo-1]
496 features += 'field sequential stereo ('
497 features += ['right image on sync=1', 'left image on sync=1',
498 '4-way interleaved'][stereo-1]
500 sync = (cache[17] & 0x18) >> 3
501 sync2 = (cache[17] & 0x06) >> 1
502 posneg = ['negative', 'positive']
503 features += 'sync type '
505 features += 'analog composite (serrate on RGB)'
507 features += 'bipolar analog composite (serrate on RGB)'
509 features += 'digital composite (serrate on composite polarity ' \
510 + (posneg[sync2 & 0x01]) + ')'
512 features += 'digital separate ('
513 features += 'Vsync polarity ' + (posneg[(sync2 & 0x02) >> 1])
514 features += ', Hsync polarity ' + (posneg[sync2 & 0x01])
517 self.ann_field(offset+17, offset+17, features[:-2])
519 def decode_descriptor(self, cache, offset):
521 self.ann_field(offset, offset+1, "Flag")
522 self.ann_field(offset+2, offset+2, "Flag (reserved)")
523 self.ann_field(offset+3, offset+3, "Tag: {0:X}".format(tag))
524 self.ann_field(offset+4, offset+4, "Flag")
526 sn = self.ext_sn[self.extension - 1] if self.extension else self.sn
529 # Monitor serial number
530 self.put(sn[offset][0], sn[offset+17][1], self.out_ann,
531 [ANN_SECTIONS, ['Serial number']])
532 text = bytes(cache[5:][:13]).decode(encoding='cp437', errors='replace')
533 self.ann_field(offset+5, offset+17, text.strip())
536 self.put(sn[offset][0], sn[offset+17][1], self.out_ann,
537 [ANN_SECTIONS, ['Text']])
538 text = bytes(cache[5:][:13]).decode(encoding='cp437', errors='replace')
539 self.ann_field(offset+5, offset+17, text.strip())
542 self.put(sn[offset][0], sn[offset+17][1], self.out_ann,
543 [ANN_SECTIONS, ['Monitor name']])
544 text = bytes(cache[5:][:13]).decode(encoding='cp437', errors='replace')
545 self.ann_field(offset+5, offset+17, text.strip())
547 # Monitor range limits
548 self.put(sn[offset][0], sn[offset+17][1], self.out_ann,
549 [ANN_SECTIONS, ['Monitor range limits']])
550 self.ann_field(offset+5, offset+5, [
551 'Minimum vertical rate: {0}Hz'.format(cache[5]),
552 'VSync >= {0}Hz'.format(cache[5])])
553 self.ann_field(offset+6, offset+6, [
554 'Maximum vertical rate: {0}Hz'.format(cache[6]),
555 'VSync <= {0}Hz'.format(cache[6])])
556 self.ann_field(offset+7, offset+7, [
557 'Minimum horizontal rate: {0}kHz'.format(cache[7]),
558 'HSync >= {0}kHz'.format(cache[7])])
559 self.ann_field(offset+8, offset+8, [
560 'Maximum horizontal rate: {0}kHz'.format(cache[8]),
561 'HSync <= {0}kHz'.format(cache[8])])
562 self.ann_field(offset+9, offset+9, [
563 'Maximum pixel clock: {0}MHz'.format(cache[9] * 10),
564 'PixClk <= {0}MHz'.format(cache[9] * 10)])
565 if cache[10] == 0x02:
566 self.ann_field(offset+10, offset+10, ['Secondary timing formula supported', '2nd GTF: yes'])
567 self.ann_field(offset+11, offset+17, ['GTF'])
569 self.ann_field(offset+10, offset+10, ['Secondary timing formula unsupported', '2nd GTF: no'])
570 self.ann_field(offset+11, offset+17, ['Padding'])
572 # Additional color point data
573 self.put(sn[offset][0], sn[offset+17][1], self.out_ann,
574 [ANN_SECTIONS, ['Additional color point data']])
576 # Additional standard timing definitions
577 self.put(sn[offset][0], sn[offset+17][1], self.out_ann,
578 [ANN_SECTIONS, ['Additional standard timing definitions']])
580 self.put(sn[offset][0], sn[offset+17][1], self.out_ann,
581 [ANN_SECTIONS, ['Unknown descriptor']])
583 def decode_descriptors(self, offset):
584 # 4 consecutive 18-byte descriptor blocks
585 cache = self.ext_cache[self.extension - 1] if self.extension else self.cache
586 sn = self.ext_sn[self.extension - 1] if self.extension else self.sn
588 for i in range(offset, 0, 18):
589 if cache[i] != 0 or cache[i+1] != 0:
590 self.decode_detailed_timing(cache[i:], sn[i:], i, i == offset)
592 if cache[i+2] == 0 or cache[i+4] == 0:
593 self.decode_descriptor(cache[i:], i)
595 def decode_data_block(self, tag, cache, sn):
596 codes = { 0: ['0: Reserved'],
597 1: ['1: Audio Data Block', 'Audio'],
598 2: ['2: Video Data Block', 'Video'],
599 3: ['3: Vendor Specific Data Block', 'VSDB'],
600 4: ['4: Speacker Allocation Data Block', 'SADB'],
601 5: ['5: VESA DTC Data Block', 'DTC'],
603 7: ['7: Extended', 'Ext'] }
604 ext_codes = { 0: [ '0: Video Capability Data Block', 'VCDB'],
605 1: [ '1: Vendor Specific Video Data Block', 'VSVDB'],
606 17: ['17: Vendor Specific Audio Data Block', 'VSADB'], }
611 aformats = { 1: '1 (LPCM)' }
612 rates = [ '192', '176', '96', '88', '48', '44', '32' ]
614 aformat = cache[1] >> 3
615 sup_rates = [ i for i in range(0, 8) if (1 << i) & cache[2] ]
617 data = "Format: {0} Channels: {1}".format(
618 aformats.get(aformat, aformat), (cache[1] & 0x7) + 1)
619 data += " Rates: " + " ".join(rates[6 - i] for i in sup_rates)
620 data += " Extra: [{0:02X}]".format(cache[3])
624 data += ", ".join("{0}{1}".format(v & 0x7f,
625 ['', ' (Native)'][v >> 7])
629 ouis = { b'\x00\x0c\x03': 'HDMI Licensing, LLC' }
630 oui = bytes(cache[3:0:-1])
631 ouis = ouis.get(oui, None)
632 data = "OUI: " + " ".join('{0:02X}'.format(x) for x in oui)
633 data += " ({0})".format(ouis) if ouis else ""
634 data += ", PhyAddr: {0}.{1}.{2}.{3}".format(
635 cache[4] >> 4, cache[4] & 0xf, cache[5] >> 4, cache[5] & 0xf)
636 data += ", [" + " ".join('{0:02X}'.format(x) for x in cache[6:]) + "]"
639 speakers = [ 'FL/FR', 'LFE', 'FC', 'RL/RR',
640 'RC', 'FLC/FRC', 'RLC/RRC', 'FLW/FRW',
641 'FLH/FRH', 'TC', 'FCH' ]
642 sup_speakers = cache[1] + (cache[2] << 8)
643 sup_speakers = [ i for i in range(0, 8) if (1 << i) & sup_speakers ]
644 data = "Speakers: " + " ".join(speakers[i] for i in sup_speakers)
647 data = " ".join('{0:02X}'.format(x) for x in cache[1:])
652 ext_code = ext_codes.get(cache[1], ['Unknown', '?'])
653 code = zip(codes[7], [", ", ": "], ext_code)
654 code = [ "".join(x) for x in code ]
655 data = " ".join('{0:02X}'.format(x) for x in cache[2:])
657 self.put(sn[0][0], sn[0 + ext_len][1], self.out_ann,
659 self.put(sn[1 + ext_len][0], sn[len(cache) - 1][1], self.out_ann,
660 [ANN_FIELDS, [data]])
662 def decode_data_block_collection(self, cache, sn):
664 while offset < len(cache):
665 length = 1 + cache[offset] & 0x1f
666 tag = cache[offset] >> 5
667 self.decode_data_block(tag, cache[offset:offset + length], sn[offset:])