+ GSList *l, *r, *resources = NULL;
+ gchar *res;
+ unsigned i;
+
+ (void)drvc;
+
+ for (i = 0; i < ARRAY_SIZE(scpi_serial_usb_ids); i++) {
+ if ((l = sr_serial_find_usb(scpi_serial_usb_ids[i].vendor_id,
+ scpi_serial_usb_ids[i].product_id)) == NULL)
+ continue;
+ for (r = l; r; r = r->next) {
+ if (scpi_serial_usb_ids[i].serialcomm)
+ res = g_strdup_printf("%s:%s", (char *) r->data,
+ scpi_serial_usb_ids[i].serialcomm);
+ else
+ res = g_strdup(r->data);
+ resources = g_slist_append(resources, res);
+ }
+ g_slist_free_full(l, g_free);
+ }
+
+ return resources;
+}
+
+static int scpi_serial_dev_inst_new(void *priv, struct drv_context *drvc,
+ const char *resource, char **params, const char *serialcomm)
+{
+ struct scpi_serial *sscpi = priv;
+
+ (void)drvc;
+ (void)params;
+
+ if (!(sscpi->serial = sr_serial_dev_inst_new(resource, serialcomm)))
+ return SR_ERR;
+
+ return SR_OK;
+}
+
+static int scpi_serial_open(void *priv)
+{
+ struct scpi_serial *sscpi = priv;
+ struct sr_serial_dev_inst *serial = sscpi->serial;