IDE devices
get the ide device information out of dmesg

@return void
978500
protected function ide()
    {
        foreach ($this->readdmesg() as $line) {
            if (preg_match('/^(ad[0-9]+): (.*)MB <(.*)> (.*) (.*)/', $line, $ar_buf)) {
                $dev = new HWDevice();
                $dev->setName($ar_buf[1].": ".trim($ar_buf[3]));
                if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
                    $dev->setCapacity($ar_buf[2] * 1024 * 1024);
                }
                $this->sys->setIdeDevices($dev);
            } elseif (preg_match('/^(acd[0-9]+): (.*) <(.*)> (.*)/', $line, $ar_buf)) {
                $dev = new HWDevice();
                $dev->setName($ar_buf[1].": ".trim($ar_buf[3]));
                $this->sys->setIdeDevices($dev);
            } elseif (preg_match('/^(ada[0-9]+): <(.*)> (.*)/', $line, $ar_buf)) {
                $dev = new HWDevice();
                $dev->setName($ar_buf[1].": ".trim($ar_buf[2]));
                $this->sys->setIdeDevices($dev);
            } elseif (preg_match('/^(ada[0-9]+): (.*)MB \((.*)\)/', $line, $ar_buf)) {
                /* duplication security */
                $notwas = true;
                foreach ($this->sys->getIdeDevices() as $finddev) {
                    if ($notwas && (substr($finddev->getName(), 0, strpos($finddev->getName(), ': ')) == $ar_buf[1])) {
                        if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
                            $finddev->setCapacity($ar_buf[2] * 1024 * 1024);
                        }
                        $notwas = false;
                        break;
                    }
                }
                if ($notwas) {
                    $dev = new HWDevice();
                    $dev->setName($ar_buf[1]);
                    if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
                        $dev->setCapacity($ar_buf[2] * 1024 * 1024);
                    }
                    $this->sys->setIdeDevices($dev);
                }
            } elseif (preg_match('/^(ada[0-9]+): Serial Number (.*)/', $line, $ar_buf)) {
                /* duplication security */
                $notwas = true;
                foreach ($this->sys->getIdeDevices() as $finddev) {
                    if ($notwas && (substr($finddev->getName(), 0, strpos($finddev->getName(), ': ')) == $ar_buf[1])) {
                        if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS
                           && defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
                            $finddev->setSerial(trim($ar_buf[2]));
                        }
                        $notwas = false;
                        break;
                    }
                }
                if ($notwas) {
                    $dev = new HWDevice();
                    $dev->setName($ar_buf[1]);
                    if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS
                       && defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
                        $finddev->setSerial(trim($ar_buf[2]));
                    }
                    $this->sys->setIdeDevices($dev);
                }
            }
        }
        /* cleaning */
        foreach ($this->sys->getIdeDevices() as $finddev) {
                    if (strpos($finddev->getName(), ': ') !== false)
                        $finddev->setName(substr(strstr($finddev->getName(), ': '), 2));
        }
    }
322420
public function getDebugInfos() {
    $requestHeaders = $this->__getLastRequestHeaders();
    $request = $this->__getLastRequest();
    $responseHeaders = $this->__getLastResponseHeaders();
    $response = $this->__getLastResponse();

    $msg = '';
    $msg .= "Request Headers:\n" . $requestHeaders . "\n";
    $msg .= "Request:\n" . $request . "\n";

    $msg .= "Response Headers:\n" . $responseHeaders . "\n";
    $msg .= "Response:\n" . $response . "\n";
    return $msg;
  }
739973
public function getAllDevicesID()
    {
        $devicesId = array();

        foreach ($this->deviceClassificationNames as $className) {
            $currentMap = $this->persistenceStorage->load($className);

            if (!is_array($currentMap)) {
                $currentMap = array();
            }

            $overwritten = $this->persistenceStorage->load($className . '_overwritten');

            if (!is_array($overwritten)) {
                $overwritten = array();
            }

            $devicesId = array_merge($devicesId, array_values($currentMap), $overwritten);
        }

        return $devicesId;
    }
444334
public function debugf()
    {
        $args = func_get_args();
        $format = array_shift($args);
        $this->debug(vsprintf($format, $args));
    }
