From 127302453ed5bc5beefc879da94a4a3be5d5bcfd Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Fri, 24 Jun 2016 15:33:19 +0200 Subject: [PATCH] plugins/fmcomms2: Workaround in_out_voltage_filter_fir_en with latest libiio Temporary Workaround Signed-off-by: Michael Hennerich --- plugins/fmcomms2.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/fmcomms2.c b/plugins/fmcomms2.c index cd5735e65..9780627f9 100644 --- a/plugins/fmcomms2.c +++ b/plugins/fmcomms2.c @@ -573,8 +573,13 @@ static void filter_fir_update(void) { bool rx = false, tx = false, rxtx = false; struct iio_channel *chn; + int ret; + + ret = iio_device_attr_read_bool(dev, "in_out_voltage_filter_fir_en", &rxtx); - iio_device_attr_read_bool(dev, "in_out_voltage_filter_fir_en", &rxtx); + if (ret < 0) + iio_channel_attr_read_bool(iio_device_find_channel(dev, "out", false), + "voltage_filter_fir_en", &rxtx); chn = iio_device_find_channel(dev, "voltage0", false); if (chn) @@ -596,6 +601,7 @@ static void filter_fir_update(void) static void filter_fir_enable(GtkToggleButton *button, gpointer data) { bool rx, tx, rxtx, disable; + int ret; if (gtk_toggle_button_get_active(button)) return; @@ -606,8 +612,11 @@ static void filter_fir_enable(GtkToggleButton *button, gpointer data) disable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (disable_all_fir_filters)); if (rxtx || disable) { - iio_device_attr_write_bool(dev, + ret = iio_device_attr_write_bool(dev, "in_out_voltage_filter_fir_en", rxtx); + if (ret < 0) + iio_channel_attr_write_bool(iio_device_find_channel(dev, "out", false), + "voltage_filter_fir_en", rxtx); } else { struct iio_channel *chn; if (rx) {