X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fscpi-pps%2Fapi.c;h=f4514d8e0e225efb313e1b4410ad24c057a4baef;hb=6e43c3d5318a8ff320bf6539a9efe7f0b8497e2f;hp=52b70d3e0adf5a6f582b23004e3ed312b20bf986;hpb=7e463623382e1f574fde150b3fc88a65eaebb578;p=libsigrok.git diff --git a/src/hardware/scpi-pps/api.c b/src/hardware/scpi-pps/api.c index 52b70d3e..f4514d8e 100644 --- a/src/hardware/scpi-pps/api.c +++ b/src/hardware/scpi-pps/api.c @@ -277,15 +277,15 @@ static int dev_close(struct sr_dev_inst *sdi) devc = sdi->priv; scpi = sdi->conn; - if (scpi) { - if (devc->beeper_was_set) - scpi_cmd(sdi, devc->device->commands, SCPI_CMD_BEEPER_ENABLE); - scpi_cmd(sdi, devc->device->commands, SCPI_CMD_LOCAL); - sr_scpi_close(scpi); - sdi->status = SR_ST_INACTIVE; - } - return SR_OK; + if (!scpi) + return SR_ERR_BUG; + + if (devc->beeper_was_set) + scpi_cmd(sdi, devc->device->commands, SCPI_CMD_BEEPER_ENABLE); + scpi_cmd(sdi, devc->device->commands, SCPI_CMD_LOCAL); + + return sr_scpi_close(scpi); } static void clear_helper(void *priv) @@ -300,7 +300,7 @@ static void clear_helper(void *priv) static int dev_clear(const struct sr_dev_driver *di) { - return std_dev_clear(di, clear_helper); + return std_dev_clear_with_callback(di, clear_helper); } static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,