def _get_usb_hub_map(device_info_list):
  """Creates a map of usb hub addresses to device_infos by port.

  Args:
      device_info_list (list): list of known usb_connections dicts.

  Returns:
     dict: map of usb hub addresses to device_infos by port
  """
  map_usb_hub_ports = {}
  for device_info in device_info_list:
    hub_address = device_info['usb_hub_address']
    port = device_info['usb_hub_port']
    if hub_address:
      if hub_address not in map_usb_hub_ports:
        map_usb_hub_ports[hub_address] = {}
      if not map_usb_hub_ports[hub_address].get(
          port) or device_info['ftdi_interface'] == 2:
        map_usb_hub_ports[hub_address][port] = device_info
  return map_usb_hub_ports