modem: Attempt fixing crash from Register() dbus method
Register() method returned today this error which is expected acording to ofono documentation API. In this case it probably happens because the modem internally starts registering at some point between the time Scan() is finished and we call Register(). In this case it is fine for us and we should just ignore the error. A helper method is added to check for this as so far it seems tricky to check error information coming from pydbus. I could not reproduce this issue locally so I could not test that the helper function is going to handle it correctly when it is triggered. That's why I added extra debug information to be able to fix it next time it is triggered. File "/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/ofono_client.py", line 489, in scan_cb_register dbus_op.Register() File "/usr/local/lib/python3.4/dist-packages/pydbus/proxy_method.py", line 75, in __call__ 0, timeout_to_glib(timeout), None).unpack() GLib.Error: g-io-error-quark: GDBus.Error:org.ofono.Error.InProgress: Operation already in progress (36) Change-Id: I58dda09416ee7328812431220fd3d239c5c2980a
This commit is contained in:
parent
e913e3719a
commit
7423d2e584
|
@ -139,6 +139,15 @@ def dbus_async_call(instance, proxymethod, *proxymethod_args,
|
|||
0, timeout, cancellable,
|
||||
_async_result_handler, user_data)
|
||||
|
||||
def dbus_call_dismiss_error(log_obj, err_str, method):
|
||||
try:
|
||||
method()
|
||||
except Exception as e:
|
||||
if isinstance(e, GLib.Error) and err_str in e.domain:
|
||||
log_obj.log('Dismissed Dbus method error: %r' % e)
|
||||
return
|
||||
raise log.Error('dbus_call_dismiss_error raised error %r' % e)
|
||||
|
||||
class ModemDbusInteraction(log.Origin):
|
||||
'''Work around inconveniences specific to pydbus and ofono.
|
||||
ofono adds and removes DBus interfaces and notifies about them.
|
||||
|
@ -463,7 +472,8 @@ class Modem(log.Origin):
|
|||
return
|
||||
self.log('Registering with the default network')
|
||||
netreg = self.dbus.interface(I_NETREG)
|
||||
netreg.Register()
|
||||
dbus_call_dismiss_error(self, 'org.ofono.Error.InProgress', netreg.Register)
|
||||
|
||||
|
||||
def scan_cb_register(self, scanned_operators, mcc_mnc):
|
||||
self.dbg('scanned operators: ', scanned_operators);
|
||||
|
@ -486,7 +496,7 @@ class Modem(log.Origin):
|
|||
return
|
||||
dbus_op = systembus_get(matching_op_path)
|
||||
self.log('Registering with operator', matching_op_path, mcc_mnc)
|
||||
dbus_op.Register()
|
||||
dbus_call_dismiss_error(self, 'org.ofono.Error.InProgress', dbus_op.Register)
|
||||
|
||||
def power_cycle(self):
|
||||
'Power the modem and put it online, power cycle it if it was already on'
|
||||
|
|
Loading…
Reference in New Issue