示例#1
0
    def identify_device_cb(model):
        # plugin to return
        _plugin = None

        if plugin.mapping:
            if model in plugin.mapping:
                _plugin = plugin.mapping[model]()

        # the plugin has no mapping, chances are that we already identified
        # it by its vendor & product id
        elif plugin.__remote_name__ != model:
            from vmc.common.plugin import PluginManager
            # so we basically have a device identified by vendor & product id
            # but we know nuthin of this model
            try:
                _plugin = PluginManager.get_plugin_by_remote_name(model)
            except ex.UnknownPluginNameError:
                plugin.name = model

        if _plugin is not None:
            # we found another plugin during the process
            _plugin.patch(plugin)
            return _plugin
        else:
            return plugin
示例#2
0
 def select_and_configure(name):
     try:
         plugin = \
           PluginManager.get_plugin_by_remote_name(name)
         plugin.setup(properties)
         self.udi_device[str(plugin.udi)] = plugin
         self.device_list.append(plugin)
         self.view.device_added(plugin)
     except Exception, e:
         print e
 def select_and_configure(name):
     try:
         plugin = \
           PluginManager.get_plugin_by_remote_name(name)
         plugin.setup(properties)
         self.udi_device[str(plugin.udi)] = plugin
         self.device_list.append(plugin)
         self.view.device_added(plugin)
     except Exception, e:
         print e
 def get_plugin_from_name(self, name, dev):
     try:
         plugin = PluginManager.get_plugin_by_remote_name(name)
         plugin.dport = dev.dport
         plugin.baudrate = dev.baudrate
         if dev.cport:
             plugin.cport = dev.cport
         return plugin
     except UnknownPluginNameError, e:
         # we have a device that share's the ID with other plugin (potentially
         # based on the same chipset) but its remote name differs, this is
         # probably gonna be a new revision of a model, we will risk ourselves
         # and use the most similar plugin we know of
         return dev
 def get_plugin_from_name(self, name, dev):
     try:
         plugin = PluginManager.get_plugin_by_remote_name(name)
         plugin.dport = dev.dport
         plugin.baudrate = dev.baudrate
         if dev.cport:
             plugin.cport = dev.cport
         return plugin
     except UnknownPluginNameError, e:
         # we have a device that share's the ID with other plugin (potentially
         # based on the same chipset) but its remote name differs, this is
         # probably gonna be a new revision of a model, we will risk ourselves
         # and use the most similar plugin we know of
         return dev
示例#6
0
 def setUpClass(self):
     # uncomment me to see whats going on
     huawei = PluginManager.get_plugin_by_remote_name('E220')
     stub = test_protocol(huawei, SerialPortStub, BufferingStateMachine)
     self.stub = stub
 def setUpClass(self):
     # uncomment me to see whats going on
     huawei = PluginManager.get_plugin_by_remote_name('E220')
     stub = test_protocol(huawei, SerialPortStub, BufferingStateMachine)
     self.stub = stub