hp-3457a: only probe when conn= was specified, to not break SCPI devices

Only scan for hp-3457a devices when the user specified which connection
to use. This avoids breaking SCPI devices by emitting non-standard
requests before reliable device identification.
This commit is contained in:
Gerhard Sittig 2021-05-22 14:09:29 +02:00
parent 7f0463840a
commit 69498046f6
1 changed files with 16 additions and 0 deletions

View File

@ -127,6 +127,14 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
struct sr_dev_inst *sdi; struct sr_dev_inst *sdi;
struct dev_context *devc; 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 * This command ensures we receive an EOI after every response, so that
* we don't wait the entire timeout after the response is received. * 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) 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); return sr_scpi_scan(di->context, options, probe_device);
} }