From: Uwe Hermann Date: Tue, 16 Apr 2013 13:42:45 +0000 (+0200) Subject: chronovu-la8: Fix incorrect 0Hz samplerate being reported. X-Git-Tag: dsupstream~123 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=415e6389ce2d57e9559a04f0e3523d111843a618;p=libsigrok.git chronovu-la8: Fix incorrect 0Hz samplerate being reported. This closes bug #93. --- diff --git a/hardware/chronovu-la8/api.c b/hardware/chronovu-la8/api.c index 53acf0b8..08e06c32 100644 --- a/hardware/chronovu-la8/api.c +++ b/hardware/chronovu-la8/api.c @@ -28,12 +28,13 @@ SR_PRIV struct sr_dev_driver chronovu_la8_driver_info; static struct sr_dev_driver *di = &chronovu_la8_driver_info; -/* This will be initialized via config_list()/SR_CONF_SAMPLERATE. +/* + * This will be initialized via config_list()/SR_CONF_SAMPLERATE. * * Min: 1 sample per 0.01us -> sample time is 0.084s, samplerate 100MHz * Max: 1 sample per 2.55us -> sample time is 21.391s, samplerate 392.15kHz */ -SR_PRIV uint64_t chronovu_la8_samplerates[255 + 1] = { 0 }; +SR_PRIV uint64_t chronovu_la8_samplerates[255] = { 0 }; /* Note: Continuous sampling is not supported by the hardware. */ SR_PRIV const int32_t chronovu_la8_hwcaps[] = { @@ -353,14 +354,16 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi) switch (key) { case SR_CONF_DEVICE_OPTIONS: *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - chronovu_la8_hwcaps, ARRAY_SIZE(chronovu_la8_hwcaps), + chronovu_la8_hwcaps, + ARRAY_SIZE(chronovu_la8_hwcaps), sizeof(int32_t)); break; case SR_CONF_SAMPLERATE: fill_supported_samplerates_if_needed(); g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}")); gvar = g_variant_new_fixed_array(G_VARIANT_TYPE("t"), - chronovu_la8_samplerates, ARRAY_SIZE(chronovu_la8_samplerates), + chronovu_la8_samplerates, + ARRAY_SIZE(chronovu_la8_samplerates), sizeof(uint64_t)); g_variant_builder_add(&gvb, "{sv}", "samplerates", gvar); *data = g_variant_builder_end(&gvb); diff --git a/hardware/chronovu-la8/protocol.c b/hardware/chronovu-la8/protocol.c index d106b336..b4a9138d 100644 --- a/hardware/chronovu-la8/protocol.c +++ b/hardware/chronovu-la8/protocol.c @@ -39,7 +39,6 @@ SR_PRIV void fill_supported_samplerates_if_needed(void) for (i = 0; i < 255; i++) chronovu_la8_samplerates[254 - i] = SR_MHZ(100) / (i + 1); - chronovu_la8_samplerates[255] = 0; } /**