NOISSUE Add GPU vendor and driver version

This commit is contained in:
Joona 2017-08-22 18:02:03 -07:00
parent 0cd55d943e
commit 60d10201e9
No known key found for this signature in database
GPG Key ID: 36D6F8F3E794F2A0

View File

@ -38,17 +38,39 @@ void PrintInstanceInfo::executeTask()
} }
char buff[512]; char buff[512];
FILE *fp = popen("lspci", "r"); int gpuline = -1;
int cline = 0;
FILE *fp = popen("lspci -k", "r");
while (fgets(buff, 512, fp) != NULL) while (fgets(buff, 512, fp) != NULL)
{ {
std::string str(buff); std::string str(buff);
if (str.substr(8, 3) == "VGA") if (str.substr(8, 3) == "VGA")
{ {
gpuline = cline;
QStringList glines = (QStringList() << QString::fromStdString(str.substr(35, std::string::npos))); QStringList glines = (QStringList() << QString::fromStdString(str.substr(35, std::string::npos)));
logLines(glines, MessageLevel::MultiMC); logLines(glines, MessageLevel::MultiMC);
} }
if (gpuline > -1 && gpuline != cline)
{
if (cline - gpuline < 3)
{
QStringList alines = (QStringList() << QString::fromStdString(str.substr(1, std::string::npos)));
logLines(alines, MessageLevel::MultiMC);
}
}
cline++;
} }
FILE *fp2 = popen("glxinfo", "r");
while (fgets(buff, 512, fp2) != NULL)
{
if (strncmp(buff, "OpenGL version string:", 22) == 0)
{
QStringList drlines = (QStringList() << QString::fromUtf8(buff));
logLines(drlines, MessageLevel::MultiMC);
break;
}
}
#endif #endif
logLines(lines, MessageLevel::MultiMC); logLines(lines, MessageLevel::MultiMC);