+int srd_register_callback(int output_type, void *cb)
+{
+ struct srd_pd_callback *pd_cb;
+
+ srd_dbg("srd: registering new callback for output type %d", output_type);
+
+ if (!(pd_cb = g_try_malloc(sizeof(struct srd_pd_callback))))
+ return SRD_ERR_MALLOC;
+
+ pd_cb->output_type = output_type;
+ pd_cb->callback = cb;
+ callbacks = g_slist_append(callbacks, pd_cb);
+
+ return SRD_OK;
+}
+
+void *srd_find_callback(int output_type)
+{
+ GSList *l;
+ struct srd_pd_callback *pd_cb;
+ void *(cb);
+
+ cb = NULL;
+ for (l = callbacks; l; l = l->next) {
+ pd_cb = l->data;
+ if (pd_cb->output_type == output_type) {
+ cb = pd_cb->callback;
+ break;
+ }
+ }
+
+ return cb;
+}
+
+
+/* This is the backend function to python sigrokdecode.add() call. */