Scan for miflora devices.

    Note: this must be run as root!
1740
def scan(backend, timeout=10):
    
    result = []
    for (mac, name) in backend.scan_for_devices(timeout):
        if (name is not None and name.lower() in VALID_DEVICE_NAMES) or \
                mac is not None and mac.upper().startswith(DEVICE_PREFIX):
            result.append(mac.upper())
    return result
1245814
def _check_type(self):
        '''
        '''

        if self.type not in self.available_types:
            msg = 'Unsupported cluster type was given: %s' % self.type
            raise DeviceGroupNotSupported(msg)
        elif self.type == 'sync-only' and self.name != 'device_trust_group':
            msg = "Management of sync-only device groups only supported for " \
                "built-in device group named 'device_trust_group'"
            raise DeviceGroupNotSupported(msg)
942956
def scan():
    '''
    
    '''
    ret = []
    devices = bluetooth.discover_devices(lookup_names=True)
    for device in devices:
        ret.append({device[0]: device[1]})
    return ret
1199692
protected function scanRoutes($root, $realRoot=NULL) {
		if($realRoot === NULL) $realRoot = $root;
		$result = array();

		$all = glob($root.'/*'); /* */
		foreach($all as $path) {
			if(!is_dir($path)) {
				// This is an endpoint
				$res = $this->createRouteFromFile($realRoot, $path);
				if($res)
					$result[] = $res;
			} else {
				$res = $this->scanRoutes($path, $realRoot);
				foreach($res as $route)
					$result[] = $route;
			}
		}
		return $result;
	}
682985
def get_devices():
    """"""
    buf = create_string_buffer(512)
    buflen = c_uint32(sizeof(buf))
    DAQmxGetSysDevNames(buf, buflen)
    pybuf = buf.value
    devices = pybuf.decode(u'utf-8').split(u",")
    return devices
229790
def detectTizen(self):
        
        return UAgentInfo.deviceTizen in self.__userAgent \
            and UAgentInfo.mobile in self.__userAgent
324270
async def scan_for_devices_multi_run(self, runs=2):
        """"""
        run = 1
        master = {}
        while run < runs + 1:
            await self.scan_for_devices()
            await self.get_scan_result()
            if master is None:
                for device in self._devices:
                    mac = device['mac_address']
                    master[mac] = {}
                    master[mac]['rssi'] = device['rssi']
                    master[mac]['device_class'] = device['device_class']
                    master[mac]['name'] = device['name']
                    master[mac]['device_type'] = device['device_type']
                    master[mac]['count'] = 1
            else:
                for device in self._devices:
                    mac = device['mac_address']
                    if master.get(mac, False):
                        master[mac]['rssi'] = device['rssi']
                        master[mac]['count'] = str(1 + 1)
                    else:
                        master[mac] = {}
                        master[mac]['rssi'] = device['rssi']
                        master[mac]['device_class'] = device['device_class']
                        master[mac]['name'] = device['name']
                        master[mac]['device_type'] = device['device_type']
                        master[mac]['count'] = 1
            run = run + 1
            result = []
            for device in master:
                if int(master[device]['count']) > 1:
                    result.append(master[device])
        self._devices = result
915051
def _scan_ad_hoc(xml)
      r = execute(xml, '1.1', timeout: 60)
      Scan.parse(r.res)
    end
1242141
def devices(opts=[]):
    
    adb_full_cmd = [v.ADB_COMMAND_PREFIX, v.ADB_COMMAND_DEVICES, _convert_opts(opts)]
    return _exec_command(adb_full_cmd)
1172024
function scan() {
    console.log("scanning...");
    bluetooth.requestDevice({
        filters:[{ services:[ eddystoneUUID ] }]
    })
    .then(scan)
    .catch(error => {
        console.log(error);
        process.exit();
    });
}
409463
def root(self):
        """"""
        drive = self.drive
        for device in self._daemon:
            if device.is_drive:
                continue
            if device.is_toplevel and device.drive == drive:
                return device
        return None
875435
public void scanLibraries(
		String rootPackage, boolean includeSubPackages,
		Filter<String> packageFilter, Filter<String> classFilter, Listener<Class<?>> classScanner
	) {
		for (AbstractClassLoader cl : libs)
			cl.scan(rootPackage, includeSubPackages, packageFilter, classFilter, classScanner);
	}
698598
def start_scan(self, active):
        
        try:
            self.bable.start_scan(self._on_device_found, active_scan=active, sync=True)
        except bable_interface.BaBLEException as err:
            # If we are already scanning, raise an error only we tried to change the active scan param
            if self._active_scan != active:
                raise err

        self._active_scan = active
        self.scanning = True
