scpi: Strip trailing newline from *IDN response if present.

This commit is contained in:
Martin Ling 2013-12-29 13:13:04 +01:00 committed by Bert Vermeulen
parent b178c79d35
commit bc7b7eb196
1 changed files with 5 additions and 0 deletions

View File

@ -552,6 +552,7 @@ SR_PRIV int sr_scpi_get_hw_id(struct sr_scpi_dev_inst *scpi,
{
int num_tokens;
char *response;
char *newline;
gchar **tokens;
struct sr_scpi_hw_info *hw_info;
@ -564,6 +565,10 @@ SR_PRIV int sr_scpi_get_hw_id(struct sr_scpi_dev_inst *scpi,
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