From 20d4c76e6520c8583c39200da415e5b46c497a2f Mon Sep 17 00:00:00 2001 From: Dnechita Date: Tue, 3 Jun 2014 15:19:03 +0000 Subject: [PATCH] iio_widget: Allow iio_widgets to read negative values from attributes Iio widgets with positive range and inverted scale as parameter can now read negative values from attributes. This fixes TX attenuations widgets in FMComms2 plugin to update properly. --- iio_widget.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iio_widget.c b/iio_widget.c index 9d5c38a2c..7d50fbccf 100644 --- a/iio_widget.c +++ b/iio_widget.c @@ -96,6 +96,8 @@ static void iio_spin_button_update(struct iio_widget *widget) /* if the setting is negative, and it can be set negative */ if (mag < 0 && min < 0) freq *= -1; + else if (min >= 0) + freq *= -1; } gtk_spin_button_set_value(GTK_SPIN_BUTTON (widget->widget), freq);