*
* @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)
*
* @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)
* 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)
{
if (!sdi || !sdi->driver || !sdi->driver->config_list)
return FALSE;
- if (sdi->driver->config_list(SR_CONF_DEVICE_OPTIONS, &gvar, NULL) != SR_OK)
+ if (sdi->driver->config_list(SR_CONF_DEVICE_OPTIONS,
+ &gvar, NULL, NULL) != SR_OK)
return FALSE;
ret = FALSE;
sdi->model = model ? g_strdup(model) : NULL;
sdi->version = version ? g_strdup(version) : NULL;
sdi->probes = NULL;
+ sdi->probe_groups = NULL;
sdi->conn = NULL;
sdi->priv = NULL;
}
g_slist_free(sdi->probes);
+ if (sdi->probe_groups)
+ g_slist_free(sdi->probe_groups);
+
g_free(sdi->vendor);
g_free(sdi->model);
g_free(sdi->version);
#endif
+#ifdef HAVE_LIBSERIALPORT
+
/**
* @private
*
g_free(serial->serialcomm);
g_free(serial);
}
+#endif
+
+SR_PRIV struct sr_usbtmc_dev_inst *sr_usbtmc_dev_inst_new(const char *device)
+{
+ struct sr_usbtmc_dev_inst *usbtmc;
+
+ if (!device) {
+ sr_err("Device name required.");
+ return NULL;
+ }
+
+ if (!(usbtmc = g_try_malloc0(sizeof(struct sr_usbtmc_dev_inst)))) {
+ sr_err("USBTMC device instance malloc failed.");
+ return NULL;
+ }
+
+ usbtmc->device = g_strdup(device);
+ usbtmc->fd = -1;
+
+ return usbtmc;
+}
+
+SR_PRIV void sr_usbtmc_dev_inst_free(struct sr_usbtmc_dev_inst *usbtmc)
+{
+ g_free(usbtmc->device);
+ g_free(usbtmc);
+}
/**
* Get the list of devices/instances of the specified driver.
* @return The list of devices/instances of this driver, or NULL upon errors
* or if the list is empty.
*
- * @since 0.1.0 (but the API changed in 0.2.0)
+ * @since 0.2.0
*/
SR_API GSList *sr_dev_list(const struct sr_dev_driver *driver)
{