当前位置: 首页>>代码示例>>PHP>>正文


PHP Parser::lspci方法代码示例

本文整理汇总了PHP中Parser::lspci方法的典型用法代码示例。如果您正苦于以下问题:PHP Parser::lspci方法的具体用法?PHP Parser::lspci怎么用?PHP Parser::lspci使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Parser的用法示例。


在下文中一共展示了Parser::lspci方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: pci

 /**
  * get the pci device information out of ioreg
  *
  * @return void
  */
 protected function pci()
 {
     if (!($arrResults = Parser::lspci(false))) {
         //no lspci port
         $s = $this->_grabioreg('IOPCIDevice');
         $lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
         foreach ($lines as $line) {
             $dev = new HWDevice();
             if (!preg_match('/"IOName" = "([^"]*)"/', $line, $ar_buf)) {
                 $ar_buf = preg_split("/[\\s@]+/", $line, 19);
             }
             $dev->setName(trim($ar_buf[1]));
             $this->sys->setPciDevices($dev);
         }
     } else {
         foreach ($arrResults as $dev) {
             $this->sys->setPciDevices($dev);
         }
     }
 }
开发者ID:bbspike,项目名称:sentora-core,代码行数:25,代码来源:class.Darwin.inc.php

示例2: pci

 /**
  * PCI devices
  * get the pci device information out of dmesg
  *
  * @return void
  */
 protected function pci()
 {
     if (!(is_array($results = Parser::lspci()) || is_array($results = Parser::pciconf()))) {
         foreach ($this->readdmesg() as $line) {
             if (preg_match("/" . $this->_PCIRegExp1 . "/", $line, $ar_buf)) {
                 $dev = new HWDevice();
                 $dev->setName($ar_buf[1] . ": " . $ar_buf[2]);
                 $results[] = $dev;
             } elseif (preg_match("/" . $this->_PCIRegExp2 . "/", $line, $ar_buf)) {
                 $dev = new HWDevice();
                 $dev->setName($ar_buf[1] . ": " . $ar_buf[2]);
                 $results[] = $dev;
             }
         }
     }
     foreach ($results as $device) {
         $this->sys->setPciDevices($dev);
     }
 }
开发者ID:jhbsz,项目名称:ossimTest,代码行数:25,代码来源:class.BSDCommon.inc.php

示例3: _pci

 /**
  * PCI devices
  * get the pci device information out of dmesg
  *
  * @return void
  */
 protected function _pci()
 {
     if (CommonFunctions::rfts('/proc/pci', $strBuf, 0, 4096, false)) {
         $arrLines = preg_split("/\n/", $strBuf, -1, PREG_SPLIT_NO_EMPTY);
         foreach ($arrLines as $strLine) {
             $arrParams = preg_split('/\\s+/', trim($strLine), 4);
             if (count($arrParams) == 4) {
                 $strName = $arrParams[3];
             } else {
                 $strName = "unknown";
             }
             $strName = preg_replace('/\\(.*\\)/', '', $strName);
             $dev = new HWDevice();
             $dev->setName($strName);
             $arrResults[] = $dev;
         }
         foreach ($arrResults as $dev) {
             $this->sys->setPciDevices($dev);
         }
     }
     if (!is_array($arrResults) && is_array($results = Parser::lspci())) {
         /* if access error: chmod 4755 /usr/bin/lspci */
         foreach ($results as $dev) {
             $this->sys->setPciDevices($dev);
         }
     }
 }
开发者ID:sorrowchen,项目名称:openfiler-cn,代码行数:33,代码来源:class.Minix.inc.php

示例4: _pci

 /**
  * PCI devices
  *
  * @return void
  */
 private function _pci()
 {
     if (!($arrResults = Parser::lspci())) {
         if (CommonFunctions::rfts('/proc/pci', $strBuf, 0, 4096, false)) {
             $booDevice = false;
             $arrBuf = preg_split("/\n/", $strBuf, -1, PREG_SPLIT_NO_EMPTY);
             foreach ($arrBuf as $strLine) {
                 if (preg_match('/Bus/', $strLine)) {
                     $booDevice = true;
                     continue;
                 }
                 if ($booDevice) {
                     list($strKey, $strValue) = preg_split('/: /', $strLine, 2);
                     if (!preg_match('/bridge/i', $strKey) && !preg_match('/USB/i ', $strKey)) {
                         $dev = new HWDevice();
                         $dev->setName(preg_replace('/\\([^\\)]+\\)\\.$/', '', trim($strValue)));
                         $this->sys->setPciDevices($dev);
                     }
                     $booDevice = false;
                 }
             }
         }
     } else {
         foreach ($arrResults as $dev) {
             $this->sys->setPciDevices($dev);
         }
     }
 }
开发者ID:sorrowchen,项目名称:openfiler-cn,代码行数:33,代码来源:class.Linux.inc.php

示例5: _pci

 /**
  * PCI devices
  *
  * @return void
  */
 private function _pci()
 {
     if ($arrResults = Parser::lspci()) {
         foreach ($arrResults as $dev) {
             $this->sys->setPciDevices($dev);
         }
     } elseif (CommonFunctions::rfts('/proc/pci', $strBuf, 0, 4096, false)) {
         $booDevice = false;
         $arrBuf = preg_split("/\n/", $strBuf, -1, PREG_SPLIT_NO_EMPTY);
         foreach ($arrBuf as $strLine) {
             if (preg_match('/^\\s*Bus\\s/', $strLine)) {
                 $booDevice = true;
                 continue;
             }
             if ($booDevice) {
                 $dev = new HWDevice();
                 $dev->setName(preg_replace('/\\([^\\)]+\\)\\.$/', '', trim($strLine)));
                 $this->sys->setPciDevices($dev);
                 /*
                                     list($strKey, $strValue) = preg_split('/: /', $strLine, 2);
                                     if (!preg_match('/bridge/i', $strKey) && !preg_match('/USB/i ', $strKey)) {
                                         $dev = new HWDevice();
                                         $dev->setName(preg_replace('/\([^\)]+\)\.$/', '', trim($strValue)));
                                         $this->sys->setPciDevices($dev);
                                     }
                 */
                 $booDevice = false;
             }
         }
     } else {
         $pcidevices = glob('/sys/bus/pci/devices/*/uevent', GLOB_NOSORT);
         if (($total = count($pcidevices)) > 0) {
             $buf = "";
             for ($i = 0; $i < $total; $i++) {
                 if (CommonFunctions::rfts($pcidevices[$i], $buf, 0, 4096, false) && trim($buf) != "") {
                     $pcibuf = "";
                     if (preg_match("/^PCI_CLASS=(\\S+)/m", trim($buf), $subbuf)) {
                         $pcibuf = "Class " . $subbuf[1] . ":";
                     }
                     if (preg_match("/^PCI_ID=(\\S+)/m", trim($buf), $subbuf)) {
                         $pcibuf .= " Device " . $subbuf[1];
                     }
                     if (preg_match("/^DRIVER=(\\S+)/m", trim($buf), $subbuf)) {
                         $pcibuf .= " Driver " . $subbuf[1];
                     }
                     $dev = new HWDevice();
                     if (trim($pcibuf) != "") {
                         $dev->setName(trim($pcibuf));
                     } else {
                         $dev->setName("unknown");
                     }
                     $this->sys->setPciDevices($dev);
                 }
             }
         }
     }
 }
开发者ID:winstol2y,项目名称:proxy_project,代码行数:62,代码来源:class.Linux.inc.php


注:本文中的Parser::lspci方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。