summaryrefslogtreecommitdiff
path: root/controller.c
diff options
context:
space:
mode:
authorGareth McMullin <gareth@blacksphere.co.nz>2011-12-05 20:31:32 +1300
committerGareth McMullin <gareth@blacksphere.co.nz>2011-12-05 20:31:32 +1300
commit6547acfda9913a8856e2c875dc3f340570d80583 (patch)
tree159018a533604e89c3c92b9dfa00e2fea046c928 /controller.c
parent09b0acbb8dd292794e7fc797352cda47c27a1355 (diff)
downloadlibsigrokdecode-6547acfda9913a8856e2c875dc3f340570d80583.tar.gz
libsigrokdecode-6547acfda9913a8856e2c875dc3f340570d80583.zip
srd: Initialise struct members by name. Minor other fixes.
Restored some prototypes in sigrokdecode.h. Abort sigrok-cli on error while decoding (includes KeyboardInterrupt). Fixed passing metadata to Decoder.start() method.
Diffstat (limited to 'controller.c')
-rw-r--r--controller.c42
1 files changed, 10 insertions, 32 deletions
diff --git a/controller.c b/controller.c
index db2ed9b..31aad0e 100644
--- a/controller.c
+++ b/controller.c
@@ -86,34 +86,11 @@ typedef struct {
static PyTypeObject sigrok_Decoder_type = {
PyObject_HEAD_INIT(NULL)
- 0,
- "sigrok.Decoder",
- sizeof(sigrok_Decoder_object),
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- "Sigrok Decoder object",
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- Decoder_methods,
+ .tp_name = "sigrok.Decoder",
+ .tp_basicsize = sizeof(sigrok_Decoder_object),
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ .tp_doc = "Sigrok Decoder object",
+ .tp_methods = Decoder_methods,
};
PyMODINIT_FUNC init_sigrok_Decoder(void)
@@ -293,10 +270,11 @@ int srd_session_start(const char *driver, int unitsize, uint64_t starttime,
for (d = decoders; d; d = d->next) {
di = d->data;
if (!(py_res = PyObject_CallMethod(di->py_instance, "start",
- "{s:s,s:i,s:d}",
- "driver", driver,
- "unitsize", unitsize,
- "starttime", starttime))) {
+ "{s:s,s:l,s:l,s:l}",
+ "driver", driver,
+ "unitsize", (long)unitsize,
+ "starttime", (long)starttime,
+ "samplerate", (long)samplerate))) {
if (PyErr_Occurred())
PyErr_Print(); /* Returns void. */