From 60fb5d5f1377f5a4af7e1e55b1ec83fed864153f Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Fri, 4 Dec 2020 13:53:34 +0100 Subject: python: Add find() to the Python API This a mapping of uhd::device::find() into uhd.find() on the Python side. The uhd::device is intentionally not mapped into Python (prefer MultiUSRP or RfnocGraph instead), so the namespace is moved up one level. Example: >>> import uhd >>> # Now print the device args for all found B200s: >>> for dev_args in uhd.find("type=b200")): print(dev_args.to_string()) --- host/python/pyuhd.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'host/python/pyuhd.cpp') diff --git a/host/python/pyuhd.cpp b/host/python/pyuhd.cpp index eadb88d40..ca06f2d97 100644 --- a/host/python/pyuhd.cpp +++ b/host/python/pyuhd.cpp @@ -14,6 +14,7 @@ namespace py = pybind11; #include "cal/cal_python.hpp" +#include "device_python.hpp" #include "property_tree_python.hpp" #include "rfnoc/ddc_block_control_python.hpp" #include "rfnoc/duc_block_control_python.hpp" @@ -61,6 +62,9 @@ PYBIND11_MODULE(libpyuhd, m) // (otherwise we will see segmentation faults) init_numpy(); + // Register uhd::device::find + export_device(m); + // Register paths submodule auto paths_module = m.def_submodule("paths", "Path Utilities"); export_paths(paths_module); -- cgit v1.2.3