Re: [Discuss-gnuradio] Suppressing UHD prints
@Sebastion 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). This seems precisely what I have observed working with my example from my question on 7/2/2015 message passing: strobe or _post? I use a Python method as a callback given to block.set_msg_handler. This is certainly called when I use the message strobe to input a message to the block, but not when using _post. Is this some new feature? Or am I wrong that the operation is the same? Jared. -- Jared Dulmage Engineering Specialist Digital Comm. and Implementation Dept. Aerospace Corporation 310-336-3140 ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Re: [Discuss-gnuradio] Suppressing UHD prints
On 07/06/2015 07:25 PM, Jared Dulmage wrote: @Sebastion 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). This seems precisely what I have observed working with my example from my question on 7/2/2015 message passing: strobe or _post? I use a Python method as a callback given to block.set_msg_handler. This is certainly called when I use the message strobe to input a message to the block, but not when using _post. Is this some new feature? Or am I wrong that the operation is the same? Well SWIG not supporting it (see [1]) doesn't mean one can't write custom code to run Python from the C end. Python blocks are implemented via a gateway [2] to do this. Sebastian [1] http://www.swig.org/Doc3.0/SWIGDocumentation.html#SWIG_nn30 [2] https://github.com/gnuradio/gnuradio/blob/master/gnuradio-runtime/lib/block_gateway_impl.cc -- Karlsruhe Institute of Technology (KIT) Communications Engineering Lab (CEL) Dipl.-Ing. Sebastian Koslowski Research Associate Kaiserstraße 12 Building 05.01 76131 Karlsruhe, Germany Phone: +49 721 608-46275 Fax: +49 721 608-46071 Email: sebastian.koslow...@kit.edu Web: http://www.cel.kit.edu/ KIT – University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Re: [Discuss-gnuradio] Suppressing UHD prints
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.00 MHz -- The RF LO does not support the requested frequency: -- Requested LO Frequency: 959.00 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.00 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::dictstd::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
[Discuss-gnuradio] Suppressing UHD prints
Hi all, UHD host library generates prints on the stdout. For example on each retune I get something like: -- Tune Request: 959.00 MHz -- The RF LO does not support the requested frequency: -- Requested LO Frequency: 959.00 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.00 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? Best Regards, Piotr Krysik ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio