scpi-pps: don't break SCPI devices when scanning for HP-IB devices
authorGerhard Sittig <gerhard.sittig@gmx.net>
Sat, 22 May 2021 11:54:52 +0000 (13:54 +0200)
committerGerhard Sittig <gerhard.sittig@gmx.net>
Tue, 1 Jun 2021 06:20:59 +0000 (08:20 +0200)
Only scan for hpib-pps devices when a user provided conn= specification
was given. This avoids breaking SCPI devices by emitting non-standard
requests before reliable device identification.

src/hardware/scpi-pps/api.c

index ed9fbd9db20661a0c7b472e2741c39a89f17f560..aa5b945a3349cee0573491709d304efa424ccdc7 100644 (file)
@@ -254,6 +254,17 @@ static GSList *scan_scpi_pps(struct sr_dev_driver *di, GSList *options)
 
 static GSList *scan_hpib_pps(struct sr_dev_driver *di, GSList *options)
 {
+       const char *conn;
+
+       /*
+        * Only scan for HP-IB devices when conn= was specified, to not
+        * break SCPI devices' operation.
+        */
+       conn = NULL;
+       (void)sr_serial_extract_options(options, &conn, NULL);
+       if (!conn)
+               return NULL;
+
        return sr_scpi_scan(di->context, options, probe_hpib_pps_device);
 }