+ conn_devices = NULL;
+ for (l = options; l; l = l->next) {
+ src = l->data;
+ if (src->key != SR_CONF_CONN)
+ continue;
+ str = g_variant_get_string(src->data, NULL);
+ conn_devices = sr_usb_find(drvc->sr_ctx->libusb_ctx, str);
+ }
+
+ libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
+ for (i = 0; devlist[i]; i++) {
+ if (conn_devices) {
+ usb = NULL;
+ for (l = conn_devices; l; l = l->next) {
+ usb = l->data;
+ if (usb->bus == libusb_get_bus_number(devlist[i])
+ && usb->address == libusb_get_device_address(devlist[i]))
+ break;
+ }
+ if (!l)
+ /* This device matched none of the ones that
+ * matched the conn specification. */
+ continue;
+ }
+
+ if ((ret = libusb_get_device_descriptor( devlist[i], &des)) != 0) {
+ sr_warn("Failed to get device descriptor: %s.",
+ libusb_error_name(ret));
+ continue;
+ }
+
+ if ((ret = libusb_open(devlist[i], &hdl)) < 0)
+ continue;
+
+ manufacturer[0] = product[0] = '\0';
+ if (des.iManufacturer && (ret = libusb_get_string_descriptor_ascii(
+ hdl, des.iManufacturer, (unsigned char *) manufacturer,
+ sizeof(manufacturer))) < 0) {
+ sr_warn("Failed to get manufacturer string descriptor: %s.",
+ libusb_error_name(ret));
+ }
+ if (des.iProduct && (ret = libusb_get_string_descriptor_ascii(
+ hdl, des.iProduct, (unsigned char *) product,
+ sizeof(product))) < 0) {
+ sr_warn("Failed to get product string descriptor: %s.",
+ libusb_error_name(ret));
+ }
+ libusb_close(hdl);
+
+ if (strncmp(manufacturer, "testo", 5))
+ continue;
+
+ /* Hardcode the 435 for now.*/
+ if (strcmp(product, "testo 435/635/735"))
+ continue;
+
+ devcnt = g_slist_length(drvc->instances);
+ sdi = sr_dev_inst_new(devcnt, SR_ST_INACTIVE, "Testo",
+ "435/635/735", NULL);
+ sdi->driver = di;
+ sdi->inst_type = SR_INST_USB;
+ sdi->conn = sr_usb_dev_inst_new(libusb_get_bus_number(devlist[i]),
+ libusb_get_device_address(devlist[i]), NULL);
+ devc = g_malloc(sizeof(struct dev_context));
+ devc->model = &models[0];
+ devc->limit_msec = 0;
+ devc->limit_samples = 0;
+ sdi->priv = devc;
+ if (testo_probe_channels(sdi) != SR_OK)
+ continue;
+ drvc->instances = g_slist_append(drvc->instances, sdi);
+ devices = g_slist_append(devices, sdi);
+ }
+ libusb_free_device_list(devlist, 1);
+ g_slist_free_full(conn_devices, (GDestroyNotify)sr_usb_dev_inst_free);