]> sigrok.org Git - libsigrok.git/blobdiff - src/input/input.c
input/trace32_ad: fix potential buffer overflow for unexpected input data
[libsigrok.git] / src / input / input.c
index ee19d66169ece22b67254fdf4c330afbcccb62c7..2a23aec2bd81d4a7a4326fb8c06c9acf3b1c47f4 100644 (file)
@@ -532,6 +532,22 @@ SR_API int sr_input_scan_file(const char *filename, const struct sr_input **in)
        return SR_ERR;
 }
 
+/**
+ * Return the input instance's module "class". This can be used to find out
+ * which input module handles a specific input file. This is especially
+ * useful when an application did not create the input stream by specifying
+ * an input module, but instead some shortcut or convenience wrapper did.
+ *
+ * @since 0.6.0
+ */
+SR_API const struct sr_input_module *sr_input_module_get(const struct sr_input *in)
+{
+       if (!in)
+               return NULL;
+
+       return in->module;
+}
+
 /**
  * Return the input instance's (virtual) device instance. This can be
  * used to find out the number of channels and other information.