X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=device.c;h=b261d6a741b2e93b6a54b958abb532e71361c6a9;hb=53f05fa80f1f9d7657f1173f24d9d1e2b740a312;hp=486acfd0cf703298f2b112baa46b557c2f5c1d52;hpb=a006798b9979ed3b8a2803927727dfbd870277f7;p=libsigrok.git diff --git a/device.c b/device.c index 486acfd0..b261d6a7 100644 --- a/device.c +++ b/device.c @@ -80,7 +80,7 @@ SR_PRIV struct sr_probe *sr_probe_new(int index, int type, * * @return SR_OK on success, or SR_ERR_ARG on invalid arguments. * - * @since 0.1.0 (but the API changed in 0.2.0) + * @since 0.2.0 */ SR_API int sr_dev_probe_name_set(const struct sr_dev_inst *sdi, int probenum, const char *name) @@ -154,7 +154,7 @@ SR_API int sr_dev_probe_enable(const struct sr_dev_inst *sdi, int probenum, * * @return SR_OK on success, or SR_ERR_ARG on invalid arguments. * - * @since 0.1.0 (but the API changed in 0.2.0) + * @since 0.2.0 */ SR_API int sr_dev_trigger_set(const struct sr_dev_inst *sdi, int probenum, const char *trigger) @@ -196,7 +196,7 @@ SR_API int sr_dev_trigger_set(const struct sr_dev_inst *sdi, int probenum, * FALSE is also returned on invalid input parameters or other * error conditions. * - * @since 0.1.0 (but the API changed in 0.2.0) + * @since 0.2.0 */ SR_API gboolean sr_dev_has_option(const struct sr_dev_inst *sdi, int key) { @@ -344,6 +344,16 @@ SR_PRIV void sr_serial_dev_inst_free(struct sr_serial_dev_inst *serial) g_free(serial); } +/** + * Get the list of devices/instances of the specified driver. + * + * @param driver The driver to use. Must not be NULL. + * + * @return The list of devices/instances of this driver, or NULL upon errors + * or if the list is empty. + * + * @since 0.2.0 + */ SR_API GSList *sr_dev_list(const struct sr_dev_driver *driver) { if (driver && driver->dev_list) @@ -352,6 +362,15 @@ SR_API GSList *sr_dev_list(const struct sr_dev_driver *driver) return NULL; } +/** + * Clear all devices/instances of the specified driver. + * + * @param driver The driver to use. Must not be NULL. + * + * @return SR_OK upon success, a negative error code upon errors. + * + * @since 0.2.0 + */ SR_API int sr_dev_clear(const struct sr_dev_driver *driver) { if (driver && driver->dev_clear) @@ -360,6 +379,15 @@ SR_API int sr_dev_clear(const struct sr_dev_driver *driver) return SR_OK; } +/** + * Open the specified device. + * + * @param sdi Device instance to use. Must not be NULL. + * + * @return SR_OK upon success, a negative error code upon errors. + * + * @since 0.2.0 + */ SR_API int sr_dev_open(struct sr_dev_inst *sdi) { int ret; @@ -372,6 +400,15 @@ SR_API int sr_dev_open(struct sr_dev_inst *sdi) return ret; } +/** + * Close the specified device. + * + * @param sdi Device instance to use. Must not be NULL. + * + * @return SR_OK upon success, a negative error code upon errors. + * + * @since 0.2.0 + */ SR_API int sr_dev_close(struct sr_dev_inst *sdi) { int ret;