Return th HW platform information from the device.
18764
def get_hw_platform(self, udi):
        """"""
        platform = None
        try:
            pid = udi['pid']
            if pid == '':
                self.log("Empty PID. Use the hw family from the platform string.")
                return self.raw_family
            match = re.search(self.pid2platform_re, pid)
            if match:
                platform = match.group(1)
        except KeyError:
            pass
        return platform
1242065
def _get_device_info(self, device_id):
        """"""
        params = {'access_token': self.access_token}
        r = self.spark_api(device_id).GET(params=params, timeout=30)
        self._check_error(r)
        return r.json()
380620
def model(self):
        """"""
        try:
            return self.data.get('identity').get('model_name')
        except (KeyError, AttributeError):
            return self.device_status_simple('')
1001094
def _get_platform_name(ncattr):
        """"""
        match = re.match(r'G-(\d+)', ncattr)
        if match:
            return SPACECRAFTS.get(int(match.groups()[0]))

        return None
852362
def detect_platform(self):
        """"""
        # For Mac and Linux 32bit we do not need the bits appended
        if mozinfo.os == 'mac' or \
                (mozinfo.os == 'linux' and mozinfo.bits == 32):
            return mozinfo.os
        else:
            return "%s%d" % (mozinfo.os, mozinfo.bits)
790688
def get_devices(platform)
      ENV['THREADS'] = '1' if ENV['THREADS'].nil?
      if platform == 'android'
        Android.new.devices
      elsif platform == 'ios'
        IOS.new.devices
      end
    end
164598
def get(self, device_id: int) -> Optional[Device]:
        """"""
        return self._devices.get(device_id)
223201
def device_info(device):
    """"""

    status = subprocess.check_output([
        'ibstat', device, '-s']).splitlines()

    regexes = {
        "CA type: (.*)": "device_type",
        "Number of ports: (.*)": "num_ports",
        "Firmware version: (.*)": "fw_ver",
        "Hardware version: (.*)": "hw_ver",
        "Node GUID: (.*)": "node_guid",
        "System image GUID: (.*)": "sys_guid",
    }

    device = DeviceInfo()

    for line in status:
        for expression, key in regexes.items():
            matches = re.search(expression, line)
            if matches:
                setattr(device, key, matches.group(1))

    return device
947482
def device_information(name, identifier):
    """"""
    # pylint: disable=no-member
    message = create(protobuf.DEVICE_INFO_MESSAGE)
    info = message.inner()
    info.uniqueIdentifier = identifier
    info.name = name
    info.localizedModelName = 'iPhone'
    info.systemBuildVersion = '14G60'
    info.applicationBundleIdentifier = 'com.apple.TVRemote'
    info.applicationBundleVersion = '273.12'
    info.protocolVersion = 1
    info.lastSupportedMessageType = 58
    info.supportsExtendedMotion = True
    return message
303999
def get_sys_info():
    """"""
    blob = dict()
    blob["OS"] = platform.system()
    blob["OS-release"] = platform.release()
    blob["Python"] = platform.python_version()
    return blob
989252
def get_device_by_ain(self, ain):
        """"""
        devices = self.get_devices()
        for device in devices:
            if device.ain == ain:
                return device
743423
def _GetHWInfos(client_list, batch_size=10000, token=None):
  """"""

  # This function returns a dict mapping each client_id to a set of reported
  # hardware serial numbers reported by this client.
  hw_infos = {}

  logging.info("%d clients to process.", len(client_list))

  c = 0

  for batch in collection.Batch(client_list, batch_size):
    logging.info("Processing batch: %d-%d", c, c + batch_size)
    c += len(batch)

    client_objs = aff4.FACTORY.MultiOpen(batch, age=aff4.ALL_TIMES, token=token)

    for client in client_objs:
      hwi = client.GetValuesForAttribute(client.Schema.HARDWARE_INFO)

      hw_infos[client.urn] = set(["%s" % x.serial_number for x in hwi])

  return hw_infos
1209132
def location(self):
        """"""
        try:
            return self.data.get('identity').get('location')
        except (KeyError, AttributeError):
            return self.device_status_simple('')
1252255
def device_info(self):
        
        info = {
            'serial': self.serial,
            'model': self.model,
            'build_info': self.build_info,
            'user_added_info': self._user_added_device_info
        }
        return info
982506
def device_info(self):
        """"""
        return {
            'connections': {('mac', self.device['device_mac'])},
            'identifieres': self.device['device_id'],
            'manufacturer': 'Minut',
            'model': 'Point v{}'.format(self.device['hardware_version']),
            'name': self.device['description'],
            'sw_version': self.device['firmware']['installed'],
        }
490327
def get_device_path(h_info, interface_data, ptr_info_data = None):
    "
    required_size = c_ulong(0)

    dev_inter_detail_data         = SP_DEVICE_INTERFACE_DETAIL_DATA()
    dev_inter_detail_data.cb_size = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA)

    # get actual storage requirement
    SetupDiGetDeviceInterfaceDetail(h_info, byref(interface_data),
            None, 0, byref(required_size),
            None)
    ctypes.resize(dev_inter_detail_data, required_size.value)

    # read value
    SetupDiGetDeviceInterfaceDetail(h_info, byref(interface_data),
            byref(dev_inter_detail_data), required_size, None,
            ptr_info_data)

    # extract string only
    return dev_inter_detail_data.get_string()
627442
def check_platforms(platforms):
  """"""
  if len(platforms) > 0:
    return all(platform in PLATFORM_IDS for platform in platforms)
  return True