X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fhp-3457a%2Fapi.c;fp=src%2Fhardware%2Fhp-3457a%2Fapi.c;h=4cfc2d758b54e79625609d408ef0f506d028a5b7;hb=69498046f64006a11234b0d281a481338f6f329c;hp=f828cfd817f3743c7c764561c8ac8c5737285cff;hpb=7f0463840ab5d6a85daaa76850558d2b71e596cf;p=libsigrok.git diff --git a/src/hardware/hp-3457a/api.c b/src/hardware/hp-3457a/api.c index f828cfd8..4cfc2d75 100644 --- a/src/hardware/hp-3457a/api.c +++ b/src/hardware/hp-3457a/api.c @@ -127,6 +127,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. + */ + /* * This command ensures we receive an EOI after every response, so that * we don't wait the entire timeout after the response is received. @@ -170,6 +178,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); }