]> sigrok.org Git - libsigrok.git/commitdiff
scpi-pps: Don't use SCPI_CMD_REMOTE and SCPI_CMD_LOCAL for HP 66xxB devices when...
authorFrank Stettner <redacted>
Thu, 11 Apr 2019 11:04:22 +0000 (13:04 +0200)
committerUwe Hermann <redacted>
Wed, 17 Apr 2019 15:45:04 +0000 (17:45 +0200)
src/hardware/scpi-pps/api.c
src/hardware/scpi-pps/profiles.c

index 98ef0b9d7b01932fb902e77bdd21d13a9704c882..72b6301bd19a90baa9bf341c26df6b8755d6bb2e 100644 (file)
@@ -173,7 +173,10 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi,
        sr_scpi_hw_info_free(hw_info);
        hw_info = NULL;
 
        sr_scpi_hw_info_free(hw_info);
        hw_info = NULL;
 
-       sr_scpi_cmd(sdi, devc->device->commands, 0, NULL, SCPI_CMD_LOCAL);
+       /* Don't send SCPI_CMD_LOCAL for HP 66xxB devices using SCPI over GPIB */
+       if (!(devc->device->dialect == SCPI_DIALECT_HP_66XXB &&
+                       scpi->transport == SCPI_TRANSPORT_LIBGPIB))
+               sr_scpi_cmd(sdi, devc->device->commands, 0, NULL, SCPI_CMD_LOCAL);
 
        return sdi;
 }
 
        return sdi;
 }
@@ -265,7 +268,12 @@ static int dev_open(struct sr_dev_inst *sdi)
                return SR_ERR;
 
        devc = sdi->priv;
                return SR_ERR;
 
        devc = sdi->priv;
-       sr_scpi_cmd(sdi, devc->device->commands, 0, NULL, SCPI_CMD_REMOTE);
+
+       /* Don't send SCPI_CMD_REMOTE for HP 66xxB devices using SCPI over GPIB */
+       if (!(devc->device->dialect == SCPI_DIALECT_HP_66XXB &&
+                       scpi->transport == SCPI_TRANSPORT_LIBGPIB))
+               sr_scpi_cmd(sdi, devc->device->commands, 0, NULL, SCPI_CMD_REMOTE);
+
        devc->beeper_was_set = FALSE;
        if (sr_scpi_cmd_resp(sdi, devc->device->commands, 0, NULL,
                        &beeper, G_VARIANT_TYPE_BOOLEAN, SCPI_CMD_BEEPER) == SR_OK) {
        devc->beeper_was_set = FALSE;
        if (sr_scpi_cmd_resp(sdi, devc->device->commands, 0, NULL,
                        &beeper, G_VARIANT_TYPE_BOOLEAN, SCPI_CMD_BEEPER) == SR_OK) {
@@ -294,7 +302,11 @@ static int dev_close(struct sr_dev_inst *sdi)
        if (devc->beeper_was_set)
                sr_scpi_cmd(sdi, devc->device->commands,
                        0, NULL, SCPI_CMD_BEEPER_ENABLE);
        if (devc->beeper_was_set)
                sr_scpi_cmd(sdi, devc->device->commands,
                        0, NULL, SCPI_CMD_BEEPER_ENABLE);
-       sr_scpi_cmd(sdi, devc->device->commands, 0, NULL, SCPI_CMD_LOCAL);
+
+       /* Don't send SCPI_CMD_LOCAL for HP 66xxB devices using SCPI over GPIB */
+       if (!(devc->device->dialect == SCPI_DIALECT_HP_66XXB &&
+                       scpi->transport == SCPI_TRANSPORT_LIBGPIB))
+               sr_scpi_cmd(sdi, devc->device->commands, 0, NULL, SCPI_CMD_LOCAL);
 
        return sr_scpi_close(scpi);
 }
 
        return sr_scpi_close(scpi);
 }
index 9e664480ca7321ffc12977f2355a02dc9f05bcd6..9d7fd202896e3a9bd35b87238c1a44af04257e7d 100644 (file)
@@ -638,6 +638,10 @@ static const struct channel_group_spec hp_6630b_cg[] = {
 };
 
 static const struct scpi_command hp_6630b_cmd[] = {
 };
 
 static const struct scpi_command hp_6630b_cmd[] = {
+       /*
+        * SCPI_CMD_REMOTE and SCPI_CMD_LOCAL are not used when GPIB is used,
+        * otherwise the device will report (non critical) error 602.
+        */
        { SCPI_CMD_REMOTE, "SYST:REM" },
        { SCPI_CMD_LOCAL, "SYST:LOC" },
        { SCPI_CMD_GET_OUTPUT_ENABLED, "OUTP:STAT?" },
        { SCPI_CMD_REMOTE, "SYST:REM" },
        { SCPI_CMD_LOCAL, "SYST:LOC" },
        { SCPI_CMD_GET_OUTPUT_ENABLED, "OUTP:STAT?" },