X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fcolead-slm%2Fprotocol.c;h=c0494fbec805054a813be2dfed3e94955fe0dfd6;hb=ee1b6054d6d6a00698ddae421eae63019c452b6d;hp=f29d1bb95570c35764aaff411e6cebd8add92ea2;hpb=c1aae90038456a61d0f9313d34e6107c3440d3e7;p=libsigrok.git diff --git a/src/hardware/colead-slm/protocol.c b/src/hardware/colead-slm/protocol.c index f29d1bb9..c0494fbe 100644 --- a/src/hardware/colead-slm/protocol.c +++ b/src/hardware/colead-slm/protocol.c @@ -17,6 +17,7 @@ * along with this program. If not, see . */ +#include #include #include #include @@ -28,7 +29,7 @@ static void process_packet(const struct sr_dev_inst *sdi) { struct dev_context *devc; struct sr_datafeed_packet packet; - struct sr_datafeed_analog analog; + struct sr_datafeed_analog_old analog; GString *dbg; float fvalue; int checksum, mode, i; @@ -70,7 +71,7 @@ static void process_packet(const struct sr_dev_inst *sdi) } fvalue /= 10; - memset(&analog, 0, sizeof(struct sr_datafeed_analog)); + memset(&analog, 0, sizeof(struct sr_datafeed_analog_old)); analog.mq = SR_MQ_SOUND_PRESSURE_LEVEL; analog.unit = SR_UNIT_DECIBEL_SPL; analog.channels = sdi->channels; @@ -166,15 +167,14 @@ static void process_packet(const struct sr_dev_inst *sdi) return; } - packet.type = SR_DF_ANALOG; + packet.type = SR_DF_ANALOG_OLD; packet.payload = &analog; - sr_session_send(devc->cb_data, &packet); + sr_session_send(sdi, &packet); - devc->num_samples++; - if (devc->num_samples >= devc->limit_samples) - sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi, - devc->cb_data); + sr_sw_limits_update_samples_read(&devc->limits, 1); + if (sr_sw_limits_check(&devc->limits)) + sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi); } SR_PRIV int colead_slm_receive_data(int fd, int revents, void *cb_data)