def _get_device_from_info_and_ports(self, info, udi, ports):
        """
        Returns a C{DevicePlugin} out of C{info} and C{dport} and {cport}
        """
        from vmc.common.plugin import PluginManager
        plugin = PluginManager.get_plugin_by_vendor_product_id(*info.values())

        if plugin:
            # set its udi
            plugin.udi = udi

            if hasattr(plugin, 'preprobe_init'):
                # this plugin requires special initialisation before probing
                plugin.preprobe_init(ports, extract_info(info))

            if hasattr(plugin, 'hardcoded_ports'):
                # this plugin registers its ports in a funky way and thus
                # the probe algorithm wont work for it. hardcoded_ports is
                # a tuple of size two that contains the indexes of the ports
                # that should be used for dport and cport.
                dport_index, cport_index = plugin.hardcoded_ports
                dport = ports[dport_index]
                try:
                    if type(cport_index) == type(None):
                        cport = None
                    else:
                        cport = ports[cport_index]
                except Exception, e:
                    log.err()
                    cport = None
            else:
                # probe ports
                dport, cport = probe_ports(ports)

            if not dport and not cport:
                # this shouldn't happen
                raise RuntimeError("No data port and no control port")

            print "data port is %s" % dport
            if cport:
                print "ctrl port is %s" % cport

            plugin.cport, plugin.dport = cport, dport
            return plugin