From: v1ne Date: Fri, 3 Apr 2020 01:51:09 +0000 (+0200) Subject: rdtech-dps: Make it work in SmuView X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=69c5d959e75b9bf9689be39da0dd8abd6078d89a;p=libsigrok.git rdtech-dps: Make it work in SmuView Without the mutex, concurrent reception from the ModBus port leads to CRC errors. --- 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;