Skip to content
This repository was archived by the owner on Feb 27, 2023. It is now read-only.

Commit fc5cf67

Browse files
committed
Use more robust method of reading board revision
1 parent 8217da8 commit fc5cf67

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

recovery/util.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <QFile>
99
#include <QProcess>
1010
#include <QDebug>
11+
#include <QList>
1112

1213
/*
1314
* Convenience functions
@@ -100,10 +101,19 @@ uint readBoardRevision()
100101
{
101102
if (revision == 0)
102103
{
103-
QFile f("/sys/module/bcm2708/parameters/boardrev");
104-
f.open(f.ReadOnly);
105-
revision = f.readAll().trimmed().toUInt();
106-
f.close();
104+
QProcess proc;
105+
proc.start("vcgencmd otp_dump");
106+
proc.waitForFinished();
107+
QList<QByteArray> lines = proc.readAll().split('\n');
108+
for (int i=0; i < lines.size(); i++)
109+
{
110+
if (lines.at(i).startsWith("30:"))
111+
{
112+
bool ok;
113+
revision = lines.at(i).right(8).toUInt(&ok, 16) & 0xFFFFFF;
114+
break;
115+
}
116+
}
107117
}
108118
return revision;
109119
}

0 commit comments

Comments
 (0)