Fix missing firmware info error
This commit is contained in:
parent
d21620d441
commit
78e39950f5
1 changed files with 5 additions and 2 deletions
|
@ -25,8 +25,11 @@ function getMMDVMHostFileVersion() {
|
||||||
function getFirmwareVersion() {
|
function getFirmwareVersion() {
|
||||||
$logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log";
|
$logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log";
|
||||||
$logLines = explode("\n", `grep "MMDVM protocol version" $logPath`);
|
$logLines = explode("\n", `grep "MMDVM protocol version" $logPath`);
|
||||||
$firmware = substr($logLines[count($logLines)-2], strpos($logLines[count($logLines)-2], "description")+13, strlen($logLines[count($logLines)-2])-strpos($logLines[count($logLines)-2], "description")+13);
|
$firmware = "n/a";
|
||||||
if (strlen($firmware) > 0) {
|
if (count($logLines) >= 2) {
|
||||||
|
$firmware = substr($logLines[count($logLines)-2], strpos($logLines[count($logLines)-2], "description")+13, strlen($logLines[count($logLines)-2])-strpos($logLines[count($logLines)-2], "description")+13);
|
||||||
|
}
|
||||||
|
if ($firmware != "n/a") {
|
||||||
$fp = fopen('/tmp/MMDVMFirmware.txt', 'w');
|
$fp = fopen('/tmp/MMDVMFirmware.txt', 'w');
|
||||||
fwrite($fp, $firmware);
|
fwrite($fp, $firmware);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
Loading…
Reference in a new issue