On 07/01/2015 10:19 AM, Piotr Krysik wrote: > Hi all, > > UHD host library generates prints on the stdout. For example on each > retune I get something like: > > -- Tune Request: 959.000000 MHz > -- The RF LO does not support the requested frequency: > -- Requested LO Frequency: 959.000000 MHz > -- RF LO Result: 958.998779 MHz > -- Attempted to use the DSP to reach the requested frequency: > -- Desired DSP Frequency: -0.001221 MHz > -- DSP Result: -0.001221 MHz > -- Successfully tuned to 959.000000 MHz > These prints are sometimes cluttering the console - especially when > someone wants to use console to print other useful information. > > There is possibility to disable them in UHD from the level of C++: > http://files.ettus.com/manual/page_general.html > ("Disabling or redirecting prints to stdout") > > Is it possible to disable the prints from GNU Radio?
I had looked into that some time ago. In the current form it is not possible. Even if ' uhd::msg::register_handler' would be exposed to python, you still can't drop-in your own null-handler. Swig doesn't support callbacks in the target language (python). However, you can add custom handlers like a null_handler in C++ and then use that. Try the attached patch. Works for me. Only output left is that standard version_string. Sebastian
>From 222df48d16d03447ef7e6452c046e349cbc0936c Mon Sep 17 00:00:00 2001 From: Sebastian Koslowski <koslow...@kit.edu> Date: Thu, 2 Jul 2015 16:42:35 +0200 Subject: [PATCH] uhd: add null msg handler and expose to python --- gr-uhd/swig/uhd_swig.i | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 108f544..6c73ba3 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -68,6 +68,14 @@ %include <uhd/utils/pimpl.hpp> +%{ +#include <uhd/utils/msg.hpp> +static void null_msg_handler(uhd::msg::type_t type, const std::string &msg){} +%} +%constant void null_msg_handler(uhd::msg::type_t type, const std::string &msg); +%rename(register_msg_handler) register_handler(const handler_t &handler); +%include <uhd/utils/msg.hpp> + %ignore uhd::dict::operator[]; //ignore warnings about %extend %include <uhd/types/dict.hpp> %template(string_string_dict_t) uhd::dict<std::string, std::string>; //define after dict -- 1.9.3
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio