]> sigrok.org Git - libsigrok.git/commitdiff
don't just assume a device has a samplerate setting
authorBert Vermeulen <redacted>
Tue, 1 Feb 2011 01:33:54 +0000 (02:33 +0100)
committerBert Vermeulen <redacted>
Tue, 1 Feb 2011 01:33:54 +0000 (02:33 +0100)
output/output_analog.c
output/output_gnuplot.c
output/output_ols.c
output/output_vcd.c
output/text/text.c

index 40d5218105db54e3db890bcc16d198fa4cf99ec6..f00bffa342f0ffd8f6175d1a735c0e11985b676d 100644 (file)
@@ -133,7 +133,7 @@ static int init(struct sr_output *o, int default_spl, enum outputmode mode)
 
        snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING);
        num_probes = g_slist_length(o->device->probes);
-       if (o->device->plugin) {
+       if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
                samplerate = *((uint64_t *) o->device->plugin->get_device_info(
                                o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(samplerate_s = sr_samplerate_string(samplerate))) {
index 2945f949723c028f2cc2229a070eacf57bb2281f..440e848c8c1d59bcb7e91b7733841a40797e81d6 100644 (file)
@@ -79,7 +79,7 @@ static int init(struct sr_output *o)
 
        num_probes = g_slist_length(o->device->probes);
        comment[0] = '\0';
-       if (o->device->plugin) {
+       if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
                samplerate = *((uint64_t *) o->device->plugin->get_device_info(
                                o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(frequency_s = sr_samplerate_string(samplerate))) {
@@ -226,7 +226,7 @@ static int analog_init(struct sr_output *o)
 
        num_probes = g_slist_length(o->device->probes);
        comment[0] = '\0';
-       if (o->device->plugin) {
+       if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
                samplerate = *((uint64_t *) o->device->plugin->get_device_info(
                                o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(frequency_s = sr_samplerate_string(samplerate))) {
index 6c4876d47b80fed80ab32a2e78e85dbdb70f9978..55230bf3f29934f76ff8e93954d7045d5c290d7d 100644 (file)
@@ -102,7 +102,7 @@ static int init(struct sr_output *o)
 
        /* TODO: Currently not available in the demo module. */
 
-       if (o->device->plugin) {
+       if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
                samplerate = *((uint64_t *) o->device->plugin->get_device_info(
                                o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(frequency_s = sr_samplerate_string(samplerate))) {
index c6d1655d1409e10a0be38503458b248473b0bea2..f34eaa8c1a31c93c10c28de53badc3d155770866 100644 (file)
@@ -91,7 +91,7 @@ static int init(struct sr_output *o)
        g_string_append_printf(ctx->header, "$version %s %s $end\n",
                        PACKAGE, PACKAGE_VERSION);
 
-       if (o->device->plugin) {
+       if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
                ctx->samplerate = *((uint64_t *) o->device->plugin->get_device_info(
                                o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!((samplerate_s = sr_samplerate_string(ctx->samplerate)))) {
index ded3adf17647f4cc1a4c15965a4090997282683f..da41b7334e6ba50434c5bcaaaa431ed4018aabfe 100644 (file)
@@ -107,7 +107,7 @@ int init(struct sr_output *o, int default_spl, enum outputmode mode)
 
        snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING);
        num_probes = g_slist_length(o->device->probes);
-       if (o->device->plugin) {
+       if (o->device->plugin || device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
                samplerate = *((uint64_t *) o->device->plugin->get_device_info(
                                o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(samplerate_s = sr_samplerate_string(samplerate))) {