+ conn = BRYMEN_BC86X;
+ for (l = options; l; l = l->next) {
+ src = l->data;
+ switch (src->key) {
+ case SR_CONF_CONN:
+ conn = g_variant_get_string(src->data, NULL);
+ break;
+ }
+ }
+
+ devices = NULL;
+ if (!(usb_devices = sr_usb_find(drvc->sr_ctx->libusb_ctx, conn))) {
+ g_slist_free_full(usb_devices, g_free);
+ return NULL;
+ }
+
+ for (l = usb_devices; l; l = l->next) {
+ usb = l->data;
+
+ if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE,
+ "Brymen", "BM869", NULL))) {
+ sr_err("sr_dev_inst_new returned NULL.");
+ return NULL;
+ }
+
+ if (!(devc = g_try_malloc0(sizeof(*devc)))) {
+ sr_err("Device context malloc failed.");
+ return NULL;
+ }
+
+ sdi->priv = devc;
+ sdi->driver = di;
+ if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
+ return NULL;
+ sdi->channels = g_slist_append(sdi->channels, ch);
+ if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P2")))
+ return NULL;
+ sdi->channels = g_slist_append(sdi->channels, ch);
+
+ sdi->inst_type = SR_INST_USB;
+ sdi->conn = usb;
+
+ drvc->instances = g_slist_append(drvc->instances, sdi);
+ devices = g_slist_append(devices, sdi);
+ }