X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fdemo%2Fdemo.c;h=f1b97d21829bbf26ddfcaf954d05c23a67ac53b6;hb=3be42bc22f8b36599a448273c12a76d3e0f7a940;hp=1b25872755a451dcecaa0ed242fc4b08010fea0b;hpb=5faebab2903dc91949edc31f0a4b118d86090a30;p=libsigrok.git diff --git a/src/hardware/demo/demo.c b/src/hardware/demo/demo.c index 1b258727..f1b97d21 100644 --- a/src/hardware/demo/demo.c +++ b/src/hardware/demo/demo.c @@ -38,7 +38,7 @@ /* Size of the analog pattern space per channel. */ #define ANALOG_BUFSIZE 4096 -#define DEFAULT_ANALOG_AMPLITUDE 25 +#define DEFAULT_ANALOG_AMPLITUDE 10 #define ANALOG_SAMPLES_PER_PERIOD 20 /* Logic patterns we can generate. */ @@ -784,8 +784,8 @@ static int prepare_data(int fd, int revents, void *cb_data) */ todo_us = samples_todo * G_USEC_PER_SEC / devc->cur_samplerate; - logic_done = 0; - analog_done = 0; + logic_done = devc->num_logic_channels > 0 ? 0 : samples_todo; + analog_done = devc->num_analog_channels > 0 ? 0 : samples_todo; while (logic_done < samples_todo || analog_done < samples_todo) { /* Logic */ @@ -880,17 +880,11 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) { - struct sr_datafeed_packet packet; - (void)cb_data; sr_dbg("Stopping acquisition."); - sr_session_source_remove(sdi->session, -1); - - /* Send last packet. */ - packet.type = SR_DF_END; - sr_session_send(sdi, &packet); + std_session_send_df_end(sdi, LOG_PREFIX); return SR_OK; }