+ return g_strdup_printf("%d.%d", major, minor);
+}
+
+static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
+{
+ int ret, idx;
+ char *response;
+ struct sr_dev_inst *sdi;
+ struct dev_context *devc;
+
+ /*
+ * This command ensures we receive an EOI after every response, so that
+ * we don't wait the entire timeout after the response is received.
+ */
+ if (sr_scpi_send(scpi, "END ALWAYS") != SR_OK)
+ return NULL;
+
+ ret = sr_scpi_get_string(scpi, "ID?", &response);
+ if ((ret != SR_OK) || !response)
+ return NULL;
+
+ if (strcmp(response, "HP3457A"))
+ return NULL;
+
+ g_free(response);
+
+ devc = g_malloc0(sizeof(struct dev_context));
+ sdi = g_malloc0(sizeof(struct sr_dev_inst));
+ sdi->vendor = g_strdup("Hewlett-Packard");
+ sdi->model = g_strdup("3457A");
+ sdi->version = get_revision(scpi);
+ sdi->conn = scpi;
+ sdi->driver = &hp_3457a_driver_info;
+ sdi->inst_type = SR_INST_SCPI;
+ sdi->priv = devc;
+
+ /* There is no way to probe the measurement mode. It must be set. */
+ devc->measurement_mq = 0;
+ devc->measurement_unit = 0;
+
+ /* Probe rear card option and create channels accordingly (TODO). */
+ devc->rear_card = hp_3457a_probe_rear_card(scpi);
+ idx = 0;
+ idx = create_front_channel(sdi, idx);
+ create_rear_channels(sdi, idx, devc->rear_card);
+
+ return sdi;
+}
+
+static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
+{
+ return std_init(sr_ctx, di, LOG_PREFIX);
+}
+
+static GSList *scan(struct sr_dev_driver *di, GSList *options)
+{
+ return sr_scpi_scan(di->context, options, probe_device);