def _get_device_from_model(self, model, dev_info): plugin = PluginManager.get_plugin_by_remote_name(model) if plugin: device = dev_info['callout'].split('/')[-1] set_property = partial(plugin.set_property, emit=True) set_property(MDM_INTFACE, 'Device', device) # XXX: Fix MasterDevice set_property(MDM_INTFACE, 'MasterDevice', 'iokit:com.vodafone.BMC.NotImplemented') # XXX: Fix CDMA set_property(MDM_INTFACE, 'Type', MM_MODEM_TYPE_REV['GSM']) set_property(MDM_INTFACE, 'Driver', 'notimplemented') set_property(MDM_INTFACE, 'IpMethod', MM_IP_METHOD_PPP) set_property(MDM_INTFACE, 'UnlockRequired', "") # import here else we start the dbus too early in startup from dbus import Boolean set_property(MDM_INTFACE, 'Enabled', Boolean(False)) # set to unknown set_property(NET_INTFACE, 'AccessTechnology', 0) # set to -1 so any comparison will fail and will update it set_property(NET_INTFACE, 'AllowedMode', -1) plugin.opath = self._generate_opath() plugin.ports = Ports(dev_info['callout'], dev_info['dialin']) return plugin
def identify_device_cb(model): # plugin to return ret = None if model in plugin.mapping: ret = plugin.mapping[model]() elif plugin.__remote_name__ != model: # so we basically have a device identified by vendor & product id # but we know nothing of this model try: ret = PluginManager.get_plugin_by_remote_name(model) except ex.UnknownPluginNameError: plugin.name = model if ret is not None: # we found another plugin during the process ret.patch(plugin) return check_auth_state(ret) # return the original plugin, most of the time this should work return check_auth_state(plugin)