Esempio n. 1
0
static std::string get_mboard_pp_string(property_tree::sptr tree, const fs_path &path){
    std::stringstream ss;
    ss << boost::format("Mboard: %s") % (tree->access<std::string>(path / "name").get()) << std::endl;

    if (tree->exists(path / "eeprom")){
        usrp::mboard_eeprom_t mb_eeprom = tree->access<usrp::mboard_eeprom_t>(path / "eeprom").get();
        for(const std::string &key:  mb_eeprom.keys()){
            if (not mb_eeprom[key].empty()) ss << boost::format("%s: %s") % key % mb_eeprom[key] << std::endl;
        }
    } else {
        ss << "No mboard EEPROM found." << std::endl;
    }
    if (tree->exists(path / "fw_version")){
        ss << "FW Version: " << tree->access<std::string>(path / "fw_version").get() << std::endl;
    }
    if (tree->exists(path / "fpga_version")){
        ss << "FPGA Version: " << tree->access<std::string>(path / "fpga_version").get() << std::endl;
    }
    if (tree->exists(path / "fpga_version_hash")){
        ss << "FPGA git hash: " << tree->access<std::string>(path / "fpga_version_hash").get() << std::endl;
    }
    if (tree->exists(path / "xbar")){
        ss << "RFNoC capable: Yes" << std::endl;
    }
    ss << std::endl;
    try {
        if (tree->exists(path / "time_source" / "options")){
            const std::vector< std::string > time_sources  = tree->access<std::vector<std::string> >(path / "time_source" / "options").get();
            ss << "Time sources:  " << prop_names_to_pp_string(time_sources)  << std::endl;
        }
        if (tree->exists(path / "clock_source" / "options")){
            const std::vector< std::string > clock_sources = tree->access<std::vector<std::string> >(path / "clock_source" / "options").get();
            ss << "Clock sources: " << prop_names_to_pp_string(clock_sources) << std::endl;
        }
        if (tree->exists(path / "sensors")){
            ss << "Sensors: " << prop_names_to_pp_string(tree->list(path / "sensors")) << std::endl;
        }
        if (tree->exists(path / "rx_dsps")){
            for(const std::string &name:  tree->list(path / "rx_dsps")){
                ss << make_border(get_dsp_pp_string("RX", tree, path / "rx_dsps" / name));
            }
        }
        if (tree->exists(path / "dboards")) {
            for(const std::string &name:  tree->list(path / "dboards")){
                ss << make_border(get_dboard_pp_string("RX", tree, path / "dboards" / name));
            }
            if (tree->exists(path / "tx_dsps")){
                for(const std::string &name:  tree->list(path / "tx_dsps")){
                    ss << make_border(get_dsp_pp_string("TX", tree, path / "tx_dsps" / name));
                }
            }
            for(const std::string &name:  tree->list(path / "dboards")){
                ss << make_border(get_dboard_pp_string("TX", tree, path / "dboards" / name));
            }
        }
        if (tree->exists(path / "xbar")){
            ss << make_border(get_rfnoc_pp_string(tree, path / "xbar"));
        }
    }
    catch (const uhd::lookup_error& ex) {
        std::cout << "Exited device probe on " << ex.what() << std::endl;
    }
    return ss.str();
}