From: Bert Vermeulen Date: Tue, 31 Jan 2012 17:07:59 +0000 (+0100) Subject: srd: remove obsolete DDC-only I2C filter X-Git-Tag: libsigrokdecode-0.1.0~77 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d3c8af667a6f2677c3ecc52b5249f24d9d0b356c;p=libsigrokdecode.git srd: remove obsolete DDC-only I2C filter --- diff --git a/configure.ac b/configure.ac index f59f392..1453356 100644 --- a/configure.ac +++ b/configure.ac @@ -153,7 +153,6 @@ AC_CONFIG_FILES([Makefile libsigrokdecode.pc decoders/Makefile decoders/dcf77/Makefile - decoders/ddc/Makefile decoders/ebr30a_i2c_demux/Makefile decoders/edid/Makefile decoders/i2c/Makefile diff --git a/decoders/Makefile.am b/decoders/Makefile.am index 7e40b2f..c78e515 100644 --- a/decoders/Makefile.am +++ b/decoders/Makefile.am @@ -21,7 +21,6 @@ # Please keep this list in alphabetical order. SUBDIRS = \ dcf77 \ - ddc \ ebr30a_i2c_demux \ edid \ i2c \ diff --git a/decoders/ddc/Makefile.am b/decoders/ddc/Makefile.am deleted file mode 100644 index 59c2c69..0000000 --- a/decoders/ddc/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -## -## This file is part of the sigrok project. -## -## Copyright (C) 2012 Uwe Hermann -## -## 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 -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -## - -pkgdatadir = $(DECODERS_DIR)/ddc - -dist_pkgdata_DATA = __init__.py ddc.py - -CLEANFILES = *.pyc - diff --git a/decoders/ddc/__init__.py b/decoders/ddc/__init__.py deleted file mode 100644 index 95cf31e..0000000 --- a/decoders/ddc/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -## -## This file is part of the sigrok project. -## -## Copyright (C) 2012 Uwe Hermann -## -## 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 -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -## - -from .ddc import * - diff --git a/decoders/ddc/ddc.py b/decoders/ddc/ddc.py deleted file mode 100644 index 2cb4552..0000000 --- a/decoders/ddc/ddc.py +++ /dev/null @@ -1,78 +0,0 @@ -## -## This file is part of the sigrok project. -## -## Copyright (C) 2012 Bert Vermeulen -## -## 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 -## the Free Software Foundation; either version 3 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, see . -## - -''' -This decoder extracts a DDC stream from an I2C session between a computer -and a display device. The stream is output as plain bytes. - -Details: -https://en.wikipedia.org/wiki/Display_Data_Channel -''' - -import sigrokdecode as srd - -class Decoder(srd.Decoder): - api_version = 1 - id = 'ddc' - name = 'DDC2' - longname = 'Display Data Channel' - desc = 'A protocol for communication between computers and displays.' - longdesc = '' - license = 'gplv3+' - inputs = ['i2c'] - outputs = ['ddc2'] - options = {} - annotations = [ - ['Byte stream', 'DDC2B byte stream as read from display.'], - ] - - def __init__(self, **kwargs): - self.state = None - - def start(self, metadata): - self.out_proto = self.add(srd.OUTPUT_PROTO, 'ddc2') - self.out_ann = self.add(srd.OUTPUT_ANN, 'ddc2') - - def decode(self, ss, es, data): - try: - cmd, data, ack_bit = data - except Exception as e: - raise Exception('Malformed I2C input: %s' % str(e)) from e - - if self.state is None: - # Wait for the DDC session to start. - if cmd in ('START', 'START REPEAT'): - self.state = 'start' - elif self.state == 'start': - if cmd == 'ADDRESS READ' and data == 80: - # 80 is the I2C slave address of a connected display, - # so this marks the start of the DDC data transfer. - self.state = 'transfer' - elif cmd == 'STOP': - # Got back to the idle state. - self.state = None - elif self.state == 'transfer': - if cmd == 'DATA READ': - # There shouldn't be anything but data reads on this - # address, so ignore everything else. - self.put(ss, es, self.out_proto, data) - self.put(ss, es, self.out_ann, [0, ['0x%.2x' % data]]) - else: - raise Exception('Invalid state: %s' % self.state) -