sr: convert sr_parse_triggerstring() to use sdi

This commit is contained in:
Bert Vermeulen 2012-07-22 14:28:40 +02:00
parent 9e90dcba9c
commit 92ae798483
2 changed files with 8 additions and 9 deletions

View File

@ -127,7 +127,7 @@ SR_API struct sr_output_format **sr_output_list(void);
SR_API char *sr_samplerate_string(uint64_t samplerate); SR_API char *sr_samplerate_string(uint64_t samplerate);
SR_API char *sr_period_string(uint64_t frequency); SR_API char *sr_period_string(uint64_t frequency);
SR_API char *sr_voltage_string(struct sr_rational *voltage); SR_API char *sr_voltage_string(struct sr_rational *voltage);
SR_API char **sr_parse_triggerstring(struct sr_dev *dev, SR_API char **sr_parse_triggerstring(const struct sr_dev_inst *sdi,
const char *triggerstring); const char *triggerstring);
SR_API int sr_parse_sizestring(const char *sizestring, uint64_t *size); SR_API int sr_parse_sizestring(const char *sizestring, uint64_t *size);
SR_API uint64_t sr_parse_timestring(const char *timestring); SR_API uint64_t sr_parse_timestring(const char *timestring);

View File

@ -170,7 +170,7 @@ SR_API char *sr_voltage_string(struct sr_rational *voltage)
* contain the respective trigger type which is requested for the * contain the respective trigger type which is requested for the
* respective probe (e.g. "r", "c", and so on). * respective probe (e.g. "r", "c", and so on).
*/ */
SR_API char **sr_parse_triggerstring(struct sr_dev *dev, SR_API char **sr_parse_triggerstring(const struct sr_dev_inst *sdi,
const char *triggerstring) const char *triggerstring)
{ {
GSList *l; GSList *l;
@ -180,7 +180,7 @@ SR_API char **sr_parse_triggerstring(struct sr_dev *dev,
const char *trigger_types; const char *trigger_types;
gboolean error; gboolean error;
max_probes = g_slist_length(dev->probes); max_probes = g_slist_length(sdi->probes);
error = FALSE; error = FALSE;
if (!(triggerlist = g_try_malloc0(max_probes * sizeof(char *)))) { if (!(triggerlist = g_try_malloc0(max_probes * sizeof(char *)))) {
@ -190,10 +190,9 @@ SR_API char **sr_parse_triggerstring(struct sr_dev *dev,
tokens = g_strsplit(triggerstring, ",", max_probes); tokens = g_strsplit(triggerstring, ",", max_probes);
trigger_types = dev->driver->dev_info_get(0, SR_DI_TRIGGER_TYPES); if (sdi->driver->info_get(SR_DI_TRIGGER_TYPES,
if (!trigger_types) { (const void **)&trigger_types, sdi) != SR_OK) {
sr_err("strutil: %s: Device doesn't support any triggers.", sr_err("strutil: %s: Device doesn't support any triggers.", __func__);
__func__);
return NULL; return NULL;
} }
@ -201,7 +200,7 @@ SR_API char **sr_parse_triggerstring(struct sr_dev *dev,
if (tokens[i][0] < '0' || tokens[i][0] > '9') { if (tokens[i][0] < '0' || tokens[i][0] > '9') {
/* Named probe */ /* Named probe */
probenum = 0; probenum = 0;
for (l = dev->probes; l; l = l->next) { for (l = sdi->probes; l; l = l->next) {
probe = (struct sr_probe *)l->data; probe = (struct sr_probe *)l->data;
if (probe->enabled if (probe->enabled
&& !strncmp(probe->name, tokens[i], && !strncmp(probe->name, tokens[i],