scpi: Remove trailing carriage returns.

This commit is contained in:
Martin Ling 2014-09-11 16:16:04 +01:00 committed by Bert Vermeulen
parent 25f94dfebc
commit edbd09250b
1 changed files with 4 additions and 0 deletions

View File

@ -405,6 +405,10 @@ SR_PRIV int sr_scpi_get_string(struct sr_scpi_dev_inst *scpi,
if (response->len >= 1 && response->str[response->len - 1] == '\n')
g_string_truncate(response, response->len - 1);
/* Get rid of trailing carriage return if present */
if (response->len >= 1 && response->str[response->len - 1] == '\r')
g_string_truncate(response, response->len - 1);
*scpi_response = response->str;
g_string_free(response, FALSE);