X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=blobdiff_plain;f=src%2Fhardware%2Fhp-3478a%2Fapi.c;h=1fd3ff203ad7a872fa451a7361fc1485d277a019;hp=f9419a6e09ced36fb7625a24990b2a50ae4387e4;hb=8ef4fb3347830023b80a5e121c7ffd66e10f4944;hpb=0e3c3c80b86b7ea7590225186953ea0c4d603613 diff --git a/src/hardware/hp-3478a/api.c b/src/hardware/hp-3478a/api.c index f9419a6e..1fd3ff20 100644 --- a/src/hardware/hp-3478a/api.c +++ b/src/hardware/hp-3478a/api.c @@ -129,6 +129,14 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) 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. + */ + sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->vendor = g_strdup("Hewlett-Packard"); sdi->model = g_strdup("3478A"); @@ -152,6 +160,14 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *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); }