lspci() public static méthode

parsing the output of lspci command
public static lspci ( $debug = PSI_DEBUG ) : Array
Résultat Array
 /**
  * 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);
         }
     }
 }
 /**
  * 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);
     }
 }
 /**
  * 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);
         }
     }
 }
 /**
  * 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);
         }
     }
 }
 /**
  * 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);
                 }
             }
         }
     }
 }