X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=session.c;fp=session.c;h=b52c91a374540de5eadd41c2cf030666b08706eb;hb=2bb311b482d587a7d20c35bf54f084bc0011d72d;hp=15be92c8237a2b5a0c5627d250b9fadc4598995f;hpb=fa93154fe6cb0962c1a1551dacb6619a7b3f4810;p=libsigrok.git diff --git a/session.c b/session.c index 15be92c8..b52c91a3 100644 --- a/session.c +++ b/session.c @@ -179,6 +179,31 @@ SR_API int sr_session_dev_add(const struct sr_dev_inst *sdi) return SR_OK; } +/** + * List all device instances attached to the current session. + * + * @param devlist A pointer where the device instance list will be + * stored on return. If no devices are in the session, + * this will be NULL. Each element in the list points + * to a struct sr_dev_inst *. + * The list must be freed by the caller, but not the + * elements pointed to. + * + * @return SR_OK upon success, SR_ERR upon invalid arguments. + */ +SR_API int sr_session_dev_list(GSList **devlist) +{ + + *devlist = NULL; + + if (!session) + return SR_ERR; + + *devlist = g_slist_copy(session->devs); + + return SR_OK; +} + /** * Remove all datafeed callbacks in the current session. *