本文整理汇总了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);
}
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
}
}