]> sigrok.org Git - libsigrokdecode.git/commitdiff
Decoder.output_new() now takes an extra protocol_id argument.
authorBert Vermeulen <redacted>
Sat, 7 Jan 2012 02:59:16 +0000 (03:59 +0100)
committerBert Vermeulen <redacted>
Sat, 7 Jan 2012 02:59:16 +0000 (03:59 +0100)
decoders/i2c.py
module_sigrokdecode.c

index 0f554f78f5fefce887fdc612eed5edbb2d2c2b1c..23b12c34f4791720067d068f82627aa42dd60972 100644 (file)
@@ -180,8 +180,8 @@ class Decoder(sigrokdecode.Decoder):
         self.oldsda = None
 
     def start(self, metadata):
-        self.output_protocol = self.output_new(1)
-        self.output_annotation = self.output_new(0)
+        self.output_protocol = self.output_new(1, 'i2c')
+        self.output_annotation = self.output_new(0, 'i2c')
 
     def report(self):
         pass
index d4af5c344a4f40cba32b54156d759372bfe1fde8..b3bdafd792ce1c9ec0df73e5442ff1bf7ae9d8d3 100644 (file)
@@ -128,7 +128,7 @@ static PyObject *Decoder_put(PyObject *self, PyObject *args)
        case SRD_OUTPUT_PROTOCOL:
 
                /* TODO: SRD_OUTPUT_PROTOCOL should go up the PD stack. */
-               printf("%s protocol data: ", pdo->decoder->name);
+               printf("%s protocol data: ", pdo->protocol_id);
                PyObject_Print(data, stdout, Py_PRINT_RAW);
                puts("");
                break;
@@ -143,7 +143,7 @@ static PyObject *Decoder_put(PyObject *self, PyObject *args)
 }
 
 
-static PyObject *Decoder_output_new(PyObject *self, PyObject *py_output_type)
+static PyObject *Decoder_output_new(PyObject *self, PyObject *args)
 {
        PyObject *ret;
        struct srd_decoder_instance *di;
@@ -155,11 +155,9 @@ static PyObject *Decoder_output_new(PyObject *self, PyObject *py_output_type)
 
        printf("output_new di %s\n", di->decoder->name);
 
-       if (!PyArg_ParseTuple(py_output_type, "i:output_type", &output_type))
+       if (!PyArg_ParseTuple(args, "is", &output_type, &protocol_id))
                return NULL;
 
-       /* TODO: take protocol_id from python */
-       protocol_id = "i2c";
        pdo_id = pd_output_new(di, output_type, protocol_id);
        if (pdo_id < 0)
                Py_RETURN_NONE;