diff options
-rw-r--r-- | decode.c | 14 | ||||
-rw-r--r-- | sigrokdecode.h | 4 |
2 files changed, 14 insertions, 4 deletions
@@ -31,7 +31,7 @@ #endif /* The list of protocol decoders. */ -GSList *list_pds; +GSList *list_pds = NULL; /** * Initialize libsigrokdecode. @@ -71,6 +71,18 @@ int sigrokdecode_init(void) } /** + * Returns the list of supported/loaded protocol decoders. + * + * This is a GSList containing the names of the decoders as strings. + * + * @return List of decoders, NULL if none are supported or loaded. + */ +GSList *sigrokdecode_list_decoders(void) +{ + return list_pds; +} + +/** * Helper function to handle Python strings. * * TODO: @param entries. diff --git a/sigrokdecode.h b/sigrokdecode.h index ecd141a..8877611 100644 --- a/sigrokdecode.h +++ b/sigrokdecode.h @@ -49,9 +49,6 @@ #define SIGROKDECODE_ERR_PYTHON -4 /* Python C API error */ #define SIGROKDECODE_ERR_DECODERS_DIR -5 /* Protocol decoder path invalid */ -/* The list of loaded protocol decoders. */ -GSList *list_pds; - /* TODO: Documentation. */ struct sigrokdecode_decoder { char *id; @@ -66,6 +63,7 @@ struct sigrokdecode_decoder { }; int sigrokdecode_init(void); +GSList *sigrokdecode_list_decoders(void); int sigrokdecode_load_decoder(const char *name, struct sigrokdecode_decoder **dec); int sigrokdecode_run_decoder(struct sigrokdecode_decoder *dec, uint8_t *inbuf, uint64_t inbuflen, |