X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=blobdiff_plain;f=src%2Fhardware%2Ffluke-45%2Fapi.c;h=96c8a1b324081507b8a07d64d80fec4c3f358506;hp=164cd5f9bceef01af51aae275091bb4affd47ee5;hb=deb7615262ac4f9cc0750a08351afa7cbf9c34d5;hpb=712f7d5e4093870fff650fb296d2425cb405a4c2 diff --git a/src/hardware/fluke-45/api.c b/src/hardware/fluke-45/api.c index 164cd5f9..96c8a1b3 100644 --- a/src/hardware/fluke-45/api.c +++ b/src/hardware/fluke-45/api.c @@ -62,25 +62,15 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) unsigned int i; const struct fluke_scpi_dmm_model *model = NULL; gchar *channel_name; - char *response; - - sdi = g_malloc0(sizeof(struct sr_dev_inst)); - sdi->conn = scpi; - - /* Test for serial port ECHO enabled. */ - response = NULL; - sr_scpi_get_string(scpi, "ECHO-TEST", &response); - if (response && strcmp(response, "ECHO-TEST") == 0) { - sr_err("Serial port ECHO is ON. Please turn it OFF!"); - return NULL; - } /* Get device IDN. */ if (sr_scpi_get_hw_id(scpi, &hw_info) != SR_OK) { + sr_scpi_hw_info_free(hw_info); sr_info("Couldn't get IDN response, retrying."); sr_scpi_close(scpi); sr_scpi_open(scpi); if (sr_scpi_get_hw_id(scpi, &hw_info) != SR_OK) { + sr_scpi_hw_info_free(hw_info); sr_info("Couldn't get IDN response."); return NULL; } @@ -101,6 +91,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) } /* Set up device parameters. */ + sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->vendor = g_strdup(model->vendor); sdi->model = g_strdup(model->model); sdi->version = g_strdup(hw_info->firmware_version); @@ -108,10 +99,12 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) sdi->conn = scpi; sdi->driver = &fluke_45_driver_info; sdi->inst_type = SR_INST_SCPI; + sr_scpi_hw_info_free(hw_info); devc = g_malloc0(sizeof(struct dev_context)); devc->num_channels = model->num_channels; devc->cmdset = cmdset; + sdi->priv = devc; /* Create channels. */ for (i = 0; i < devc->num_channels; i++) { @@ -119,8 +112,6 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, channel_name); } - sdi->priv = devc; - return sdi; }