struct context *inc;
int type;
size_t count, idx;
- char name[4];
+ char name[24];
struct sr_channel *ch;
inc = in->priv;
diff_time /= inc->logic_state.l2d.sample_period;
diff_time += 0.5;
count = (uint64_t)diff_time;
- digital = inc->feed.last.digital;
- rc = addto_feed_buffer_logic(in, digital, count);
- if (rc)
- return rc;
- inc->feed.last.time = next_time;
+ if (count) {
+ digital = inc->feed.last.digital;
+ rc = addto_feed_buffer_logic(in, digital, count);
+ if (rc)
+ return rc;
+ inc->feed.last.time = next_time;
+ }
inc->feed.last.digital = 1 - inc->feed.last.digital;
return SR_OK;
case STAGE_L2A_FIRST_VALUE:
static const char *zip_ext = ".sal";
static const char *bin_ext = ".bin";
+ gboolean matched;
const char *fn;
size_t fn_len, ext_len;
const char *ext_pos;
GString *buf;
+ matched = FALSE;
+
/* Weak match on the filename (when available). */
fn = g_hash_table_lookup(metadata, GINT_TO_POINTER(SR_INPUT_META_FILENAME));
if (fn && *fn) {
ext_len = strlen(zip_ext);
ext_pos = &fn[fn_len - ext_len];
if (fn_len >= ext_len && g_ascii_strcasecmp(ext_pos, zip_ext) == 0) {
- if (SALEAE_WITH_SAL_SUPPORT)
+ if (SALEAE_WITH_SAL_SUPPORT) {
*confidence = 10;
+ matched = TRUE;
+ }
}
ext_len = strlen(bin_ext);
ext_pos = &fn[fn_len - ext_len];
if (fn_len >= ext_len && g_ascii_strcasecmp(ext_pos, bin_ext) == 0) {
*confidence = 50;
+ matched = TRUE;
}
}
case FMT_LOGIC2_DIGITAL:
case FMT_LOGIC2_ANALOG:
*confidence = 1;
+ matched = TRUE;
break;
default:
/* EMPTY */
break;
}
- return SR_OK;
+ return matched ? SR_OK : SR_ERR_DATA;
}
static int init(struct sr_input *in, GHashTable *options)
{
struct context *inc;
struct context_options save_opts;
+ GSList *save_channels;
if (!in)
return;
/* Clear internal state, but keep what .init() has provided. */
save_opts = inc->options;
+ save_channels = inc->module_state.prev_channels;
memset(inc, 0, sizeof(*inc));
inc->options = save_opts;
+ inc->module_state.prev_channels = save_channels;
}
static int reset(struct sr_input *in)
*/
cleanup(in);
in->sdi->channels = inc->module_state.prev_channels;
+ inc->module_state.prev_channels = NULL;
inc->module_state.got_header = FALSE;
inc->module_state.header_sent = FALSE;