From ca48070c847fb0b783c4fd27929693c8f6b36d5f Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 9 Oct 2017 00:12:15 +0200 Subject: [PATCH] PlutoSDR: print error string from libiio in console message --- devices/plutosdr/deviceplutosdrbox.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/devices/plutosdr/deviceplutosdrbox.cpp b/devices/plutosdr/deviceplutosdrbox.cpp index 168b6e9aa..7f3038722 100644 --- a/devices/plutosdr/deviceplutosdrbox.cpp +++ b/devices/plutosdr/deviceplutosdrbox.cpp @@ -150,6 +150,7 @@ void DevicePlutoSDRBox::set_params(DeviceType devType, if (ret < 0) { std::string item; + char errstr[256]; switch (type) { @@ -166,7 +167,8 @@ void DevicePlutoSDRBox::set_params(DeviceType devType, item = "unknown"; break; } - std::cerr << "DevicePlutoSDRBox::set_params: Unable to write " << item << " attribute " << key << "=" << val << ": " << ret << std::endl; + iio_strerror(-ret, errstr, 255); + std::cerr << "DevicePlutoSDRBox::set_params: Unable to write " << item << " attribute " << key << "=" << val << ": " << errstr << " (" << ret << ") " << std::endl; } else {