X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Finput%2Fchronovu_la8.c;h=058d8dd5b5d89d3ac4c43392804f09b3ff476d77;hb=cac58676e987d06b890366ac4078a1e4fb1cbdc3;hp=9adfe61aaab62c7a279e8bbc8e2840ac26ef348f;hpb=06ad20bebf658f97d55cda3ac058f9c336be09df;p=libsigrok.git diff --git a/src/input/chronovu_la8.c b/src/input/chronovu_la8.c index 9adfe61a..058d8dd5 100644 --- a/src/input/chronovu_la8.c +++ b/src/input/chronovu_la8.c @@ -28,7 +28,7 @@ #define LOG_PREFIX "input/chronovu-la8" #define DEFAULT_NUM_CHANNELS 8 -#define DEFAULT_SAMPLERATE "100MHz" +#define DEFAULT_SAMPLERATE 100000000L #define MAX_CHUNK_SIZE 4096 #define CHRONOVU_LA8_FILESIZE 8 * 1024 * 1024 + 5 @@ -44,18 +44,16 @@ static int format_match(GHashTable *metadata) size = GPOINTER_TO_INT(g_hash_table_lookup(metadata, GINT_TO_POINTER(SR_INPUT_META_FILESIZE))); if (size == CHRONOVU_LA8_FILESIZE) - return TRUE; + return SR_OK; - return FALSE; + return SR_ERR; } static int init(struct sr_input *in, GHashTable *options) { struct sr_channel *ch; struct context *inc; - uint64_t samplerate; int num_channels, i; - const char *s; char name[16]; num_channels = g_variant_get_int32(g_hash_table_lookup(options, "numchannels")); @@ -64,15 +62,10 @@ static int init(struct sr_input *in, GHashTable *options) return SR_ERR_ARG; } - s = g_variant_get_string(g_hash_table_lookup(options, "samplerate"), NULL); - if (sr_parse_sizestring(s, &samplerate) != SR_OK) { - sr_err("Invalid samplerate '%s'.", s); - return SR_ERR_ARG; - } - in->sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, NULL, NULL, NULL); in->priv = inc = g_malloc0(sizeof(struct context)); - inc->samplerate = samplerate; + + inc->samplerate = g_variant_get_uint64(g_hash_table_lookup(options, "samplerate")); for (i = 0; i < num_channels; i++) { snprintf(name, 16, "%d", i); @@ -157,7 +150,7 @@ static struct sr_option *get_options(void) { if (!options[0].def) { options[0].def = g_variant_ref_sink(g_variant_new_int32(DEFAULT_NUM_CHANNELS)); - options[1].def = g_variant_ref_sink(g_variant_new_string(DEFAULT_SAMPLERATE)); + options[1].def = g_variant_ref_sink(g_variant_new_uint64(DEFAULT_SAMPLERATE)); } return options;