953685
public function getMsisdn()
    {
        $this->debug->debug(__FUNCTION__, 'isMobile: ' . $this->mDetect->isMobile());
        $this->debug->debug(__FUNCTION__, 'isTablet: ' . $this->mDetect->isTablet());
        try {
            if ($this->mDetect->isMobile() || $this->mDetect->isTablet()) {
                $msisdn = $this->MSISDN->getMsisdn();
                $this->debug->info(__FUNCTION__, 'MSISDN: ' . json_encode($msisdn));

                return $msisdn;
            }
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            $this->debug->error(__FUNCTION__, $message);

            return NULL;
        }
        $this->debug->info(__FUNCTION__, 'MSISDN is Null');

        return NULL;
    }
519335
protected function checkDevDesktop() {
    if ($this->getInspector()->isDevDesktopInitialized()) {
      if (empty($_ENV['DEVDESKTOP_DRUPAL_SETTINGS_DIR'])) {
        $this->logProblem(__FUNCTION__, [
          "DevDesktop usage is enabled, but \$DEVDESKTOP_DRUPAL_SETTINGS_DIR is not set in your environmental variables.",
          "",
          "Add `export DEVDESKTOP_DRUPAL_SETTINGS_DIR=\"\$HOME/.acquia/DevDesktop/DrupalSettings\"` to ~/.bash_profile or equivalent for your system.`",
        ], 'error');
      }
      elseif (strstr($_ENV['DEVDESKTOP_DRUPAL_SETTINGS_DIR'], '~')) {
        $this->logProblem(__FUNCTION__, [
          "\$DEVDESKTOP_DRUPAL_SETTINGS_DIR contains a '~'. This does not always expand to your home directory.",
          "",
          "Add `export DEVDESKTOP_DRUPAL_SETTINGS_DIR=\"\$HOME/.acquia/DevDesktop/DrupalSettings\"` to ~/.bash_profile or equivalent for your system.`",
        ], 'error');
      }

      $variables_order = ini_get('variables_order');
      $php_ini_file = php_ini_loaded_file();
      if (!strstr($variables_order, 'E')) {
        $this->logProblem(__FUNCTION__, [
          "DevDesktop usage is enabled, but variables_order does support environmental variables.",
          "",
          "Define variables_order = \"EGPCS\" in $php_ini_file",
        ], 'error');
      }
    }
  }
812028
public function ___debugInfo()
    {
        return array(
            'name'  => isset($this->propertyNode) ? $this->propertyNode->name->toString() : 'unknown',
            'class' => $this->className
        );
    }
438946
public function debug()
    {
        $info = array();

        $metadata = $this->getMetadata();

        $referenceFields = array();
        foreach (array_merge($metadata['referencesOne'], $metadata['referencesMany']) as $name => $reference) {
            $referenceFields[] = $reference['field'];
        }

        // fields
        foreach ($metadata['fields'] as $name => $field) {
            if (in_array($name, $referenceFields)) {
                continue;
            }
            $info['fields'][$name] = $this->{'get'.ucfirst($name)}();
        }

        // referencesOne
        foreach ($metadata['referencesOne'] as $name => $referenceOne) {
            $info['referencesOne'][$name] = $this->{'get'.ucfirst($referenceOne['field'])}();
        }

        // referencesMany
        foreach ($metadata['referencesMany'] as $name => $referenceMany) {
            $info['referencesMany'][$name] = $this->{'get'.ucfirst($referenceMany['field'])}();
        }

        // embeddedsOne
        foreach ($metadata['embeddedsOne'] as $name => $embeddedOne) {
            $embedded = $this->{'get'.ucfirst($name)}();
            $info['embeddedsOne'][$name] = $embedded ? $embedded->debug() : null;
        }

        // embeddedsMany
        foreach ($metadata['embeddedsMany'] as $name => $embeddedMany) {
            $info['embeddedsMany'][$name] = array();
            foreach ($this->{'get'.ucfirst($name)}() as $key => $value) {
                $info['embeddedsMany'][$name][$key] = $value->debug();
            }
        }

        return $info;
    }
