modem: Fallback to automatic registration if manual one is not supported by modem

Some modems such as the gobi 2000 doesn't support the Register() method
in /operator path. If the method returns a NotSupported error, fallback
to automatic registration.

Change-Id: Ibc322317db634a5380573de88a56eb53fd92e67b
diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py
index bff62bb..cb4a8de 100644
--- a/src/osmo_gsm_tester/modem.py
+++ b/src/osmo_gsm_tester/modem.py
@@ -502,7 +502,14 @@
             return
         dbus_op = systembus_get(matching_op_path)
         self.log('Registering with operator', matching_op_path, mcc_mnc)
-        dbus_call_dismiss_error(self, 'org.ofono.Error.InProgress', dbus_op.Register)
+        try:
+            dbus_call_dismiss_error(self, 'org.ofono.Error.InProgress', dbus_op.Register)
+        except GLib.Error as e:
+            if Gio.DBusError.is_remote_error(e) and Gio.DBusError.get_remote_error(e) == 'org.ofono.Error.NotSupported':
+                self.log('modem does not support manual registering, attempting automatic registering')
+                self.scan_cb_register_automatic(scanned_operators, mcc_mnc)
+                return
+            raise e
 
     def cancel_pending_dbus_methods(self):
         self.cancellable.cancel()