- if ((usb_devices = sr_usb_find(drvc->sr_ctx->libusb_ctx, conn))) {
- /* We have a list of sr_usb_dev_inst matching the connection
- * string. Wrap them in sr_dev_inst and we're done. */
- for (l = usb_devices; l; l = l->next) {
- if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, VENDOR,
- MODEL, NULL)))
- return NULL;
- sdi->driver = di;
- sdi->inst_type = SR_INST_USB;
- sdi->conn = l->data;
- for (i = 0; i < 3; i++) {
- if (!(ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE,
- channels[i]))) {
- sr_dbg("Channel malloc failed.");
- return NULL;
- }
- sdi->channels = g_slist_append(sdi->channels, ch);
- }
-
- if (!(devc = g_try_malloc(sizeof(struct dev_context)))) {
- sr_dbg("Device context malloc failed.");
- return NULL;
- }
- sdi->priv = devc;
- devc->limit_samples = 0;
- devc->data_source = DEFAULT_DATA_SOURCE;
- drvc->instances = g_slist_append(drvc->instances, sdi);
- devices = g_slist_append(devices, sdi);
- }
- g_slist_free(usb_devices);
- } else
- g_slist_free_full(usb_devices, g_free);
-
- return devices;
-}
-
-static GSList *dev_list(void)
-{
- return ((struct drv_context *)(di->priv))->instances;
-}
-
-static int dev_open(struct sr_dev_inst *sdi)
-{
- struct drv_context *drvc;
- struct sr_usb_dev_inst *usb;
- int ret;
-
- if (!(drvc = di->priv)) {
- sr_err("Driver was not initialized.");
- return SR_ERR;
+ serial = sr_serial_dev_inst_new(conn, serialcomm);
+ rc = serial_open(serial, SERIAL_RDWR);
+ serial_flush(serial);
+ /* Cannot query/identify the device. Successful open shall suffice. */
+ serial_close(serial);
+ if (rc != SR_OK) {
+ sr_serial_dev_inst_free(serial);
+ return devices;