From: Uwe Hermann Date: Thu, 20 Aug 2015 17:47:12 +0000 (+0200) Subject: Pass unitsize to srd_session_send() directly. X-Git-Tag: sigrok-cli-0.6.0~23 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=ee639fb40fa43aa3553ef0229def9bcdb8338c2b;p=sigrok-cli.git Pass unitsize to srd_session_send() directly. Follow an API change in libsigrokdecode where srd_inst_channel_set_all() no longer gets passed a unitsize, but rather srd_session_send() gets it. This allows us to avoid having to guess a unitsize based on the number of channels (which guesses incorrectly in some cases). This fixes (parts of) bug #352. --- diff --git a/decode.c b/decode.c index 4d584d7..e2a0f85 100644 --- a/decode.c +++ b/decode.c @@ -214,7 +214,6 @@ static void map_pd_inst_channels(void *key, void *value, void *user_data) void *channel_target; struct sr_channel *ch; GHashTableIter iter; - int num_channels; channel_map = value; channel_list = user_data; @@ -245,8 +244,7 @@ static void map_pd_inst_channels(void *key, void *value, void *user_data) g_hash_table_insert(channel_indices, g_strdup(channel_id), var); } - num_channels = g_slist_length(channel_list); - srd_inst_channel_set_all(di, channel_indices, (num_channels + 7) / 8); + srd_inst_channel_set_all(di, channel_indices); } void map_pd_channels(struct sr_dev_inst *sdi) diff --git a/session.c b/session.c index b4ff3ff..7fb9399 100644 --- a/session.c +++ b/session.c @@ -281,7 +281,7 @@ void datafeed_in(const struct sr_dev_inst *sdi, if (opt_pds) { #ifdef HAVE_SRD if (srd_session_send(srd_sess, rcvd_samples_logic, end_sample, - logic->data, input_len) != SRD_OK) + logic->data, input_len, logic->unitsize) != SRD_OK) sr_session_stop(session); #endif }