Beautify the trigger pattern by removing the quotes from the SCPI response
using sr_scpi_unquote_string() and improve the string pattern handling.
if (sr_scpi_send(sdi->conn, command) != SR_OK ||
sr_scpi_get_opc(sdi->conn) != SR_OK)
return SR_ERR;
- g_free(state->trigger_pattern);
- state->trigger_pattern = g_strdup(tmp_str);
+ strncpy(state->trigger_pattern,
+ tmp_str,
+ MAX_ANALOG_CHANNEL_COUNT + MAX_DIGITAL_CHANNEL_COUNT);
ret = SR_OK;
break;
case SR_CONF_COUPLING:
if (sr_scpi_get_string(sdi->conn,
(*config->scpi_dialect)[SCPI_CMD_GET_TRIGGER_PATTERN],
- &state->trigger_pattern) != SR_OK)
+ &tmp_str) != SR_OK)
return SR_ERR;
+ strncpy(state->trigger_pattern,
+ sr_scpi_unquote_string(tmp_str),
+ MAX_ANALOG_CHANNEL_COUNT + MAX_DIGITAL_CHANNEL_COUNT);
+ g_free(tmp_str);
if (hmo_update_sample_rate(sdi) != SR_OK)
return SR_ERR;
int trigger_source;
int trigger_slope;
- char *trigger_pattern;
+ char trigger_pattern[MAX_ANALOG_CHANNEL_COUNT + MAX_DIGITAL_CHANNEL_COUNT];
uint64_t sample_rate;
};