Beispiel #1
0
 def _GetDeviceAddresses(self, excluded_iface):
   """Returns the IP addresses on all connected devices.
   Excludes interface |excluded_iface| on the selected device.
   """
   my_device = str(self._device)
   addresses = []
   for device_serial in android_device.GetDeviceSerials():
     device = device_utils.DeviceUtils(device_serial)
     if device_serial == my_device:
       excluded = excluded_iface
     else:
       excluded = 'no interfaces excluded on other devices'
     addresses += [line.split()[3]
                   for line in device.RunShellCommand('ip -o -4 addr')
                   if excluded not in line]
   return addresses
Beispiel #2
0
 def _GetDeviceAddresses(self, excluded_iface):
   """Returns the IP addresses on all connected devices.
   Excludes interface |excluded_iface| on the selected device.
   """
   my_device = str(self._device)
   addresses = []
   for device_serial in android_device.GetDeviceSerials(None):
     try:
       device = device_utils.DeviceUtils(device_serial)
       if device_serial == my_device:
         excluded = excluded_iface
       else:
         excluded = 'no interfaces excluded on other devices'
       addresses += [line.split()[3]
                     for line in device.RunShellCommand('ip -o -4 addr')
                     if excluded not in line]
     except device_errors.CommandFailedError:
       logging.warning('Unable to determine IP addresses for %s',
                       device_serial)
   return addresses