]> sigrok.org Git - libsigrok.git/commitdiff
Sigma: Update set_configuration to reflect API.
authorHåvard Espeland <redacted>
Tue, 18 Jan 2011 22:12:57 +0000 (23:12 +0100)
committerHåvard Espeland <redacted>
Tue, 18 Jan 2011 22:12:57 +0000 (23:12 +0100)
hardware/asix-sigma/asix-sigma.c
hardware/asix-sigma/asix-sigma.h

index b549c22fb17d756530bb3603a0085fd88b7f7888..3828d55a3a72074a7dda95e95057e15bafc44302 100644 (file)
@@ -760,11 +760,17 @@ static int hw_set_configuration(int device_index, int capability, void *value)
        } else if (capability == HWCAP_PROBECONFIG) {
                ret = configure_probes(sdi, value);
        } else if (capability == HWCAP_LIMIT_MSEC) {
-               sigma->limit_msec = strtoull(value, NULL, 10);
-               ret = SIGROK_OK;
+               sigma->limit_msec = *(uint64_t*) value;
+               if (sigma->limit_msec > 0)
+                       ret = SIGROK_OK;
+               else
+                       ret = SIGROK_ERR;
        } else if (capability == HWCAP_CAPTURE_RATIO) {
-               sigma->capture_ratio = strtoull(value, NULL, 10);
-               ret = SIGROK_OK;
+               sigma->capture_ratio = *(uint64_t*) value;
+               if (sigma->capture_ratio < 0 || sigma->capture_ratio > 100)
+                       ret = SIGROK_ERR;
+               else
+                       ret = SIGROK_OK;
        } else {
                ret = SIGROK_ERR;
        }
@@ -951,7 +957,7 @@ static int receive_data(int fd, int revents, void *user_data)
        const int chunks_per_read = 32;
        unsigned char buf[chunks_per_read * CHUNK_SIZE];
        int bufsz, numchunks, i, newchunks;
-       uint32_t running_msec;
+       uint64_t running_msec;
        struct timeval tv;
 
        fd = fd;
index c4f31e822775f79f2ad48c7bf3e03aac6efce136..10152bf581af987a28612e60b03872fbf4122636 100644 (file)
@@ -176,7 +176,7 @@ struct sigma_state {
 struct sigma {
        struct ftdi_context ftdic;
        uint64_t cur_samplerate;
-       uint32_t limit_msec;
+       uint64_t limit_msec;
        struct timeval start_tv;
        int cur_firmware;
        int num_probes;