]> sigrok.org Git - libsigrok.git/blobdiff - hardware/demo/demo.c
Unify all SR_HWOPT_* and SR_HWCAP_* enums.
[libsigrok.git] / hardware / demo / demo.c
index aac585a2f3212311372ab617d8bd0dc409a3a194..c1a5a4138d6ac04e637addc64c18638d48d85b5d 100644 (file)
@@ -111,14 +111,7 @@ static const char *pattern_strings[] = {
 
 /* We name the probes 0-7 on our demo driver. */
 static const char *probe_names[NUM_PROBES + 1] = {
-       "0",
-       "1",
-       "2",
-       "3",
-       "4",
-       "5",
-       "6",
-       "7",
+       "0", "1", "2", "3", "4", "5", "6", "7",
        NULL,
 };
 
@@ -242,12 +235,6 @@ static int hw_info_get(int info_id, const void **data,
        case SR_DI_HWCAPS:
                *data = hwcaps;
                break;
-       case SR_DI_NUM_PROBES:
-               *data = GINT_TO_POINTER(NUM_PROBES);
-               break;
-       case SR_DI_PROBE_NAMES:
-               *data = probe_names;
-               break;
        case SR_DI_SAMPLERATES:
                *data = &samplerates;
                break;
@@ -389,11 +376,8 @@ static int receive_data(int fd, int revents, void *cb_data)
                devc->samples_counter += sending_now;
        }
 
-
-       if (devc->samples_counter >= limit_samples) {
-               sr_spew("We sent a total of %" PRIu64 " samples.",
-                       devc->samples_counter);
-               /* Make sure we don't receive more packets. */
+       if (limit_samples && devc->samples_counter >= limit_samples) {
+               sr_info("Requested number of samples reached.");
                hw_dev_acquisition_stop(NULL, cb_data);
                return TRUE;
        }
@@ -406,7 +390,6 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
 {
        struct sr_datafeed_packet *packet;
        struct sr_datafeed_header *header;
-       struct sr_datafeed_meta_logic meta;
        struct dev_context *devc;
 
        (void)sdi;
@@ -468,13 +451,6 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
        gettimeofday(&header->starttime, NULL);
        sr_session_send(devc->session_dev_id, packet);
 
-       /* Send metadata about the SR_DF_LOGIC packets to come. */
-       packet->type = SR_DF_META_LOGIC;
-       packet->payload = &meta;
-       meta.samplerate = cur_samplerate;
-       meta.num_probes = NUM_PROBES;
-       sr_session_send(devc->session_dev_id, packet);
-
        /* We use this timestamp to decide how many more samples to send. */
        devc->starttime = g_get_monotonic_time();