本文整理汇总了PHP中HWDevice类的典型用法代码示例。如果您正苦于以下问题:PHP HWDevice类的具体用法?PHP HWDevice怎么用?PHP HWDevice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HWDevice类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: pciconf
/**
* parsing the output of pciconf command
*
* @return Array
*/
public static function pciconf()
{
$arrResults = array();
$intS = 0;
if (CommonFunctions::executeProgram("pciconf", "-lv", $strBuf, PSI_DEBUG)) {
$arrTemp = array();
$arrLines = preg_split("/\n/", $strBuf, -1, PREG_SPLIT_NO_EMPTY);
foreach ($arrLines as $strLine) {
if (preg_match("/(.*) = '(.*)'/", $strLine, $arrParts)) {
if (trim($arrParts[1]) == "vendor") {
$arrTemp[$intS] = trim($arrParts[2]);
} elseif (trim($arrParts[1]) == "device") {
$arrTemp[$intS] .= " - " . trim($arrParts[2]);
$intS++;
}
}
}
foreach ($arrTemp as $name) {
$dev = new HWDevice();
$dev->setName($name);
$arrResults[] = $dev;
}
}
return $arrResults;
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:30,代码来源:class.Parser.inc.php
示例2: equals
/**
* compare a given device with the internal one
*
* @param HWDevice $dev device that should be compared
*
* @return boolean
*/
public function equals($dev)
{
if ($dev->getName() === $this->_name && $dev->getCapacity() === $this->_capacity) {
return true;
} else {
return false;
}
}
开发者ID:alexborisov,项目名称:foxfire,代码行数:15,代码来源:class.HWDevice.inc.php
示例3: lspci
/**
* parsing the output of lspci command
*
* @return Array
*/
public static function lspci($debug = PSI_DEBUG)
{
$arrResults = array();
if (CommonFunctions::executeProgram("lspci", "", $strBuf, $debug)) {
$arrLines = preg_split("/\n/", $strBuf, -1, PREG_SPLIT_NO_EMPTY);
foreach ($arrLines as $strLine) {
$arrParams = preg_split('/ /', trim($strLine), 2);
if (count($arrParams) == 2) {
$strName = $arrParams[1];
} else {
$strName = "unknown";
}
$strName = preg_replace('/\\(.*\\)/', '', $strName);
$dev = new HWDevice();
$dev->setName($strName);
$arrResults[] = $dev;
}
}
return $arrResults;
}
开发者ID:phpsysinfo,项目名称:phpsysinfo,代码行数:25,代码来源:class.Parser.inc.php
示例4: _usb
/**
* USB devices
*
* @return array
*/
private function _usb()
{
$devnum = -1;
if (!CommonFunctions::executeProgram('lsusb', '', $bufr, PSI_DEBUG)) {
if (CommonFunctions::rfts('/proc/bus/usb/devices', $bufr, 0, 4096, false)) {
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe as $buf) {
if (preg_match('/^T/', $buf)) {
$devnum += 1;
$results[$devnum] = "";
} elseif (preg_match('/^S:/', $buf)) {
list($key, $value) = preg_split('/: /', $buf, 2);
list($key, $value2) = preg_split('/=/', $value, 2);
if (trim($key) != "SerialNumber") {
$results[$devnum] .= " " . trim($value2);
}
}
}
foreach ($results as $var) {
$dev = new HWDevice();
$dev->setName($var);
$this->sys->setUsbDevices($dev);
}
}
} else {
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe as $buf) {
$device = preg_split("/ /", $buf, 7);
if (isset($device[6]) && trim($device[6]) != "") {
$dev = new HWDevice();
$dev->setName(trim($device[6]));
$this->sys->setUsbDevices($dev);
}
}
}
}
开发者ID:sorrowchen,项目名称:openfiler-cn,代码行数:41,代码来源:class.Linux.inc.php
示例5: ide
/**
* get the ide device information out of ioreg
*
* @return void
*/
protected function ide()
{
$s = $this->_grabioreg('IOATABlockStorageDevice');
$lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$ar_buf = preg_split("/\\/\\//", $line, 19);
if (isset($ar_buf[1]) && $ar_buf[1] == 'class IOMedia' && preg_match('/Media/', $ar_buf[0])) {
$dev = new HWDevice();
$dev->setName($ar_buf[0]);
$this->sys->setIdeDevices($dev);
}
}
}
开发者ID:alexborisov,项目名称:foxfire,代码行数:18,代码来源:class.Darwin.inc.php
示例6: _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
示例7: _buildHardware
/**
* generate the hardware information
*
* @return void
*/
private function _buildHardware()
{
$dev = new HWDevice();
$hardware = $this->_xml->addChild('Hardware');
$pci = $hardware->addChild('PCI');
foreach (System::removeDupsAndCount($this->_sys->getPciDevices()) as $dev) {
$tmp = $pci->addChild('Device');
$tmp->addAttribute('Name', $dev->getName());
$tmp->addAttribute('Count', $dev->getCount());
}
$usb = $hardware->addChild('USB');
foreach (System::removeDupsAndCount($this->_sys->getUsbDevices()) as $dev) {
$tmp = $usb->addChild('Device');
$tmp->addAttribute('Name', $dev->getName());
$tmp->addAttribute('Count', $dev->getCount());
}
$ide = $hardware->addChild('IDE');
foreach (System::removeDupsAndCount($this->_sys->getIdeDevices()) as $dev) {
$tmp = $ide->addChild('Device');
$tmp->addAttribute('Name', $dev->getName());
$tmp->addAttribute('Count', $dev->getCount());
if ($dev->getCapacity() !== null) {
$tmp->addAttribute('Capacity', $dev->getCapacity());
}
}
$scsi = $hardware->addChild('SCSI');
foreach (System::removeDupsAndCount($this->_sys->getScsiDevices()) as $dev) {
$tmp = $scsi->addChild('Device');
$tmp->addAttribute('Name', $dev->getName());
$tmp->addAttribute('Count', $dev->getCount());
if ($dev->getCapacity() !== null) {
$tmp->addAttribute('Capacity', $dev->getCapacity());
}
}
$cpu = $hardware->addChild('CPU');
foreach ($this->_sys->getCpus() as $oneCpu) {
$tmp = $cpu->addChild('CpuCore');
$tmp->addAttribute('Model', $oneCpu->getModel());
if ($oneCpu->getCpuSpeed() !== 0) {
$tmp->addAttribute('CpuSpeed', $oneCpu->getCpuSpeed());
}
if ($oneCpu->getCpuSpeedMax() !== 0) {
$tmp->addAttribute('CpuSpeedMax', $oneCpu->getCpuSpeedMax());
}
if ($oneCpu->getCpuSpeedMin() !== 0) {
$tmp->addAttribute('CpuSpeedMin', $oneCpu->getCpuSpeedMin());
}
if ($oneCpu->getTemp() !== null) {
$tmp->addAttribute('CpuTemp', $oneCpu->getTemp());
}
if ($oneCpu->getBusSpeed() !== null) {
$tmp->addAttribute('BusSpeed', $oneCpu->getBusSpeed());
}
if ($oneCpu->getCache() !== null) {
$tmp->addAttribute('Cache', $oneCpu->getCache());
}
if ($oneCpu->getVirt() !== null) {
$tmp->addAttribute('Virt', $oneCpu->getVirt());
}
if ($oneCpu->getBogomips() !== null) {
$tmp->addAttribute('Bogomips', $oneCpu->getBogomips());
}
if ($oneCpu->getLoad() !== null) {
$tmp->addAttribute('Load', $oneCpu->getLoad());
}
}
}
开发者ID:HaakonME,项目名称:porticoestate,代码行数:72,代码来源:class.XML.inc.php
示例8: _hardware
/**
* Hardwaredevices
*
* @return void
*/
private function _hardware()
{
foreach ($this->_devicelist('PCI') as $pciDev) {
$dev = new HWDevice();
$dev->setName($pciDev);
$this->sys->setPciDevices($dev);
}
foreach ($this->_devicelist('IDE') as $ideDev) {
$dev = new HWDevice();
$dev->setName($ideDev);
$this->sys->setIdeDevices($dev);
}
foreach ($this->_devicelist('SCSI') as $scsiDev) {
$dev = new HWDevice();
$dev->setName($scsiDev);
$this->sys->setScsiDevices($dev);
}
foreach ($this->_devicelist('USB') as $usbDev) {
$dev = new HWDevice();
$dev->setName($usbDev);
$this->sys->setUsbDevices($dev);
}
}
开发者ID:caglaroflazoglu,项目名称:sentora-core,代码行数:28,代码来源:class.WINNT.inc.php
示例9: usb
/**
* USB devices
* get the ide device information out of dmesg
*
* @return void
*/
protected function usb()
{
foreach ($this->readdmesg() as $line) {
// if (preg_match('/^(ugen[0-9\.]+): <(.*)> (.*) (.*)/', $line, $ar_buf)) {
// $dev->setName($ar_buf[1].": ".$ar_buf[2]);
if (preg_match('/^(u[a-z]+[0-9]+): <([^,]*)(.*)> on (usbus[0-9]+)/', $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName($ar_buf[2]);
$this->sys->setUSBDevices($dev);
}
}
}
开发者ID:rzs840707,项目名称:webapps_repository,代码行数:18,代码来源:class.BSDCommon.inc.php
示例10: _usb
/**
* USB devices
* @return void
*/
private function _usb()
{
foreach ($this->readaixdata() as $line) {
if (preg_match("/^[\\*\\+]\\s\\S+\\s+\\S+\\s+(.*USB.*)/", $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName(trim($ar_buf[1]));
$this->sys->setUsbDevices($dev);
}
}
}
开发者ID:phucps89,项目名称:Tour,代码行数:14,代码来源:class.AIX.inc.php
示例11: ide
/**
* get the ide information
*
* @return array
*/
protected function ide()
{
foreach ($this->readdmesg() as $line) {
if (preg_match('/^(.*): (.*) <(.*)> at (ata[0-9]\\-(.*)) (.*)/', $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName($ar_buf[1]);
if (!preg_match("/^acd[0-9](.*)/", $ar_buf[1])) {
$dev->setCapacity($ar_buf[2] * 1024);
}
$this->sys->setIdeDevices($dev);
}
}
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:18,代码来源:class.DragonFly.inc.php
示例12: _tb
/**
* get the thunderbolt device information out of ioreg
*
* @return void
*/
protected function _tb()
{
$s = $this->_grabioreg('IOThunderboltPort');
$lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$dev = new HWDevice();
if (!preg_match('/"Description" = "([^"]*)"/', $line, $ar_buf)) {
$ar_buf = preg_split("/[\\s@]+/", $line, 19);
}
$dev->setName(trim($ar_buf[1]));
$this->sys->setTbDevices($dev);
}
}
开发者ID:JordaoS,项目名称:phpsysinfo,代码行数:18,代码来源:class.Darwin.inc.php
示例13: _usb
/**
* USB devices
*
* @return array
*/
private function _usb()
{
if (CommonFunctions::executeProgram('lsusb', '', $bufr, false)) {
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe as $buf) {
$device = preg_split("/ /", $buf, 6);
if (isset($device[5]) && trim($device[5]) != "") {
$dev = new HWDevice();
$dev->setName(trim($device[5]));
$this->sys->setUsbDevices($dev);
}
}
}
}
开发者ID:bbspike,项目名称:sentora-core,代码行数:19,代码来源:class.Android.inc.php
示例14: ide
/**
* IDE devices
* get the ide device information out of dmesg
*
* @return void
*/
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]);
$dev->setCapacity($ar_buf[2] * 1024);
$this->sys->setIdeDevices($dev);
} elseif (preg_match('/^(acd[0-9]+): (.*) <(.*)> (.*)/', $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName($ar_buf[1]);
$this->sys->setIdeDevices($dev);
}
}
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:21,代码来源:class.BSDCommon.inc.php
示例15: _usb
/**
* USB devices
* get the usb device information
*
* @return void
*/
protected function _usb()
{
if (CommonFunctions::executeProgram('listusb', '', $bufr, PSI_DEBUG)) {
$devices = preg_split("/\n/", $bufr);
foreach ($devices as $device) {
if (preg_match("/^\\S+\\s+\\S+\\s+\"(.*)\"\\s+\"(.*)\"/", $device, $ar_buf)) {
$dev = new HWDevice();
$dev->setName(trim($ar_buf[1] . " " . $ar_buf[2]));
$this->sys->setUSBDevices($dev);
}
}
}
}
开发者ID:sorrowchen,项目名称:openfiler-cn,代码行数:19,代码来源:class.Haiku.inc.php
示例16: scsi
/**
* get the scsi device information out of ioreg
*
* @return void
*/
protected function scsi()
{
$s = $this->_grabioreg('IOBlockStorageServices');
$lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$dev = new HWDevice();
if (!preg_match('/"Product Name"="([^"]*)"/', $line, $ar_buf)) {
$ar_buf = preg_split("/[\\s]+/", $line, 19);
}
$dev->setName(trim($ar_buf[1]));
$this->sys->setScsiDevices($dev);
}
}
开发者ID:bbspike,项目名称:sentora-core,代码行数:18,代码来源:class.Darwin.inc.php
示例17: _i2c
/**
* I2C devices
*
* @return void
*/
protected function _i2c()
{
$i2cdevices = glob('/sys/bus/i2c/devices/*/name', GLOB_NOSORT);
if (($total = count($i2cdevices)) > 0) {
$buf = "";
for ($i = 0; $i < $total; $i++) {
if (CommonFunctions::rfts($i2cdevices[$i], $buf, 1, 4096, false) && trim($buf) != "") {
$dev = new HWDevice();
$dev->setName(trim($buf));
$this->sys->setI2cDevices($dev);
}
}
}
}
开发者ID:winstol2y,项目名称:proxy_project,代码行数:19,代码来源:class.Linux.inc.php
示例18: ide
/**
* IDE information
*
* @return void
*/
protected function ide()
{
foreach ($this->readdmesg() as $line) {
if (preg_match('/^(.*) at (pciide|wdc|atabus|atapibus)[0-9] (.*): <(.*)>/', $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName($ar_buf[1]);
// now loop again and find the capacity
foreach ($this->readdmesg() as $line2) {
if (preg_match("/^(" . $ar_buf[1] . "): (.*), (.*), (.*)MB, .*\$/", $line2, $ar_buf_n)) {
$dev->setCapacity($ar_buf_n[4] * 2048 * 1.049);
} elseif (preg_match("/^(" . $ar_buf[1] . "): (.*) MB, (.*), (.*), .*\$/", $line2, $ar_buf_n)) {
$dev->setCapacity($ar_buf_n[2] * 2048);
}
}
$this->sys->setIdeDevices($dev);
}
}
}
开发者ID:bbspike,项目名称:sentora-core,代码行数:23,代码来源:class.NetBSD.inc.php
示例19: _usb
/**
* USB devices
* @return void
*/
private function _usb()
{
// FIXME
CommonFunctions::executeProgram('cat', '/tmp/webprtconf.txt |grep USB', $bufr);
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$dev = new HWDevice();
$dev->setName($line);
$this->sys->setUsbDevices($dev);
}
}
开发者ID:sorrowchen,项目名称:openfiler-cn,代码行数:15,代码来源:class.AIX.inc.php
注:本文中的HWDevice类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论