X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fstd.c;h=aadf8236a790a3f79c38ece2cf6ebd191166991c;hb=6266deb84d6b5d8ca61b685edae339c24184f157;hp=b66ed8f0b4884c603d4e235a972775c1a1ab40c6;hpb=700d6b64d578ce10e57f6a2289e37a5564eccf1c;p=libsigrok.git diff --git a/src/std.c b/src/std.c index b66ed8f0..aadf8236 100644 --- a/src/std.c +++ b/src/std.c @@ -337,3 +337,22 @@ SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver, return ret; } + +/** + * Standard implementation for the driver dev_list() callback + * + * This function can be used as the dev_list callback by most drivers that use + * the standard helper functions. It returns the devices contained in the driver + * context instances list. + * + * @param di The driver instance to use. + * + * @return The list of devices/instances of this driver, or NULL upon errors + * or if the list is empty. + */ +SR_PRIV GSList *std_dev_list(const struct sr_dev_driver *di) +{ + struct drv_context *drvc = di->context; + + return drvc->instances; +}