g_string_append_len(response, buf, len);
}
+ /* Get rid of trailing linefeed if present */
+ if (response->len >= 1 && response->str[response->len - 1] == '\n')
+ g_string_truncate(response, response->len - 1);
+
*scpi_response = response->str;
g_string_free(response, FALSE);
+ sr_spew("Got response: '%s'.", *scpi_response);
+
return SR_OK;
}
if (!response)
return SR_ERR;
- if (sr_atof(response, scpi_response) == SR_OK)
+ if (sr_atof_ascii(response, scpi_response) == SR_OK)
ret = SR_OK;
else
ret = SR_ERR;
response_array = g_array_sized_new(TRUE, FALSE, sizeof(float), 256);
while (*ptr) {
- if (sr_atof(*ptr, &tmp) == SR_OK)
+ if (sr_atof_ascii(*ptr, &tmp) == SR_OK)
response_array = g_array_append_val(response_array,
tmp);
else
{
int num_tokens;
char *response;
- char *newline;
gchar **tokens;
struct sr_scpi_hw_info *hw_info;
sr_info("Got IDN string: '%s'", response);
- /* Remove trailing newline if present. */
- if ((newline = g_strrstr(response, "\n")))
- newline[0] = '\0';
-
/*
* The response to a '*IDN?' is specified by the SCPI spec. It contains
* a comma-separated list containing the manufacturer name, instrument