summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2019-02-20 08:57:46 +0000
committerHarald Welte <laforge@gnumonks.org>2019-02-20 20:38:46 +0000
commitae0dae821cc9c8c06bd43e6c1e47509cb6b8ae35 (patch)
tree0e78d58dcde88a1c8f466a6b901196e10e29beed
parentc1d705f28e4c302f4df2a960efdd57aa7f796d16 (diff)
modem: Do not connect to the systembus until a modem is in use
In case of the "virtual" tests we: * Don't use ofono based modems (they are physical for now). * Run in an environment that doesn't naturally run a dbus-daemon Modify the code to memoize the bus by hand. Change-Id: Ieae4bf819903402f7f715eb489e0a96ed59dc3f8
-rw-r--r--src/osmo_gsm_tester/modem.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py
index 59e2136..f9b827a 100644
--- a/src/osmo_gsm_tester/modem.py
+++ b/src/osmo_gsm_tester/modem.py
@@ -29,7 +29,7 @@ from gi.module import get_introspection_module
Gio = get_introspection_module('Gio')
from gi.repository import GLib
-bus = SystemBus()
+bus = None
I_MODEM = 'org.ofono.Modem'
I_NETREG = 'org.ofono.NetworkRegistration'
@@ -66,6 +66,8 @@ def dbus_connect(dbus_iface, handler):
def systembus_get(path):
global bus
+ if not bus:
+ bus = SystemBus()
return bus.get('org.ofono', path)
def list_modems():