]> sigrok.org Git - libsigrok.git/commitdiff
input/trace32_ad: use u64 instead of u32 for samplerate option
authorMarkus Heidelberg <redacted>
Mon, 5 Dec 2022 23:51:20 +0000 (00:51 +0100)
committerGerhard Sittig <redacted>
Sat, 17 Dec 2022 19:10:30 +0000 (20:10 +0100)
The variable type is already u64 so this is consistent now inside of
this module and also with the other input parsers using a samplerate
option.

This also fixes a crash when invoking PulseView with the "samplerate"
command line option because u32 is not yet included in C++ bindings:

$ pulseview -i /dev/null -I trace32_ad:samplerate=1
Exception: internal error

src/input/trace32_ad.c

index 3a4e1cd479996d91396ddc3d91a9c176f6ac53fd..ba89ad2c41b7479586ae7204762cb1a86a5f7f6b 100644 (file)
@@ -163,7 +163,7 @@ static int init(struct sr_input *in, GHashTable *options)
 
        /* Calculate the desired timestamp scaling factor. */
        inc->samplerate = 1000000 *
-               g_variant_get_uint32(g_hash_table_lookup(options, "samplerate"));
+               g_variant_get_uint64(g_hash_table_lookup(options, "samplerate"));
 
        inc->timestamp_scale = ((1 / TIMESTAMP_RESOLUTION) / (double)inc->samplerate);
 
@@ -891,7 +891,7 @@ static const struct sr_option *get_options(void)
                options[9].def = g_variant_ref_sink(g_variant_new_boolean(FALSE));
                options[10].def = g_variant_ref_sink(g_variant_new_boolean(FALSE));
                options[11].def = g_variant_ref_sink(g_variant_new_boolean(FALSE));
-               options[12].def = g_variant_ref_sink(g_variant_new_uint32(DEFAULT_SAMPLERATE));
+               options[12].def = g_variant_ref_sink(g_variant_new_uint64(DEFAULT_SAMPLERATE));
        }
 
        return options;