Commit 503519b7 authored by Gerhard Sittig's avatar Gerhard Sittig Committed by Uwe Hermann

lsr/es51919: support channel selection (enable/disable P1/P2)

Upon reception of serial data from the ES51919 LCR chipset, the data for
channels P1 and P2 was extracted from the packet, and unconditionally got
sent to the sigrok session.

Do check the channels' enabled state before submission. This fixes for
serial-lcr what recently got reported for a Brymen DMM. Tested with

  $ sigrok-cli -d peaktech-2170:conn=/dev/ttyUSB0 --channels P2

and other --channels specifications.
parent 12788e7e
......@@ -593,6 +593,7 @@ static void handle_packet(struct sr_dev_inst *sdi, const uint8_t *pkt)
unsigned int val;
float floatval;
gboolean frame;
struct sr_channel *channel;
devc = sdi->priv;
......@@ -620,10 +621,11 @@ static void handle_packet(struct sr_dev_inst *sdi, const uint8_t *pkt)
analog.num_samples = 1;
analog.data = &floatval;
analog.meaning->channels = g_slist_append(NULL, sdi->channels->data);
channel = sdi->channels->data;
analog.meaning->channels = g_slist_append(NULL, channel);
parse_measurement(pkt, &floatval, &analog, 0);
if (analog.meaning->mq != 0) {
if (analog.meaning->mq != 0 && channel->enabled) {
if (!frame) {
packet.type = SR_DF_FRAME_BEGIN;
sr_session_send(sdi, &packet);
......@@ -637,10 +639,12 @@ static void handle_packet(struct sr_dev_inst *sdi, const uint8_t *pkt)
}
g_slist_free(analog.meaning->channels);
analog.meaning->channels = g_slist_append(NULL, sdi->channels->next->data);
channel = sdi->channels->next->data;
analog.meaning->channels = g_slist_append(NULL, channel);
parse_measurement(pkt, &floatval, &analog, 1);
if (analog.meaning->mq != 0) {
if (analog.meaning->mq != 0 && channel->enabled) {
if (!frame) {
packet.type = SR_DF_FRAME_BEGIN;
sr_session_send(sdi, &packet);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment