]> sigrok.org Git - libsigrok.git/commitdiff
rdtech-dps: Make it work in SmuView
authorv1ne <redacted>
Fri, 3 Apr 2020 01:51:09 +0000 (03:51 +0200)
committerUwe Hermann <redacted>
Sat, 4 Apr 2020 21:25:25 +0000 (23:25 +0200)
Without the mutex, concurrent reception from the ModBus port leads to CRC
errors.

src/hardware/rdtech-dps/api.c

index 9a08c792a35cd4fc6ab8f838bd8a0a519b78b275..fad31d629434ef5ae99f166305fd6ba1e7a5e5ec 100644 (file)
@@ -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;