From 69c5d959e75b9bf9689be39da0dd8abd6078d89a Mon Sep 17 00:00:00 2001 From: v1ne Date: Fri, 3 Apr 2020 03:51:09 +0200 Subject: [PATCH] rdtech-dps: Make it work in SmuView Without the mutex, concurrent reception from the ModBus port leads to CRC errors. --- src/hardware/rdtech-dps/api.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hardware/rdtech-dps/api.c b/src/hardware/rdtech-dps/api.c index 9a08c792..fad31d62 100644 --- a/src/hardware/rdtech-dps/api.c +++ b/src/hardware/rdtech-dps/api.c @@ -305,7 +305,9 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc = sdi->priv; /* Prefill actual states */ + g_mutex_lock(&devc->rw_mutex); ret = rdtech_dps_read_holding_registers(modbus, REG_PROTECT, 3, registers); + g_mutex_unlock(&devc->rw_mutex); if (ret != SR_OK) return ret; devc->actual_ovp_state = RB16(registers + 0) == STATE_OVP;