mpm/mpmd: Report device state using get_init_status() and verify

When trying to run init(), mpmd will first query the initialization
status of the MPM device. If it is found to be in a bad state, it will
not go forward with initialization, but instead print the error message.
This commit is contained in:
Martin Braun 2018-01-16 13:10:37 -08:00
parent 3d2a9ac551
commit 0da3eefcc3
2 changed files with 16 additions and 1 deletions

View file

@ -37,6 +37,15 @@ namespace {
uhd::rpc_client::sptr rpc,
const uhd::device_addr_t mb_args
) {
auto init_status =
rpc->request_with_token<std::vector<std::string>>(
"get_init_status");
if (init_status[0] != "true") {
throw uhd::runtime_error(
std::string("Device is in bad state: ") + init_status[1]
);
}
// TODO maybe put this somewhere else?
const std::set<std::string> key_blacklist{
"serial", "claimed", "type", "rev", "addr"

View file

@ -377,11 +377,17 @@ class PeriphManagerBase(object):
"""
Returns the status of the device after its initialization (that happens
at startup, not that happens when init() is called).
The status is a tuple of 2 strings, the first is either "true" or
"false", depending on whether or not the device initialization was
successful, and the second is an arbitrary error string.
Use this function to figure out if something went wrong at bootup, and
what.
"""
return self._initialization_status
return [
"true" if self._device_initialized else "false",
self._initialization_status
]
@no_claim
def list_available_overlays(self):