};
static const char *trigger_sources[] = {
- "CH1", "CH2", "EXT", "forced"
+ "CH1", "CH2", "EXT",
};
static const char *trigger_slopes[] = {
devc->voffset_trigger = DEFAULT_VERT_TRIGGERPOS;
devc->framesize = DEFAULT_FRAMESIZE;
devc->triggerslope = SLOPE_POSITIVE;
- devc->triggersource = g_strdup(DEFAULT_TRIGGER_SOURCE);
+ devc->triggersource = NULL;
devc->capture_ratio = DEFAULT_CAPTURE_RATIO;
sdi->priv = devc;
*data = g_variant_new_uint64(devc->framesize);
break;
case SR_CONF_TRIGGER_SOURCE:
+ if (!devc->triggersource)
+ return SR_ERR_NA;
*data = g_variant_new_string(devc->triggersource);
break;
case SR_CONF_TRIGGER_SLOPE:
case SR_CONF_TRIGGER_SOURCE:
if ((idx = std_str_idx(data, ARRAY_AND_SIZE(trigger_sources))) < 0)
return SR_ERR_ARG;
+ g_free(devc->triggersource);
devc->triggersource = g_strdup(trigger_sources[idx]);
break;
default:
return TRUE;
if (dso_enable_trigger(sdi) != SR_OK)
return TRUE;
-// if (dso_force_trigger(sdi) != SR_OK)
-// return TRUE;
+ if (!devc->triggersource) {
+ if (dso_force_trigger(sdi) != SR_OK)
+ return TRUE;
+ }
sr_dbg("Successfully requested next chunk.");
devc->dev_state = CAPTURE;
return TRUE;
break;
if (dso_enable_trigger(sdi) != SR_OK)
break;
- if (!strcmp("forced", devc->triggersource)) {
+ if (!devc->triggersource) {
if (dso_force_trigger(sdi) != SR_OK)
break;
}
memset(cmdstring, 0, sizeof(cmdstring));
/* Command */
cmdstring[0] = CMD_2250_SET_TRIGGERSOURCE;
- sr_dbg("Trigger source %s.", devc->triggersource);
- if (!strcmp("CH2", devc->triggersource))
+ sr_dbg("Trigger source %s.", devc->triggersource ? : "<none>");
+ if (!devc->triggersource)
+ tmp = 0;
+ else if (!strcmp("CH2", devc->triggersource))
tmp = 3;
else if (!strcmp("CH1", devc->triggersource))
tmp = 2;
- else if (!strcmp("EXT", devc->triggersource) || !strcmp("forced", devc->triggersource))
+ else if (!strcmp("EXT", devc->triggersource))
tmp = 0;
else {
sr_err("Invalid trigger source: '%s'.", devc->triggersource);
cmdstring[0] = CMD_SET_TRIGGER_SAMPLERATE;
/* Trigger source */
- sr_dbg("Trigger source %s.", devc->triggersource);
- if (!strcmp("CH2", devc->triggersource))
+ sr_dbg("Trigger source %s.", devc->triggersource ? : "<none>");
+ if (!devc->triggersource)
+ tmp = 2;
+ else if (!strcmp("CH2", devc->triggersource))
tmp = 0;
else if (!strcmp("CH1", devc->triggersource))
tmp = 1;
- else if (!strcmp("EXT", devc->triggersource) || !strcmp("forced", devc->triggersource))
+ else if (!strcmp("EXT", devc->triggersource))
tmp = 2;
else {
sr_err("Invalid trigger source: '%s'.", devc->triggersource);
if (devc->coupling[1] != COUPLING_AC)
relays[6] = ~relays[6];
- if (!strcmp(devc->triggersource, "EXT"))
+ if (devc->triggersource && strcmp(devc->triggersource, "EXT") == 0)
relays[7] = ~relays[7];
if (sr_log_loglevel_get() >= SR_LOG_DBG) {