From: Gerhard Sittig Date: Sun, 16 Oct 2022 10:35:08 +0000 (+0200) Subject: kingst-la2016: unbreak streaming mode for LA5032 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=4c1bfdf3e9cca9e0ee61bd8ed4925fc5cac14fc5;p=libsigrok.git kingst-la2016: unbreak streaming mode for LA5032 The Kingst LA series models share the same streaming mode memory layout. All channels' chunks are 16 bits wide. The previous version worked for 16-channel devices, this change unbreaks the 32-channel device LA5032. This fixes the streaming aspect of bug #1805. Reported-By: Roman Shishkin --- diff --git a/src/hardware/kingst-la2016/protocol.c b/src/hardware/kingst-la2016/protocol.c index 472fca72..8748980a 100644 --- a/src/hardware/kingst-la2016/protocol.c +++ b/src/hardware/kingst-la2016/protocol.c @@ -1461,30 +1461,15 @@ static void stream_data(struct sr_dev_inst *sdi, /* TODO Add soft trigger support when in stream mode? */ - /* - * TODO Are memory cells always as wide as the channel count? - * Are they always 16bits wide? Verify for 32 channel devices. - */ - bit_count = devc->model->channel_count; - if (bit_count == 32) { - data_length /= sizeof(uint32_t); - } else if (bit_count == 16) { - data_length /= sizeof(uint16_t); - } else { - /* - * Unhandled case. Acquisition should not start. - * The statement silences the compiler. - */ - return; - } + /* All channels' chunks carry 16 samples for one channel. */ + bit_count = 16; + data_length /= sizeof(uint16_t); + rp = data_buffer; sample_value = 0; while (data_length--) { /* Get another entity. */ - if (bit_count == 32) - sample_value = read_u32le_inc(&rp); - else if (bit_count == 16) - sample_value = read_u16le_inc(&rp); + sample_value = read_u16le_inc(&rp); /* Map the entity's bits to a channel's samples. */ ch_mask = stream->channel_masks[stream->channel_index];