/** * 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); } } }
/** * 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); } } }
/** * 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] . ": " . $ar_buf[3]); $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] . ": " . $ar_buf[3]); $this->sys->setIdeDevices($dev); } elseif (preg_match('/^(ada[0-9]+): <(.*)> (.*)/', $line, $ar_buf)) { $dev = new HWDevice(); $dev->setName($ar_buf[1] . ": " . $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]) { $finddev->setCapacity($ar_buf[2] * 1024); $notwas = false; break; } } if ($notwas) { $dev = new HWDevice(); $dev->setName($ar_buf[1]); $dev->setCapacity($ar_buf[2] * 1024); $this->sys->setIdeDevices($dev); } } } /* cleaning */ foreach ($this->sys->getIdeDevices() as $finddev) { if (strpos($finddev->getName(), ': ') !== false) { $finddev->setName(substr(strstr($finddev->getName(), ': '), 2)); } } }
/** * IDE devices * * @return void */ private function _ide() { $bufd = CommonFunctions::gdc('/proc/ide', false); foreach ($bufd as $file) { if (preg_match('/^hd/', $file)) { $dev = new HWDevice(); $dev->setName(trim($file)); if (CommonFunctions::rfts("/proc/ide/" . $file . "/media", $buf, 1)) { if (trim($buf) == 'disk') { if (CommonFunctions::rfts("/proc/ide/" . $file . "/capacity", $buf, 1, 4096, false) || CommonFunctions::rfts("/sys/block/" . $file . "/size", $buf, 1, 4096, false)) { $dev->setCapacity(trim($buf) * 512 / 1024); } } } if (CommonFunctions::rfts("/proc/ide/" . $file . "/model", $buf, 1)) { $dev->setName($dev->getName() . ": " . trim($buf)); } $this->sys->setIdeDevices($dev); } } }
/** * 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); } } }