in leda_python/deviceMbus.py [0:0]
def driver_init(self, driver_name):
global mbusLoopFlag
if (False == mbusLoopFlag):
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
if (False == isinstance(driver_name, str)):
raise exception.LedaParamsException("driver_init: driver_name type is invalid")
try:
wkn = mbusConfig.CMP_DRIVER_WKN_PREFIX + driver_name
self.driverMbusHandle = mbus.MbusConnect(wkn)
self._openMonitorMbusDaemon()
self.driverMbusObject = self._createMbusDynamicObject(driver_name)
self.driver_name = driver_name
except SystemExit:
raise exception.LedaException("mbus existed")
except:
_logger.exception("Err")
raise exception.LedaException("mbus connect failed")
if (False == mbusLoopFlag):
t = threading.Thread(target=mbus_loop, name="mbusLoop")
t.setDaemon(True)
t.start()
mbusLoopFlag = True