475884
private function outputSetup()
    {
        $this->debug->groupCollapsed(__METHOD__);
        $cfg        = $this->form->cfg;
        $persist    = $this->form->persist;
        $this->keyValue = $persist->get('key').'_'.$persist->get('i');
        $this->debug->info('keyValue', $this->keyValue);
        if ($cfg['output']['autofocus']) {
            $autofocusField = null;
            $invalidFields = $this->form->getInvalidFields();
            if ($invalidFields) {
                $this->debug->warn('autofocusing invalid');
                $autofocusField = \current($invalidFields);
            } else {
                foreach ($this->form->currentFields as $k => $field) {
                    // $this->debug->log('field->attribs', $field->attribs);
                    $autofocusable = \in_array($field->tagname, array('input','textarea','select'))
                        && !\in_array($field->attribs['type'], array('button','hidden','reset','submit'));
                    if (isset($field->attribs['autofocus'])) {
                        if ($field->attribs['autofocus']) {
                            $this->debug->log('autofocus attrib explicitly set for', $k);
                            $autofocusField = $field;
                            break;
                        }
                    } elseif (!$autofocusField && $autofocusable) {
                        $autofocusField = $field;
                        // don't break... may find a field that's explicitly autofocused
                    }
                }
            }
            if ($autofocusField) {
                $autofocusField->focus();
            }
        }
        $this->debug->groupEnd();
    }
1185439
public function debugGet() {
		$aResult = $this->_coll()->findOne([static::$_mKey => $this->_mID]);
		unset($aResult[static::$_mKey]);
		return $aResult;
	}
278488
def _get_cpu_info_from_cat_var_run_dmesg_boot():
	'''
	
	'''
	# Just return {} if there is no /var/run/dmesg.boot
	if not DataSource.has_var_run_dmesg_boot():
		return {}

	# If dmesg.boot fails return {}
	returncode, output = DataSource.cat_var_run_dmesg_boot()
	if output == None or returncode != 0:
		return {}

	return _parse_dmesg_output(output)
1343989
public function getSystemId()
    {
        if (!is_null($this->_systemId)) {
            return $this->_systemId;
        }
        preg_match('/' . ucfirst($this->moduleType) . '([A-Za-z]+)\\\Module/', get_class($this), $matches);
        if (!isset($matches[1])) {
            throw new Exception(get_class($this) . " is not set up correctly!");
        }

        return $this->_systemId = $matches[1];
    }
952024
private static function getConsoleMode()
    {
        $info = static::runCommand('mode CON');

        if ($info && preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
            // extract [w, h] from "wxh"
            return [(int) $matches[2], (int) $matches[1]];
        }

        return [];
    }
662391
def _create_ide_controllers(ide_controllers):
    '''
    
    '''
    ide_ctrls = []
    keys = range(-200, -250, -1)
    if ide_controllers:
        devs = [ide['adapter'] for ide in ide_controllers]
        log.trace('Creating IDE controllers %s', devs)
        for ide, key in zip(ide_controllers, keys):
            ide_ctrls.append(_apply_ide_controller_config(
                ide['adapter'], 'add', key, abs(key + 200)))
    return ide_ctrls
185718
public function diag_strings() {
        $sm = get_string_manager();
        if (!$sm->string_exists($this->identifier, $this->component)) {
            debugging("Help title string does not exist: [$this->identifier, $this->component]");
        }
        if (!$sm->string_exists($this->identifier.'_help', $this->component)) {
            debugging("Help contents string does not exist: [{$this->identifier}_help, $this->component]");
        }
    }
85857
protected function _cpuinfo()
    {
        if (CommonFunctions::executeProgram('pidin', 'info', $buf)
           && preg_match('/^Processor\d+: (.*)/m', $buf)) {
            $lines = preg_split("/\n/", $buf, -1, PREG_SPLIT_NO_EMPTY);
            foreach ($lines as $line) {
                if (preg_match('/^Processor\d+: (.+)/', $line, $proc)) {
                    $dev = new CpuDevice();
                    $dev->SetModel(trim($proc[1]));
                    if (preg_match('/(\d+)MHz/', $proc[1], $mhz)) {
                        $dev->setCpuSpeed($mhz[1]);
                    }
                    $this->sys->setCpus($dev);
                }
            }
        }
    }
107233
protected function readdmesg()
    {
        if (count($this->_dmesg) === 0) {
            if (PSI_OS != "Darwin") {
                if (CommonFunctions::rfts('/var/run/dmesg.boot', $buf, 0, 4096, false) || CommonFunctions::rfts('/var/log/dmesg.boot', $buf, 0, 4096, false) || CommonFunctions::rfts('/var/run/dmesg.boot', $buf)) {  // Once again but with debug
                    $parts = preg_split("/rebooting|Uptime/", $buf, -1, PREG_SPLIT_NO_EMPTY);
                    $this->_dmesg = preg_split("/\n/", $parts[count($parts) - 1], -1, PREG_SPLIT_NO_EMPTY);
                }
            }
        }

        return $this->_dmesg;
    }