716057
function _checkRootCA () {
  var caKeyFilePath = path.join(certDir, 'ca.key');
  var caCrtFilePath = path.join(certDir, 'ca.crt');

  var keysDir = path.join(__dirname, '..', 'keys');

  if (!fs.existsSync(caKeyFilePath) || !fs.existsSync(caCrtFilePath)) {
    log.debug('CA files do not exist');
    log.debug('Copy CA files');
    fse.copySync(path.join(keysDir, 'ca.key'), caKeyFilePath);
    fse.copySync(path.join(keysDir, 'ca.crt'), caCrtFilePath);
  }
}
720525
def scan_results(self):
        """"""
        
        bsses = self._wifi_ctrl.scan_results(self._raw_obj)

        if self._logger.isEnabledFor(logging.INFO):
            for bss in bsses:
                self._logger.info("Find bss:")
                self._logger.info("\tbssid: %s", bss.bssid)
                self._logger.info("\tssid: %s", bss.ssid)
                self._logger.info("\tfreq: %d", bss.freq)
                self._logger.info("\tauth: %s", bss.auth)
                self._logger.info("\takm: %s", bss.akm)
                self._logger.info("\tsignal: %d", bss.signal)

        return bsses
222208
def get_tree_from_initramfs(root=None):
    
    from insights import run
    return run(MultipathConfTreeInitramfs, root=root).get(MultipathConfTreeInitramfs)
536378
def run_init(device_type, args):
    """"""
    util.setup_logging(verbosity=args.verbose)
    log.warning('This GPG tool is still in EXPERIMENTAL mode, '
                'so please note that the API and features may '
                'change without backwards compatibility!')

    verify_gpg_version()

    # Prepare new GPG home directory for hardware-based identity
    device_name = os.path.basename(sys.argv[0]).rsplit('-', 1)[0]
    log.info('device name: %s', device_name)
    homedir = args.homedir
    if not homedir:
        homedir = os.path.expanduser('~/.gnupg/{}'.format(device_name))

    log.info('GPG home directory: %s', homedir)

    if os.path.exists(homedir):
        log.error('GPG home directory %s exists, '
                  'remove it manually if required', homedir)
        sys.exit(1)

    check_call(['mkdir', '-p', homedir])
    check_call(['chmod', '700', homedir])

    agent_path = util.which('{}-gpg-agent'.format(device_name))

    # Prepare GPG agent invocation script (to pass the PATH from environment).
    with open(os.path.join(homedir, 'run-agent.sh'), 'w') as f:
        f.write(r"""#!/bin/sh
export PATH={0}
{1} \
-vv \
--pin-entry-binary={pin_entry_binary} \
--passphrase-entry-binary={passphrase_entry_binary} \
--cache-expiry-seconds={cache_expiry_seconds} \
$*
""".format(os.environ['PATH'], agent_path, **vars(args)))
    check_call(['chmod', '700', f.name])
    run_agent_script = f.name

    # Prepare GPG configuration file
    with open(os.path.join(homedir, 'gpg.conf'), 'w') as f:
        f.write("""# Hardware-based GPG configuration
agent-program {0}
personal-digest-preferences SHA512
default-key \"{1}\"
""".format(run_agent_script, args.user_id))

    # Prepare a helper script for setting up the new identity
    with open(os.path.join(homedir, 'env'), 'w') as f:
        f.write("""#!/bin/bash
set -eu
export GNUPGHOME={0}
COMMAND=$*
if [ -z "${{COMMAND}}" ]
then
    ${{SHELL}}
else
    ${{COMMAND}}
fi
""".format(homedir))
    check_call(['chmod', '700', f.name])

    # Generate new GPG identity and import into GPG keyring
    pubkey = write_file(os.path.join(homedir, 'pubkey.asc'),
                        export_public_key(device_type, args))
    verbosity = ('-' + ('v' * args.verbose)) if args.verbose else '--quiet'
    check_call(keyring.gpg_command(['--homedir', homedir, verbosity,
                                    '--import', pubkey.name]))

    # Make new GPG identity with "ultimate" trust (via its fingerprint)
    out = check_output(keyring.gpg_command(['--homedir', homedir,
                                            '--list-public-keys',
                                            '--with-fingerprint',
                                            '--with-colons']))
    fpr = re.findall('fpr:::::::::([0-9A-F]+):', out)[0]
    f = write_file(os.path.join(homedir, 'ownertrust.txt'), fpr + ':6\n')
    check_call(keyring.gpg_command(['--homedir', homedir,
                                    '--import-ownertrust', f.name]))

    # Load agent and make sure it responds with the new identity
    check_call(keyring.gpg_command(['--homedir', homedir,
                                    '--list-secret-keys', args.user_id]))