From: Olivier Fauchon Date: Tue, 11 Jan 2011 23:25:15 +0000 (+0100) Subject: add ontinuous mode for demo driver X-Git-Tag: libsigrok-0.1.0~445 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=ba3d481bb78a3bdb009c8d0aed3885a0a0192a04;p=libsigrok.git add ontinuous mode for demo driver --- diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 05b44a35..dcf5e7c2 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -48,6 +48,7 @@ static int capabilities[] = { HWCAP_LOGIC_ANALYZER, HWCAP_SAMPLERATE, HWCAP_LIMIT_SAMPLES, + HWCAP_CONTINUOUS }; /* Random selection of samplerates this "device" shall support. */ @@ -83,7 +84,7 @@ static GSList *device_instances = NULL; /* TODO: All of these should go in a device-specific struct. */ static uint64_t cur_samplerate = 0; -static uint64_t limit_samples = 0; +static uint64_t limit_samples = -1; // static uint8_t probe_mask = 0; // static uint8_t trigger_mask[NUM_TRIGGER_STAGES] = { 0 }; // static uint8_t trigger_value[NUM_TRIGGER_STAGES] = { 0 }; @@ -227,7 +228,10 @@ static void thread_func(void *data) uint64_t nb_to_send = 0; while (thread_running) { - nb_to_send = limit_samples - mydata->samples_counter; + if (limit_samples) + nb_to_send = limit_samples - mydata->samples_counter; + else + nb_to_send = BUFSIZE; // CONTINUOUS MODE if (nb_to_send == 0) { close(mydata->pipe_fds[1]);