struct sr_dev_inst *sdi;
struct dev_context *devc;
+ /*
+ * The device cannot get identified by means of SCPI queries.
+ * Neither shall non-SCPI requests get emitted before reliable
+ * identification of the device. Assume that we only get here
+ * when user specs led us to believe it's safe to communicate
+ * to the expected kind of device.
+ */
+
/*
* 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 ((ret != SR_OK) || !response)
return NULL;
- if (strcmp(response, "HP3457A")) {
+ if (strcmp(response, "HP3457A") != 0) {
g_free(response);
return NULL;
}
g_free(response);
- devc = g_malloc0(sizeof(struct dev_context));
- sdi = g_malloc0(sizeof(struct sr_dev_inst));
+ devc = g_malloc0(sizeof(*devc));
+ sdi = g_malloc0(sizeof(*sdi));
sdi->vendor = g_strdup("Hewlett-Packard");
sdi->model = g_strdup("3457A");
sdi->version = get_revision(scpi);
static GSList *scan(struct sr_dev_driver *di, GSList *options)
{
+ const char *conn;
+
+ /* Only scan for a device when conn= was specified. */
+ conn = NULL;
+ (void)sr_serial_extract_options(options, &conn, NULL);
+ if (!conn)
+ return NULL;
+
return sr_scpi_scan(di->context, options, probe_device);
}