components/cronet/tools/android_rndis_forwarder.py
def _FindHostRndisInterface(self, device_mac_address):
    """Returns the name of the host-side network interface."""
    interface_list = self._EnumerateHostInterfaces()
    ether_address = self._device.ReadFile(
        '%s/f_rndis/ethaddr' % self._RNDIS_DEVICE,
        as_root=True, force_pull=True).strip()
    interface_name = None
    for line in interface_list:
      if not line.startswith((' ', '\t')):
        interface_name = line.split(':')[-2].strip()
        # Attempt to ping device to trigger ARP for device.
        with open(os.devnull, 'wb') as devnull:
          subprocess.call(['ping', '-w1', '-c1', '-I', interface_name,
              self._DEVICE_IP_ADDRESS], stdout=devnull, stderr=devnull)
        # Check if ARP cache now has device in it.
        arp = subprocess.check_output(
            ['arp', '-i', interface_name, self._DEVICE_IP_ADDRESS])
        if device_mac_address in arp:
          return interface_name
      elif ether_address in line:
        return interface_name
      # NOTE(pauljensen): |ether_address| seems incorrect on Nougat devices,
      # but just going by the host interface name seems safe enough.
      elif interface_name == 'usb0':
        return interface_name
Returns the name of the host-side network interface.
Returns the name of the host-side network interface.
Returns the name of the host - side network interface .
def _FindHostRndisInterface(self, device_mac_address):
    interface_list = self._EnumerateHostInterfaces()
    ether_address = self._device.ReadFile(
        '%s/f_rndis/ethaddr' % self._RNDIS_DEVICE,
        as_root=True, force_pull=True).strip()
    interface_name = None
    for line in interface_list:
      if not line.startswith((' ', '\t')):
        interface_name = line.split(':')[-2].strip()
        with open(os.devnull, 'wb') as devnull:
          subprocess.call(['ping', '-w1', '-c1', '-I', interface_name,
              self._DEVICE_IP_ADDRESS], stdout=devnull, stderr=devnull)
        arp = subprocess.check_output(
            ['arp', '-i', interface_name, self._DEVICE_IP_ADDRESS])
        if device_mac_address in arp:
          return interface_name
      elif ether_address in line:
        return interface_name
      elif interface_name == 'usb0':
        return interface_name
def _FindHostRndisInterface ( self , device_mac_address ) : interface_list = self . _EnumerateHostInterfaces ( ) ether_address = self . _device . ReadFile ( '%s/f_rndis/ethaddr' % self . _RNDIS_DEVICE , as_root = True , force_pull = True ) . strip ( ) interface_name = None for line in interface_list : if not line . startswith ( ( ' ' , '\t' ) ) : interface_name = line . split ( ':' ) [ - 2 ] . strip ( ) with open ( os . devnull , 'wb' ) as devnull : subprocess . call ( [ 'ping' , '-w1' , '-c1' , '-I' , interface_name , self . _DEVICE_IP_ADDRESS ] , stdout = devnull , stderr = devnull ) arp = subprocess . check_output ( [ 'arp' , '-i' , interface_name , self . _DEVICE_IP_ADDRESS ] ) if device_mac_address in arp : return interface_name elif ether_address in line : return interface_name elif interface_name == 'usb0' : return interface_name
Returns the name of the host-side network interface.
Returns the name of the host - side network interface .
"""Returns the name of the host-side network interface.""" # Attempt to ping device to trigger ARP for device. # Check if ARP cache now has device in it. # NOTE(pauljensen): |ether_address| seems incorrect on Nougat devices, # but just going by the host interface name seems safe enough.
self
device_mac_address