From 91073787b1a292d038bf1bd4d460aa8ddcfc8b16 Mon Sep 17 00:00:00 2001 From: Virendra Kakade Date: Tue, 30 Apr 2019 17:11:15 -0500 Subject: mpm: Add support to safely reset peripheral manager from uhd Provide a way to safely reset the peripheral manager from uhd and as a result, a mechanism to reload the fpga/dts components. Signed-off-by: Virendra Kakade --- mpm/python/usrp_mpm/rpc_server.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/mpm/python/usrp_mpm/rpc_server.py b/mpm/python/usrp_mpm/rpc_server.py index 262bedb6c..f1d2620f5 100644 --- a/mpm/python/usrp_mpm/rpc_server.py +++ b/mpm/python/usrp_mpm/rpc_server.py @@ -504,6 +504,35 @@ class MPMServer(RPCServer): # methods from the old peripheral manager (the one before reset) self.clear_method_registry() + def reset_timer_and_mgr(self, token): + """ + Pause the timers, reset the peripheral manager and restart the + timers. + """ + # Check the claimed status + if not self._check_token_valid(token): + self._last_error =\ + "Attempt to reset manager without valid claim from {}".format( + self.client_host + ) + self.log.error(self._last_error) + raise RuntimeError("Attempt to reset manager without valid claim.") + + # Stop the timer, reset_timer_and_mgr can take some time: + self._disable_timeouts = True + try: + self.reset_mgr() + self.log.debug("Reset the periph manager") + except Exception as ex: + self.log.error( + "Error in reset_timer_and_mgr: {}".format( + ex + )) + self._last_error = str(ex) + + self.log.debug("End of reset_timer_and_mgr") + self._reset_timer() + def update_component(self, token, file_metadata_l, data_l): """" Updates the device component files specified by the metadata and data -- cgit v1.2.3